summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2009-11-13 02:27:33 +0000
committerDevang Patel <dpatel@apple.com>2009-11-13 02:27:33 +0000
commit3ddf70442f0653bf082bfffc03a03745f76b15e2 (patch)
tree5b7c358840a20649c624a5245df14feb22bbe35c
parent3fb6bd690a5919ec78777508e184e3538b6d51b0 (diff)
downloadllvm-3ddf70442f0653bf082bfffc03a03745f76b15e2.tar.gz
llvm-3ddf70442f0653bf082bfffc03a03745f76b15e2.tar.bz2
llvm-3ddf70442f0653bf082bfffc03a03745f76b15e2.tar.xz
Revert r87059 for now. It is failing clang tests.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@87070 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/Analysis/DebugInfo.h1
-rw-r--r--lib/Analysis/DebugInfo.cpp14
2 files changed, 12 insertions, 3 deletions
diff --git a/include/llvm/Analysis/DebugInfo.h b/include/llvm/Analysis/DebugInfo.h
index f741416f26..b10a545b0a 100644
--- a/include/llvm/Analysis/DebugInfo.h
+++ b/include/llvm/Analysis/DebugInfo.h
@@ -467,6 +467,7 @@ namespace llvm {
LLVMContext& VMContext;
// Cached values for uniquing and faster lookups.
+ const Type *EmptyStructPtr; // "{}*".
Function *StopPointFn; // llvm.dbg.stoppoint
Function *FuncStartFn; // llvm.dbg.func.start
Function *RegionStartFn; // llvm.dbg.region.start
diff --git a/lib/Analysis/DebugInfo.cpp b/lib/Analysis/DebugInfo.cpp
index 047837c2fb..1b58b5ed57 100644
--- a/lib/Analysis/DebugInfo.cpp
+++ b/lib/Analysis/DebugInfo.cpp
@@ -608,7 +608,9 @@ void DIVariable::dump() const {
DIFactory::DIFactory(Module &m)
: M(m), VMContext(M.getContext()), StopPointFn(0), FuncStartFn(0),
RegionStartFn(0), RegionEndFn(0),
- DeclareFn(0) {}
+ DeclareFn(0) {
+ EmptyStructPtr = PointerType::getUnqual(StructType::get(VMContext));
+}
Constant *DIFactory::GetTagConstant(unsigned TAG) {
assert((TAG & LLVMDebugVersionMask) == 0 &&
@@ -1035,7 +1037,10 @@ void DIFactory::InsertRegionEnd(DIDescriptor D, BasicBlock *BB) {
/// InsertDeclare - Insert a new llvm.dbg.declare intrinsic call.
Instruction *DIFactory::InsertDeclare(Value *Storage, DIVariable D,
- Instruction *InsertBefore) {
+ Instruction *InsertBefore) {
+ // Cast the storage to a {}* for the call to llvm.dbg.declare.
+ Storage = new BitCastInst(Storage, EmptyStructPtr, "", InsertBefore);
+
if (!DeclareFn)
DeclareFn = Intrinsic::getDeclaration(&M, Intrinsic::dbg_declare);
@@ -1045,7 +1050,10 @@ Instruction *DIFactory::InsertDeclare(Value *Storage, DIVariable D,
/// InsertDeclare - Insert a new llvm.dbg.declare intrinsic call.
Instruction *DIFactory::InsertDeclare(Value *Storage, DIVariable D,
- BasicBlock *InsertAtEnd) {
+ BasicBlock *InsertAtEnd) {
+ // Cast the storage to a {}* for the call to llvm.dbg.declare.
+ Storage = new BitCastInst(Storage, EmptyStructPtr, "", InsertAtEnd);
+
if (!DeclareFn)
DeclareFn = Intrinsic::getDeclaration(&M, Intrinsic::dbg_declare);