]> granicus.if.org Git - clang/commitdiff
codegen static variables in a function into a different namespace from
authorChris Lattner <sabre@nondot.org>
Wed, 6 Feb 2008 04:54:32 +0000 (04:54 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 6 Feb 2008 04:54:32 +0000 (04:54 +0000)
static variables outside functions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46800 91177308-0d34-0410-b5e6-96231b3b80d8

CodeGen/CGDecl.cpp

index a6c5da7c2622311f372e400fc92a26abe7c8a07f..b6f9c7cbd6e512cbd631ac3267872809f7cd46a2 100644 (file)
@@ -81,10 +81,17 @@ void CodeGenFunction::EmitStaticBlockVarDecl(const BlockVarDecl &D) {
 
   assert(Init && "Unable to create initialiser for static decl");
   
+  std::string ContextName;
+  if (CurFuncDecl)
+    ContextName = CurFuncDecl->getName();
+  else
+    assert(0 && "Unknown context for block var decl"); // FIXME Handle objc.
+  
   DMEntry = 
     new llvm::GlobalVariable(LTy, false, 
                             llvm::GlobalValue::InternalLinkage,
-                             Init, D.getName(), &CGM.getModule(), 0,
+                             Init, ContextName + "." + D.getName(),
+                             &CGM.getModule(), 0,
                              Ty.getAddressSpace());
   
 }