Local static variables must be available module-wise

as they are accessible in static methods in a class
local to the same function. Fixes PR6769.

llvm-svn: 101756
This commit is contained in:
Fariborz Jahanian
2010-04-18 21:01:23 +00:00
parent 7b056bfed0
commit 3fef72f0ba
5 changed files with 39 additions and 0 deletions

View File

@@ -133,6 +133,7 @@ class CodeGenModule : public BlockModule {
llvm::StringMap<llvm::Constant*> CFConstantStringMap;
llvm::StringMap<llvm::Constant*> ConstantStringMap;
llvm::DenseMap<const Decl*, llvm::Value*> StaticLocalDeclMap;
/// CXXGlobalInits - Global variables with initializers that need to run
/// before main.
@@ -170,6 +171,14 @@ public:
/// been configured.
bool hasObjCRuntime() { return !!Runtime; }
llvm::Value *getStaticLocalDeclMap(const VarDecl *VD) {
return StaticLocalDeclMap[VD];
}
void setStaticLocalDeclMap(const VarDecl *D,
llvm::GlobalVariable *GV) {
StaticLocalDeclMap[D] = GV;
}
CGDebugInfo *getDebugInfo() { return DebugInfo; }
ASTContext &getContext() const { return Context; }
const CodeGenOptions &getCodeGenOpts() const { return CodeGenOpts; }