summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDecl.cpp
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2010-09-03 01:11:38 +0000
committerAnders Carlsson <andersca@mac.com>2010-09-03 01:11:38 +0000
commit4013404eff6d39ee69f79c0dd0fade8e4ca944a3 (patch)
treeee151a12cf0d007f81f151ac7b845d9026bdbc77 /clang/lib/Sema/SemaDecl.cpp
parentba8752aac8e1e59f6bcbb63ccb7fb8f993a19021 (diff)
downloadbcm5719-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.cpp4
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);
OpenPOWER on IntegriCloud