@@ -6848,6 +6848,7 @@ def note_protected_by_objc_weak_init : Note<
68486848 "jump bypasses initialization of __weak variable">;
68496849def note_protected_by_non_trivial_c_struct_init : Note<
68506850 "jump bypasses initialization of variable of non-trivial C struct type">;
6851+ def note_protected_by_defer_stmt : Note<"jump bypasses defer statement">;
68516852def note_enters_block_captures_cxx_obj : Note<
68526853 "jump enters lifetime of block which captures a destructible C++ object">;
68536854def note_enters_block_captures_strong : Note<
@@ -6861,6 +6862,7 @@ def note_enters_compound_literal_scope : Note<
68616862 "jump enters lifetime of a compound literal that is non-trivial to destruct">;
68626863def note_enters_statement_expression : Note<
68636864 "jump enters a statement expression">;
6865+ def note_enters_defer_stmt : Note<"jump enters a defer statement">;
68646866
68656867def note_exits_cleanup : Note<
68666868 "jump exits scope of variable with __attribute__((cleanup))">;
@@ -6906,6 +6908,16 @@ def note_exits_block_captures_non_trivial_c_struct : Note<
69066908 "to destroy">;
69076909def note_exits_compound_literal_scope : Note<
69086910 "jump exits lifetime of a compound literal that is non-trivial to destruct">;
6911+ def note_exits_defer_stmt : Note<"jump exits a defer statement">;
6912+ def err_jump_out_of_defer_stmt : Error<
6913+ "cannot %enum_select<DeferJumpKind>{"
6914+ "%Break{break out of a}|"
6915+ "%Continue{continue loop outside of enclosing}|"
6916+ "%Return{return from a}|"
6917+ "%SEHLeave{__leave a}"
6918+ "}0 defer statement">;
6919+ def err_defer_invalid_sjlj : Error<
6920+ "cannot use %0 inside a defer statement">;
69096921
69106922def err_func_returning_qualified_void : ExtWarn<
69116923 "function cannot return qualified void type %0">,
@@ -11020,6 +11032,8 @@ def err_switch_explicit_conversion : Error<
1102011032def err_switch_incomplete_class_type : Error<
1102111033 "switch condition has incomplete class type %0">;
1102211034
11035+ // TODO: It ought to be possible to refactor these to be a single warning that
11036+ // uses %enum_select.
1102311037def warn_empty_if_body : Warning<
1102411038 "if statement has empty body">, InGroup<EmptyBody>;
1102511039def warn_empty_for_body : Warning<
@@ -11030,6 +11044,8 @@ def warn_empty_while_body : Warning<
1103011044 "while loop has empty body">, InGroup<EmptyBody>;
1103111045def warn_empty_switch_body : Warning<
1103211046 "switch statement has empty body">, InGroup<EmptyBody>;
11047+ def warn_empty_defer_body : Warning<
11048+ "defer statement has empty body">, InGroup<EmptyBody>;
1103311049def note_empty_body_on_separate_line : Note<
1103411050 "put the semicolon on a separate line to silence this warning">;
1103511051
0 commit comments