summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CodeGenModule.h
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2008-07-30 16:32:24 +0000
committerDaniel Dunbar <daniel@zuster.org>2008-07-30 16:32:24 +0000
commite49df9b58fa98543c487e016a3d7771647b54ff4 (patch)
tree1d477a5d3a44c92044836b23146c7b7bb020862a /clang/lib/CodeGen/CodeGenModule.h
parentbe31571ca5f520e20d2f08165be3545a1c811a8d (diff)
downloadbcm5719-llvm-e49df9b58fa98543c487e016a3d7771647b54ff4.tar.gz
bcm5719-llvm-e49df9b58fa98543c487e016a3d7771647b54ff4.zip
Change CodeGenModule GlobalDeclMap to directly reference globals
instead of mapping the decl to a bitcast of the global to the correct type. - GetAddrOf{Function,GlobalVar} introduce the bitcast on every use now. - This solves a problem where a dangling pointer could be introduced by the RAUW done when replacing a forward or tentative definition. See testcase for more details. - Fixes <rdar://problem/6108358> llvm-svn: 54211
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.h')
-rw-r--r--clang/lib/CodeGen/CodeGenModule.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.h b/clang/lib/CodeGen/CodeGenModule.h
index 57363cddee0..3a39eb3f79d 100644
--- a/clang/lib/CodeGen/CodeGenModule.h
+++ b/clang/lib/CodeGen/CodeGenModule.h
@@ -66,7 +66,12 @@ class CodeGenModule {
llvm::Function *MemCpyFn;
llvm::Function *MemMoveFn;
llvm::Function *MemSetFn;
- llvm::DenseMap<const Decl*, llvm::Constant*> GlobalDeclMap;
+
+ /// GlobalDeclMap - Mapping of decls to global variables we have
+ /// already emitted. Note that the entries in this map are the
+ /// actual global and therefore may not be of the same type as the
+ /// decl, they should be bitcasted on retrieval.
+ llvm::DenseMap<const Decl*, llvm::GlobalValue*> GlobalDeclMap;
/// List of static global for which code generation is delayed. When
/// the translation unit has been fully processed we will lazily
@@ -155,7 +160,7 @@ private:
/// ReplaceMapValuesWith - This is a really slow and bad function that
/// searches for any entries in GlobalDeclMap that point to OldVal, changing
/// them to point to NewVal. This is badbadbad, FIXME!
- void ReplaceMapValuesWith(llvm::Constant *OldVal, llvm::Constant *NewVal);
+ void ReplaceMapValuesWith(llvm::GlobalValue *OldVal, llvm::GlobalValue *NewVal);
void SetFunctionAttributes(const FunctionDecl *FD,
llvm::Function *F,
OpenPOWER on IntegriCloud