@@ -2793,8 +2793,7 @@ void Sema::CheckVariableDeclaration(VarDecl *NewVD,
2793
2793
2794
2794
bool isVM = T->isVariablyModifiedType ();
2795
2795
if (isVM || NewVD->hasAttr <CleanupAttr>() ||
2796
- NewVD->hasAttr <BlocksAttr>() ||
2797
- (LangOpts.CPlusPlus && NewVD->hasLocalStorage ()))
2796
+ NewVD->hasAttr <BlocksAttr>())
2798
2797
setFunctionHasBranchProtectedScope ();
2799
2798
2800
2799
if ((isVM && NewVD->hasLinkage ()) ||
@@ -3934,6 +3933,9 @@ void Sema::AddInitializerToDecl(DeclPtrTy dcl, ExprArg init, bool DirectInit) {
3934
3933
return ;
3935
3934
}
3936
3935
3936
+ if (getLangOptions ().CPlusPlus && VDecl->hasLocalStorage ())
3937
+ setFunctionHasBranchProtectedScope ();
3938
+
3937
3939
// Take ownership of the expression, now that we're sure we have somewhere
3938
3940
// to put it.
3939
3941
Expr *Init = init.takeAs <Expr>();
@@ -4253,6 +4255,12 @@ void Sema::ActOnUninitializedDecl(DeclPtrTy dcl,
4253
4255
// program is ill-formed.
4254
4256
// FIXME: DPG thinks it is very fishy that C++0x disables this.
4255
4257
} else {
4258
+ // Check for jumps past the implicit initializer. C++0x
4259
+ // clarifies that this applies to a "variable with automatic
4260
+ // storage duration", not a "local variable".
4261
+ if (getLangOptions ().CPlusPlus && Var->hasLocalStorage ())
4262
+ setFunctionHasBranchProtectedScope ();
4263
+
4256
4264
InitializedEntity Entity = InitializedEntity::InitializeVariable (Var);
4257
4265
InitializationKind Kind
4258
4266
= InitializationKind::CreateDefault (Var->getLocation ());
0 commit comments