forked from OSchip/llvm-project
DebugInfo: Do not include line/file info for artificial parameters & parameters of artificial functions
llvm-svn: 188651
This commit is contained in:
parent
175b0b9a3b
commit
7fceebf5aa
|
@ -1063,8 +1063,12 @@ CGDebugInfo::CreateCXXMemberFunction(const CXXMethodDecl *Method,
|
||||||
MethodLinkageName = CGM.getMangledName(Method);
|
MethodLinkageName = CGM.getMangledName(Method);
|
||||||
|
|
||||||
// Get the location for the method.
|
// Get the location for the method.
|
||||||
llvm::DIFile MethodDefUnit = getOrCreateFile(Method->getLocation());
|
llvm::DIFile MethodDefUnit;
|
||||||
unsigned MethodLine = getLineNumber(Method->getLocation());
|
unsigned MethodLine = 0;
|
||||||
|
if (!Method->isImplicit()) {
|
||||||
|
MethodDefUnit = getOrCreateFile(Method->getLocation());
|
||||||
|
MethodLine = getLineNumber(Method->getLocation());
|
||||||
|
}
|
||||||
|
|
||||||
// Collect virtual method info.
|
// Collect virtual method info.
|
||||||
llvm::DIType ContainingType;
|
llvm::DIType ContainingType;
|
||||||
|
@ -2685,7 +2689,12 @@ void CGDebugInfo::EmitDeclare(const VarDecl *VD, unsigned Tag,
|
||||||
assert(DebugKind >= CodeGenOptions::LimitedDebugInfo);
|
assert(DebugKind >= CodeGenOptions::LimitedDebugInfo);
|
||||||
assert(!LexicalBlockStack.empty() && "Region stack mismatch, stack empty!");
|
assert(!LexicalBlockStack.empty() && "Region stack mismatch, stack empty!");
|
||||||
|
|
||||||
llvm::DIFile Unit = getOrCreateFile(VD->getLocation());
|
bool Unwritten =
|
||||||
|
VD->isImplicit() || (isa<Decl>(VD->getDeclContext()) &&
|
||||||
|
cast<Decl>(VD->getDeclContext())->isImplicit());
|
||||||
|
llvm::DIFile Unit;
|
||||||
|
if (!Unwritten)
|
||||||
|
Unit = getOrCreateFile(VD->getLocation());
|
||||||
llvm::DIType Ty;
|
llvm::DIType Ty;
|
||||||
uint64_t XOffset = 0;
|
uint64_t XOffset = 0;
|
||||||
if (VD->hasAttr<BlocksAttr>())
|
if (VD->hasAttr<BlocksAttr>())
|
||||||
|
@ -2699,8 +2708,12 @@ void CGDebugInfo::EmitDeclare(const VarDecl *VD, unsigned Tag,
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Get location information.
|
// Get location information.
|
||||||
unsigned Line = getLineNumber(VD->getLocation());
|
unsigned Line = 0;
|
||||||
unsigned Column = getColumnNumber(VD->getLocation());
|
unsigned Column = 0;
|
||||||
|
if (!Unwritten) {
|
||||||
|
Line = getLineNumber(VD->getLocation());
|
||||||
|
Column = getColumnNumber(VD->getLocation());
|
||||||
|
}
|
||||||
unsigned Flags = 0;
|
unsigned Flags = 0;
|
||||||
if (VD->isImplicit())
|
if (VD->isImplicit())
|
||||||
Flags |= llvm::DIDescriptor::FlagArtificial;
|
Flags |= llvm::DIDescriptor::FlagArtificial;
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
// RUN: %clang_cc1 -x objective-c -emit-llvm -g < %s | grep "\"self\", metadata"
|
// RUN: %clang_cc1 -x objective-c -emit-llvm -g < %s | FileCheck %s
|
||||||
// Test to check that "self" argument is assigned a location.
|
// Test to check that "self" argument is assigned a location.
|
||||||
|
// CHECK: call void @llvm.dbg.declare(metadata !{%0** %self.addr}, metadata [[SELF:![0-9]*]])
|
||||||
|
// CHECK: [[SELF]] = {{.*}} ; [ DW_TAG_arg_variable ] [self]
|
||||||
|
|
||||||
@interface Foo
|
@interface Foo
|
||||||
-(void) Bar: (int)x ;
|
-(void) Bar: (int)x ;
|
||||||
|
|
|
@ -36,6 +36,6 @@ int main()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Verify that the debug type for both variables is 'id'.
|
// Verify that the debug type for both variables is 'id'.
|
||||||
// CHECK: metadata !{i32 {{[0-9]+}}, metadata !{{[0-9]+}}, metadata !"bad_carrier", metadata !{{[0-9]+}}, i32 {{[0-9]+}}, metadata ![[IDTYPE:[0-9]+]], i32 0, i32 0} ; [ DW_TAG_arg_variable ] [bad_carrier] [line 21]
|
// CHECK: metadata !{i32 {{[0-9]+}}, metadata !{{[0-9]+}}, metadata !"bad_carrier", null, i32 {{[0-9]+}}, metadata ![[IDTYPE:[0-9]+]], i32 0, i32 0} ; [ DW_TAG_arg_variable ] [bad_carrier] [line 0]
|
||||||
// CHECK: metadata !{i32 {{[0-9]+}}, metadata !{{[0-9]+}}, metadata !"good_carrier", metadata !{{[0-9]+}}, i32 {{[0-9]+}}, metadata !{{.*}}[[IDTYPE]], i32 0, i32 0} ; [ DW_TAG_arg_variable ] [good_carrier] [line 22]
|
// CHECK: metadata !{i32 {{[0-9]+}}, metadata !{{[0-9]+}}, metadata !"good_carrier", null, i32 {{[0-9]+}}, metadata !{{.*}}[[IDTYPE]], i32 0, i32 0} ; [ DW_TAG_arg_variable ] [good_carrier] [line 0]
|
||||||
// CHECK !{{.*}}[[IDTYPE]] = metadata !{i32 {{[0-9]+}}, null, metadata !"id", metadata !{{[0-9]+}}, i32 !{{[0-9]+}}, i64 0, i64 0, i64 0, i32 0, metadata !{{[0-9]+}}} ; [ DW_TAG_typedef ] [id]
|
// CHECK !{{.*}}[[IDTYPE]] = metadata !{i32 {{[0-9]+}}, null, metadata !"id", metadata !{{[0-9]+}}, i32 !{{[0-9]+}}, i64 0, i64 0, i64 0, i32 0, metadata !{{[0-9]+}}} ; [ DW_TAG_typedef ] [id]
|
||||||
|
|
|
@ -14,10 +14,6 @@
|
||||||
}
|
}
|
||||||
@end
|
@end
|
||||||
|
|
||||||
// It's weird that the first two parameters are recorded as being in a
|
// CHECK: metadata !{i32 {{.*}}, metadata ![[CTOR:.*]], metadata !"self", null, i32 16777216, metadata !{{.*}}, i32 1088, i32 0} ; [ DW_TAG_arg_variable ] [self] [line 0]
|
||||||
// different, ("<unknown>") file compared to the third parameter which is 'in'
|
// CHECK: metadata !{i32 {{.*}}, metadata ![[CTOR]], metadata !"_cmd", null, i32 33554432, metadata !{{.*}}, i32 64, i32 0} ; [ DW_TAG_arg_variable ] [_cmd] [line 0]
|
||||||
// the actual source file. (see the metadata node after the arg name in each
|
|
||||||
// line)
|
|
||||||
// CHECK: metadata !{i32 {{.*}}, metadata ![[CTOR:.*]], metadata !"self", metadata ![[UNKFILE:.*]], i32 16777227, metadata !{{.*}}, i32 1088, i32 0} ; [ DW_TAG_arg_variable ] [self] [line 11]
|
|
||||||
// CHECK: metadata !{i32 {{.*}}, metadata ![[CTOR]], metadata !"_cmd", metadata ![[UNKFILE]], i32 33554443, metadata !{{.*}}, i32 64, i32 0} ; [ DW_TAG_arg_variable ] [_cmd] [line 11]
|
|
||||||
// CHECK: metadata !{i32 {{.*}}, metadata ![[CTOR]], metadata !"myarg", metadata !{{.*}}, i32 50331659, metadata !{{.*}}, i32 0, i32 0} ; [ DW_TAG_arg_variable ] [myarg] [line 11]
|
// CHECK: metadata !{i32 {{.*}}, metadata ![[CTOR]], metadata !"myarg", metadata !{{.*}}, i32 50331659, metadata !{{.*}}, i32 0, i32 0} ; [ DW_TAG_arg_variable ] [myarg] [line 11]
|
||||||
|
|
Loading…
Reference in New Issue