r218777 - Update CGDebugInfo to the updated API in LLVM.
Adrian Prantl
aprantl at apple.com
Wed Oct 1 10:55:10 PDT 2014
Author: adrian
Date: Wed Oct 1 12:55:09 2014
New Revision: 218777
URL: http://llvm.org/viewvc/llvm-project?rev=218777&view=rev
Log:
Update CGDebugInfo to the updated API in LLVM.
Complex address expressions are no longer part of DIVariable, but
rather an extra argument to the debug intrinsics.
http://reviews.llvm.org/D4919
rdar://problem/17994491
Modified:
cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
cfe/trunk/test/CodeGenCXX/linetable-eh.cpp
cfe/trunk/test/CodeGenObjC/2010-02-09-DbgSelf.m
cfe/trunk/test/CodeGenObjC/debug-info-block-captured-self.m
cfe/trunk/test/CodeGenObjC/debug-info-blocks.m
cfe/trunk/test/CodeGenObjC/debug-info-lifetime-crash.m
cfe/trunk/test/CodeGenObjC/objc-fixed-enum.m
Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=218777&r1=218776&r2=218777&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Wed Oct 1 12:55:09 2014
@@ -2783,27 +2783,26 @@ void CGDebugInfo::EmitDeclare(const VarD
CharUnits offset = CharUnits::fromQuantity(32);
SmallVector<llvm::Value *, 9> addr;
llvm::Type *Int64Ty = CGM.Int64Ty;
- addr.push_back(llvm::ConstantInt::get(Int64Ty, llvm::DIBuilder::OpPlus));
+ addr.push_back(llvm::ConstantInt::get(Int64Ty, llvm::dwarf::DW_OP_plus));
// offset of __forwarding field
offset = CGM.getContext().toCharUnitsFromBits(
CGM.getTarget().getPointerWidth(0));
addr.push_back(llvm::ConstantInt::get(Int64Ty, offset.getQuantity()));
- addr.push_back(llvm::ConstantInt::get(Int64Ty, llvm::DIBuilder::OpDeref));
- addr.push_back(llvm::ConstantInt::get(Int64Ty, llvm::DIBuilder::OpPlus));
+ addr.push_back(llvm::ConstantInt::get(Int64Ty, llvm::dwarf::DW_OP_deref));
+ addr.push_back(llvm::ConstantInt::get(Int64Ty, llvm::dwarf::DW_OP_plus));
// offset of x field
offset = CGM.getContext().toCharUnitsFromBits(XOffset);
addr.push_back(llvm::ConstantInt::get(Int64Ty, offset.getQuantity()));
// Create the descriptor for the variable.
llvm::DIVariable D =
- DBuilder.createComplexVariable(Tag,
- llvm::DIDescriptor(Scope),
- VD->getName(), Unit, Line, Ty,
- addr, ArgNo);
+ DBuilder.createLocalVariable(Tag, llvm::DIDescriptor(Scope),
+ VD->getName(), Unit, Line, Ty, ArgNo);
// Insert an llvm.dbg.declare into the current block.
llvm::Instruction *Call =
- DBuilder.insertDeclare(Storage, D, Builder.GetInsertBlock());
+ DBuilder.insertDeclare(Storage, D, DBuilder.createExpression(addr),
+ Builder.GetInsertBlock());
Call->setDebugLoc(llvm::DebugLoc::get(Line, Column, Scope));
return;
} else if (isa<VariableArrayType>(VD->getType()))
@@ -2830,7 +2829,8 @@ void CGDebugInfo::EmitDeclare(const VarD
// Insert an llvm.dbg.declare into the current block.
llvm::Instruction *Call =
- DBuilder.insertDeclare(Storage, D, Builder.GetInsertBlock());
+ DBuilder.insertDeclare(Storage, D, DBuilder.createExpression(),
+ Builder.GetInsertBlock());
Call->setDebugLoc(llvm::DebugLoc::get(Line, Column, Scope));
}
return;
@@ -2845,7 +2845,8 @@ void CGDebugInfo::EmitDeclare(const VarD
// Insert an llvm.dbg.declare into the current block.
llvm::Instruction *Call =
- DBuilder.insertDeclare(Storage, D, Builder.GetInsertBlock());
+ DBuilder.insertDeclare(Storage, D, DBuilder.createExpression(),
+ Builder.GetInsertBlock());
Call->setDebugLoc(llvm::DebugLoc::get(Line, Column, Scope));
}
@@ -2907,18 +2908,18 @@ void CGDebugInfo::EmitDeclareOfBlockDecl
SmallVector<llvm::Value *, 9> addr;
llvm::Type *Int64Ty = CGM.Int64Ty;
if (isa<llvm::AllocaInst>(Storage))
- addr.push_back(llvm::ConstantInt::get(Int64Ty, llvm::DIBuilder::OpDeref));
- addr.push_back(llvm::ConstantInt::get(Int64Ty, llvm::DIBuilder::OpPlus));
+ addr.push_back(llvm::ConstantInt::get(Int64Ty, llvm::dwarf::DW_OP_deref));
+ addr.push_back(llvm::ConstantInt::get(Int64Ty, llvm::dwarf::DW_OP_plus));
addr.push_back(llvm::ConstantInt::get(Int64Ty, offset.getQuantity()));
if (isByRef) {
- addr.push_back(llvm::ConstantInt::get(Int64Ty, llvm::DIBuilder::OpDeref));
- addr.push_back(llvm::ConstantInt::get(Int64Ty, llvm::DIBuilder::OpPlus));
+ addr.push_back(llvm::ConstantInt::get(Int64Ty, llvm::dwarf::DW_OP_deref));
+ addr.push_back(llvm::ConstantInt::get(Int64Ty, llvm::dwarf::DW_OP_plus));
// offset of __forwarding field
offset = CGM.getContext()
.toCharUnitsFromBits(target.getPointerSizeInBits(0));
addr.push_back(llvm::ConstantInt::get(Int64Ty, offset.getQuantity()));
- addr.push_back(llvm::ConstantInt::get(Int64Ty, llvm::DIBuilder::OpDeref));
- addr.push_back(llvm::ConstantInt::get(Int64Ty, llvm::DIBuilder::OpPlus));
+ addr.push_back(llvm::ConstantInt::get(Int64Ty, llvm::dwarf::DW_OP_deref));
+ addr.push_back(llvm::ConstantInt::get(Int64Ty, llvm::dwarf::DW_OP_plus));
// offset of x field
offset = CGM.getContext().toCharUnitsFromBits(XOffset);
addr.push_back(llvm::ConstantInt::get(Int64Ty, offset.getQuantity()));
@@ -2926,13 +2927,14 @@ void CGDebugInfo::EmitDeclareOfBlockDecl
// Create the descriptor for the variable.
llvm::DIVariable D =
- DBuilder.createComplexVariable(llvm::dwarf::DW_TAG_auto_variable,
- llvm::DIDescriptor(LexicalBlockStack.back()),
- VD->getName(), Unit, Line, Ty, addr);
+ DBuilder.createLocalVariable(llvm::dwarf::DW_TAG_auto_variable,
+ llvm::DIDescriptor(LexicalBlockStack.back()),
+ VD->getName(), Unit, Line, Ty);
// Insert an llvm.dbg.declare into the current block.
llvm::Instruction *Call =
- DBuilder.insertDeclare(Storage, D, Builder.GetInsertPoint());
+ DBuilder.insertDeclare(Storage, D, DBuilder.createExpression(addr),
+ Builder.GetInsertPoint());
Call->setDebugLoc(llvm::DebugLoc::get(Line, Column,
LexicalBlockStack.back()));
}
@@ -3096,13 +3098,15 @@ void CGDebugInfo::EmitDeclareOfBlockLite
// Insert an llvm.dbg.value into the current block.
llvm::Instruction *DbgVal =
DBuilder.insertDbgValueIntrinsic(LocalAddr, 0, debugVar,
+ DBuilder.createExpression(),
Builder.GetInsertBlock());
DbgVal->setDebugLoc(llvm::DebugLoc::get(line, column, scope));
}
// Insert an llvm.dbg.declare into the current block.
llvm::Instruction *DbgDecl =
- DBuilder.insertDeclare(Arg, debugVar, Builder.GetInsertBlock());
+ DBuilder.insertDeclare(Arg, debugVar, DBuilder.createExpression(),
+ Builder.GetInsertBlock());
DbgDecl->setDebugLoc(llvm::DebugLoc::get(line, column, scope));
}
Modified: cfe/trunk/test/CodeGenCXX/linetable-eh.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/linetable-eh.cpp?rev=218777&r1=218776&r2=218777&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/linetable-eh.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/linetable-eh.cpp Wed Oct 1 12:55:09 2014
@@ -4,10 +4,10 @@
// entries for the code that triggered it.
// CHECK: call void @llvm.dbg.declare
-// CHECK: call void @llvm.dbg.declare(metadata !{{{.*}}}, metadata ![[CURRENT_ADDR:.*]]), !dbg ![[DBG1:.*]]
+// CHECK: call void @llvm.dbg.declare(metadata !{{{.*}}}, metadata ![[CURRENT_ADDR:.*]], metadata !{{.*}}), !dbg ![[DBG1:.*]]
// CHECK: unwind label %{{.*}}, !dbg ![[DBG1]]
// CHECK: store i64 %{{.*}}, i64* %current_address, align 8, !dbg ![[DBG4:.*]]
-// CHECK-NEXT: call void @llvm.dbg.declare(metadata !{{{.*}}}, metadata ![[FOUND_IT:.*]]), !dbg ![[DBG2:.*]]
+// CHECK-NEXT: call void @llvm.dbg.declare(metadata !{{{.*}}}, metadata ![[FOUND_IT:.*]], metadata !{{.*}}), !dbg ![[DBG2:.*]]
// CHECK: = landingpad
// CHECK-NEXT: cleanup, !dbg ![[DBG3:.*]]
// CHECK-DAG: ![[CURRENT_ADDR]] = {{.*}} [current_address]
Modified: cfe/trunk/test/CodeGenObjC/2010-02-09-DbgSelf.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/2010-02-09-DbgSelf.m?rev=218777&r1=218776&r2=218777&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenObjC/2010-02-09-DbgSelf.m (original)
+++ cfe/trunk/test/CodeGenObjC/2010-02-09-DbgSelf.m Wed Oct 1 12:55:09 2014
@@ -1,6 +1,6 @@
// RUN: %clang_cc1 -x objective-c -emit-llvm -g < %s | FileCheck %s
// Test to check that "self" argument is assigned a location.
-// CHECK: call void @llvm.dbg.declare(metadata !{%0** %{{[^}]+}}}, metadata [[SELF:![0-9]*]])
+// CHECK: call void @llvm.dbg.declare(metadata !{%0** %{{[^}]+}}}, metadata [[SELF:![0-9]*]], metadata !{{.*}})
// CHECK: [[SELF]] = {{.*}} ; [ DW_TAG_arg_variable ] [self]
@interface Foo
Modified: cfe/trunk/test/CodeGenObjC/debug-info-block-captured-self.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/debug-info-block-captured-self.m?rev=218777&r1=218776&r2=218777&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenObjC/debug-info-block-captured-self.m (original)
+++ cfe/trunk/test/CodeGenObjC/debug-info-block-captured-self.m Wed Oct 1 12:55:09 2014
@@ -55,11 +55,11 @@ typedef enum {
// CHECK-NEXT: %[[MEM2:.*]] = alloca i8*, align 8
// CHECK: store i8* [[BLOCK_DESC:%.*]], i8** %[[MEM1]], align 8
// CHECK: %[[TMP0:.*]] = load i8** %[[MEM1]]
-// CHECK: call void @llvm.dbg.value(metadata !{i8* %[[TMP0]]}, i64 0, metadata ![[BDMD:[0-9]+]])
-// CHECK: call void @llvm.dbg.declare(metadata !{i8* [[BLOCK_DESC]]}, metadata ![[BDMD:[0-9]+]])
+// CHECK: call void @llvm.dbg.value(metadata !{i8* %[[TMP0]]}, i64 0, metadata ![[BDMD:[0-9]+]], metadata !{{.*}})
+// CHECK: call void @llvm.dbg.declare(metadata !{i8* [[BLOCK_DESC]]}, metadata ![[BDMD:[0-9]+]], metadata !{{.*}})
// CHECK: %[[TMP1:.*]] = bitcast
// CHECK-NEXT: store
-// CHECK: call void @llvm.dbg.declare(metadata !{<{ i8*, i32, i32, i8*, %struct.__block_descriptor*, %0* }>** {{.*}}}, metadata ![[SELF:.*]])
+// CHECK: call void @llvm.dbg.declare(metadata !{<{ i8*, i32, i32, i8*, %struct.__block_descriptor*, %0* }>** {{.*}}}, metadata ![[SELF:.*]], metadata !{{.*}})
// make sure we are still in the same function
// CHECK: define {{.*}}__copy_helper_block_
// Metadata
Modified: cfe/trunk/test/CodeGenObjC/debug-info-blocks.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/debug-info-blocks.m?rev=218777&r1=218776&r2=218777&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenObjC/debug-info-blocks.m (original)
+++ cfe/trunk/test/CodeGenObjC/debug-info-blocks.m Wed Oct 1 12:55:09 2014
@@ -7,8 +7,8 @@
// CHECK: define {{.*}}_block_invoke
// CHECK: %[[BLOCK:.*]] = bitcast i8* %.block_descriptor to <{ i8*, i32, i32, i8*, %struct.__block_descriptor*, %0* }>*, !dbg
// CHECK-NEXT: store <{ i8*, i32, i32, i8*, %struct.__block_descriptor*, %0* }>* %[[BLOCK]], <{ i8*, i32, i32, i8*, %struct.__block_descriptor*, %0* }>** %[[ALLOCA:.*]], align
-// CHECK-NEXT: call void @llvm.dbg.declare(metadata !{<{ i8*, i32, i32, i8*, %struct.__block_descriptor*, %0* }>** %[[ALLOCA]]}, metadata ![[SELF:[0-9]+]])
-// CHECK-NEXT: call void @llvm.dbg.declare(metadata !{%1** %d}, metadata ![[D:[0-9]+]])
+// CHECK-NEXT: call void @llvm.dbg.declare(metadata !{<{ i8*, i32, i32, i8*, %struct.__block_descriptor*, %0* }>** %[[ALLOCA]]}, metadata ![[SELF:[0-9]+]], metadata !{{.*}})
+// CHECK-NEXT: call void @llvm.dbg.declare(metadata !{%1** %d}, metadata ![[D:[0-9]+]], metadata !{{.*}})
// rdar://problem/14386148
// Test that we don't emit bogus line numbers for the helper functions.
Modified: cfe/trunk/test/CodeGenObjC/debug-info-lifetime-crash.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/debug-info-lifetime-crash.m?rev=218777&r1=218776&r2=218777&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenObjC/debug-info-lifetime-crash.m (original)
+++ cfe/trunk/test/CodeGenObjC/debug-info-lifetime-crash.m Wed Oct 1 12:55:09 2014
@@ -13,7 +13,7 @@
{
// The debug type for these two will be identical, because we do not
// actually emit the ownership qualifier.
- // CHECK-DAG: metadata !"weakSelf", metadata !{{[0-9]+}}, i32 [[@LINE+1]], metadata ![[SELFTY:[0-9]+]], i32 0, i32 0, {{.*}}} ; [ DW_TAG_auto_variable ] [weakSelf]
+ // CHECK-DAG: metadata !"weakSelf", metadata !{{[0-9]+}}, i32 [[@LINE+1]], metadata ![[SELFTY:[0-9]+]], i32 0, i32 0} ; [ DW_TAG_auto_variable ] [weakSelf]
__attribute__((objc_ownership(weak))) __typeof(self) weakSelf = self;
Block = [^{
// CHECK-DAG: metadata !"strongSelf", metadata !{{[0-9]+}}, i32 [[@LINE+1]], metadata ![[SELFTY]], i32 0, i32 0} ; [ DW_TAG_auto_variable ] [strongSelf]
Modified: cfe/trunk/test/CodeGenObjC/objc-fixed-enum.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/objc-fixed-enum.m?rev=218777&r1=218776&r2=218777&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenObjC/objc-fixed-enum.m (original)
+++ cfe/trunk/test/CodeGenObjC/objc-fixed-enum.m Wed Oct 1 12:55:09 2014
@@ -34,13 +34,13 @@ typedef NSInteger Enum3;
int main() {
Enum0 e0 = Enum0One;
- // CHECK: call void @llvm.dbg.declare(metadata !{{.*}}, metadata ![[ENUM0:[0-9]+]])
+ // CHECK: call void @llvm.dbg.declare(metadata !{{.*}}, metadata ![[ENUM0:[0-9]+]], metadata !{{.*}})
Enum1 e1 = Enum1One;
- // CHECK: call void @llvm.dbg.declare(metadata !{{.*}}, metadata ![[ENUM1:[0-9]+]])
+ // CHECK: call void @llvm.dbg.declare(metadata !{{.*}}, metadata ![[ENUM1:[0-9]+]], metadata !{{.*}})
Enum2 e2 = Enum2One;
- // CHECK: call void @llvm.dbg.declare(metadata !{{.*}}, metadata ![[ENUM2:[0-9]+]])
+ // CHECK: call void @llvm.dbg.declare(metadata !{{.*}}, metadata ![[ENUM2:[0-9]+]], metadata !{{.*}})
Enum3 e3 = Enum3One;
- // CHECK: call void @llvm.dbg.declare(metadata !{{.*}}, metadata ![[ENUM3:[0-9]+]])
+ // CHECK: call void @llvm.dbg.declare(metadata !{{.*}}, metadata ![[ENUM3:[0-9]+]], metadata !{{.*}})
// -Werror and the following line ensures that these enums are not
// -treated as C++11 strongly typed enums.
More information about the cfe-commits
mailing list