diff options
| author | John McCall <rjmccall@apple.com> | 2010-08-01 00:26:45 +0000 |
|---|---|---|
| committer | John McCall <rjmccall@apple.com> | 2010-08-01 00:26:45 +0000 |
| commit | a95172baa0475d0045ddf493679f7611eb4efeb2 (patch) | |
| tree | aeb8e904db3978722bd97e11e48d98ac9a15ff06 /clang/lib/Sema/SemaDecl.cpp | |
| parent | 82bef970cf218c3e99b1bb3d5be6b8bb6e1434b7 (diff) | |
| download | bcm5719-llvm-a95172baa0475d0045ddf493679f7611eb4efeb2.tar.gz bcm5719-llvm-a95172baa0475d0045ddf493679f7611eb4efeb2.zip | |
Only run the jump-checker if there's a branch-protected scope *and* there's
a switch or goto somewhere in the function. Indirect gotos trigger the
jump-checker regardless, because the conditions there are slightly more
elaborate and it's too marginal a case to be worth optimizing.
Turns off the jump-checker in a lot of cases in C++. rdar://problem/7702918
llvm-svn: 109962
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
| -rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index d6d13384b2c..a6ba359972f 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -2380,7 +2380,7 @@ Sema::ActOnTypedefDeclarator(Scope* S, Declarator& D, DeclContext* DC, // then it shall have block scope. QualType T = NewTD->getUnderlyingType(); if (T->isVariablyModifiedType()) { - FunctionNeedsScopeChecking() = true; + setFunctionHasBranchProtectedScope(); if (S->getFnParent() == 0) { bool SizeIsNegative; @@ -2794,12 +2794,8 @@ void Sema::CheckVariableDeclaration(VarDecl *NewVD, bool isVM = T->isVariablyModifiedType(); if (isVM || NewVD->hasAttr<CleanupAttr>() || NewVD->hasAttr<BlocksAttr>() || - // FIXME: We need to diagnose jumps passed initialized variables in C++. - // However, this turns on the scope checker for everything with a variable - // which may impact compile time. See if we can find a better solution - // to this, perhaps only checking functions that contain gotos in C++? (LangOpts.CPlusPlus && NewVD->hasLocalStorage())) - FunctionNeedsScopeChecking() = true; + setFunctionHasBranchProtectedScope(); if ((isVM && NewVD->hasLinkage()) || (T->isVariableArrayType() && NewVD->hasGlobalStorage())) { |

