aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-02-06 04:54:32 +0000
committerChris Lattner <sabre@nondot.org>2008-02-06 04:54:32 +0000
commit352ffde2f04183083fc00427df81d1b25f8c750c (patch)
tree46c6e03736004eb09ea3a2698d37109151f252ce
parent4e92acf3b747b994e50fbf7bfe8ef71cdda20c50 (diff)
codegen static variables in a function into a different namespace from
static variables outside functions. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46800 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--CodeGen/CGDecl.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/CodeGen/CGDecl.cpp b/CodeGen/CGDecl.cpp
index a6c5da7c26..b6f9c7cbd6 100644
--- a/CodeGen/CGDecl.cpp
+++ b/CodeGen/CGDecl.cpp
@@ -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());
}