diff options
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/CodeGen/CGDecl.cpp | 1 | ||||
| -rw-r--r-- | clang/lib/CodeGen/CGExpr.cpp | 2 | ||||
| -rw-r--r-- | clang/lib/CodeGen/CodeGenModule.h | 9 | 
3 files changed, 12 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGDecl.cpp b/clang/lib/CodeGen/CGDecl.cpp index 07d219f1fbf..58b90929f04 100644 --- a/clang/lib/CodeGen/CGDecl.cpp +++ b/clang/lib/CodeGen/CGDecl.cpp @@ -205,6 +205,7 @@ void CodeGenFunction::EmitStaticBlockVarDecl(const VarDecl &D,    // Store into LocalDeclMap before generating initializer to handle    // circular references.    DMEntry = GV; +  CGM.setStaticLocalDeclMap(&D, GV);    // Make sure to evaluate VLA bounds now so that we have them for later.    // diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp index 68f09e2d290..257f2fc4f2f 100644 --- a/clang/lib/CodeGen/CGExpr.cpp +++ b/clang/lib/CodeGen/CGExpr.cpp @@ -1106,6 +1106,8 @@ LValue CodeGenFunction::EmitDeclRefLValue(const DeclRefExpr *E) {      bool NonGCable = VD->hasLocalStorage() && !VD->hasAttr<BlocksAttr>();      llvm::Value *V = LocalDeclMap[VD]; +    if (!V && VD->isStaticLocal())  +      V = CGM.getStaticLocalDeclMap(VD);      assert(V && "DeclRefExpr not entered in LocalDeclMap?");      Qualifiers Quals = MakeQualifiers(E->getType()); diff --git a/clang/lib/CodeGen/CodeGenModule.h b/clang/lib/CodeGen/CodeGenModule.h index 8db5a588d07..022360bfc52 100644 --- a/clang/lib/CodeGen/CodeGenModule.h +++ b/clang/lib/CodeGen/CodeGenModule.h @@ -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; }  | 

