[cfe-commits] r46800 - /cfe/trunk/CodeGen/CGDecl.cpp

Chris Lattner sabre at nondot.org
Tue Feb 5 20:54:33 PST 2008


Author: lattner
Date: Tue Feb  5 22:54:32 2008
New Revision: 46800

URL: http://llvm.org/viewvc/llvm-project?rev=46800&view=rev
Log:
codegen static variables in a function into a different namespace from
static variables outside functions.

Modified:
    cfe/trunk/CodeGen/CGDecl.cpp

Modified: cfe/trunk/CodeGen/CGDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/CodeGen/CGDecl.cpp?rev=46800&r1=46799&r2=46800&view=diff

==============================================================================
--- cfe/trunk/CodeGen/CGDecl.cpp (original)
+++ cfe/trunk/CodeGen/CGDecl.cpp Tue Feb  5 22:54:32 2008
@@ -81,10 +81,17 @@
 
   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());
   
 }





More information about the cfe-commits mailing list