diff options
| author | Anders Carlsson <andersca@mac.com> | 2010-09-03 01:11:38 +0000 |
|---|---|---|
| committer | Anders Carlsson <andersca@mac.com> | 2010-09-03 01:11:38 +0000 |
| commit | 4013404eff6d39ee69f79c0dd0fade8e4ca944a3 (patch) | |
| tree | ee151a12cf0d007f81f151ac7b845d9026bdbc77 /clang/lib/Sema/SemaDecl.cpp | |
| parent | ba8752aac8e1e59f6bcbb63ccb7fb8f993a19021 (diff) | |
| download | bcm5719-llvm-4013404eff6d39ee69f79c0dd0fade8e4ca944a3.tar.gz bcm5719-llvm-4013404eff6d39ee69f79c0dd0fade8e4ca944a3.zip | |
Static local variables don't result in global constructors being emitted.
llvm-svn: 112933
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
| -rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 4b116890fa1..9c10b85ad47 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -4280,7 +4280,7 @@ void Sema::AddInitializerToDecl(Decl *RealDecl, Expr *Init, bool DirectInit) { if (getLangOptions().CPlusPlus) { if (!VDecl->isInvalidDecl() && !VDecl->getDeclContext()->isDependentContext() && - VDecl->hasGlobalStorage() && + VDecl->hasGlobalStorage() && !VDecl->isStaticLocal() && !Init->isConstantInitializer(Context, VDecl->getType()->isReferenceType())) Diag(VDecl->getLocation(), diag::warn_global_constructor) @@ -4492,7 +4492,7 @@ void Sema::ActOnUninitializedDecl(Decl *RealDecl, Var->setInit(MaybeCreateCXXExprWithTemporaries(Init.takeAs<Expr>())); if (getLangOptions().CPlusPlus && !Var->isInvalidDecl() && - Var->hasGlobalStorage() && + Var->hasGlobalStorage() && !Var->isStaticLocal() && !Var->getDeclContext()->isDependentContext() && !Var->getInit()->isConstantInitializer(Context, false)) Diag(Var->getLocation(), diag::warn_global_constructor); |

