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 | 4938f2385f82e54df019b2fb1128a58ebad98bec (patch) | |
tree | 956ed6844c66bbe760934bbb42ff786b9f47954a /lib/Sema/SemaDecl.cpp | |
parent | 56af4462781d2fcd30dcf9a742cb66400e5e55b7 (diff) |
Static local variables don't result in global constructors being emitted.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112933 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDecl.cpp')
-rw-r--r-- | lib/Sema/SemaDecl.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 4b116890fa..9c10b85ad4 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/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); |