protected in the case where a variable is being initialized by a
trivial default constructor but has a non-trivial destructor.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133037
91177308-0d34-0410-b5e6-
96231b3b80d8
def note_indirect_goto_target : Note<"possible target of indirect goto">;
def note_protected_by_variable_init : Note<
"jump bypasses variable initialization">;
+def note_protected_by_variable_nontriv_destructor : Note<
+ "jump bypasses variable with a non-trivial destructor">;
def note_protected_by_cleanup : Note<
"jump bypasses initialization of variable with __attribute__((cleanup))">;
def note_protected_by_vla_typedef : Note<
: Record->isPOD()) &&
Constructor->isDefaultConstructor())
CallsTrivialConstructor = true;
+
+ if (CallsTrivialConstructor && !Record->hasTrivialDestructor())
+ InDiag = diag::note_protected_by_variable_nontriv_destructor;
}
if (!CallsTrivialConstructor)
void f();
void test_Y() {
- goto end;
- Y y;
+ goto end; // expected-error{{goto into protected scope}}
+ Y y; // expected-note{{jump bypasses variable with a non-trivial destructor}}
end:
f();
- goto inner;
+ goto inner; // expected-error{{goto into protected scope}}
{
- Y y2;
+ Y y2; // expected-note{{jump bypasses variable with a non-trivial destructor}}
inner:
f();
}