From: Eric Christopher Date: Fri, 30 Mar 2012 05:42:12 +0000 (+0000) Subject: Revert previous commit changing location information to see if this X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=96579c43e777b9dea81dc56c8074b3755df00e27;p=clang Revert previous commit changing location information to see if this is causing the gdb test failures on the bots. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153727 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp index 780993ac92..af55a86a59 100644 --- a/lib/CodeGen/CGDebugInfo.cpp +++ b/lib/CodeGen/CGDebugInfo.cpp @@ -1969,11 +1969,9 @@ void CGDebugInfo::EmitFunctionStart(GlobalDecl GD, QualType FnType, FnBeginRegionCount.push_back(LexicalBlockStack.size()); const Decl *D = GD.getDecl(); - // Use the location of the declaration. - SourceLocation Loc = D->getLocation(); unsigned Flags = 0; - llvm::DIFile Unit = getOrCreateFile(Loc); + llvm::DIFile Unit = getOrCreateFile(CurLoc); llvm::DIDescriptor FDContext(Unit); llvm::DIArray TParamsArray; if (const FunctionDecl *FD = dyn_cast(D)) { @@ -2017,7 +2015,10 @@ void CGDebugInfo::EmitFunctionStart(GlobalDecl GD, QualType FnType, if (!Name.empty() && Name[0] == '\01') Name = Name.substr(1); - unsigned LineNo = getLineNumber(Loc); + // It is expected that CurLoc is set before using EmitFunctionStart. + // Usually, CurLoc points to the left bracket location of compound + // statement representing function body. + unsigned LineNo = getLineNumber(CurLoc); if (D->isImplicit()) Flags |= llvm::DIDescriptor::FlagArtificial; llvm::DISubprogram SPDecl = getFunctionDeclaration(D); diff --git a/lib/CodeGen/CGObjC.cpp b/lib/CodeGen/CGObjC.cpp index b3460aef2d..b4fc6e0ffa 100644 --- a/lib/CodeGen/CGObjC.cpp +++ b/lib/CodeGen/CGObjC.cpp @@ -708,7 +708,7 @@ void CodeGenFunction::GenerateObjCGetter(ObjCImplementationDecl *IMP, const ObjCPropertyDecl *PD = PID->getPropertyDecl(); ObjCMethodDecl *OMD = PD->getGetterMethodDecl(); assert(OMD && "Invalid call to generate getter (empty method)"); - StartObjCMethod(OMD, IMP->getClassInterface(), OMD->getLocStart()); + StartObjCMethod(OMD, IMP->getClassInterface(), PID->getLocStart()); generateObjCGetterBody(IMP, PID, AtomicHelperFn); @@ -1216,7 +1216,7 @@ void CodeGenFunction::GenerateObjCSetter(ObjCImplementationDecl *IMP, const ObjCPropertyDecl *PD = PID->getPropertyDecl(); ObjCMethodDecl *OMD = PD->getSetterMethodDecl(); assert(OMD && "Invalid call to generate setter (empty method)"); - StartObjCMethod(OMD, IMP->getClassInterface(), OMD->getLocStart()); + StartObjCMethod(OMD, IMP->getClassInterface(), PID->getLocStart()); generateObjCSetterBody(IMP, PID, AtomicHelperFn); diff --git a/test/CodeGenObjC/debug-info-block-helper.m b/test/CodeGenObjC/debug-info-block-helper.m index ff49e5fc61..8f88eb58a8 100644 --- a/test/CodeGenObjC/debug-info-block-helper.m +++ b/test/CodeGenObjC/debug-info-block-helper.m @@ -2,7 +2,7 @@ // RUN: %clang_cc1 -emit-llvm -fblocks -g -triple x86_64-apple-darwin10 -fobjc-fragile-abi %s -o - | FileCheck %s extern void foo(void(^)(void)); -// CHECK: !40 = metadata !{i32 {{.*}}, i32 0, metadata !25, metadata !"__destroy_helper_block_", metadata !"__destroy_helper_block_", metadata !"", metadata !25, i32 24, metadata !41, i1 true, i1 true, i32 0, i32 0, null, i32 256, i1 false, void (i8*)* @__destroy_helper_block_, null, null, metadata !43} ; [ DW_TAG_subprogram ] +// CHECK: !40 = metadata !{i32 {{.*}}, i32 0, metadata !10, metadata !"__destroy_helper_block_", metadata !"__destroy_helper_block_", metadata !"", metadata !10, i32 24, metadata !41, i1 true, i1 true, i32 0, i32 0, null, i32 256, i1 false, void (i8*)* @__destroy_helper_block_, null, null, metadata !43} ; [ DW_TAG_subprogram ] @interface NSObject { struct objc_object *isa; diff --git a/test/CodeGenObjC/debug-info-synthesis.m b/test/CodeGenObjC/debug-info-synthesis.m deleted file mode 100644 index fdaeae7cc8..0000000000 --- a/test/CodeGenObjC/debug-info-synthesis.m +++ /dev/null @@ -1,34 +0,0 @@ -// RUN: %clang_cc1 -emit-llvm -g -w -triple x86_64-apple-darwin10 %s -o - | FileCheck %s -# 1 "foo.m" 1 -# 1 "foo.m" 2 -# 1 "./foo.h" 1 -@interface NSObject { - struct objc_object *isa; -} -@end -@class NSDictionary; - -@interface Foo : NSObject {} -@property (strong, nonatomic) NSDictionary *dict; -@end -# 2 "foo.m" 2 - - - - -@implementation Foo -@synthesize dict = _dict; - -- (void) bork { -} -@end - -int main(int argc, char *argv[]) { - @autoreleasepool { - Foo *f = [Foo new]; - [f bork]; - } -} - -// CHECK: !11 = metadata !{i32 {{.*}}, metadata !"./foo.h" -// CHECK: !29 = metadata !{i32 {{.*}}, i32 0, metadata !11, metadata !"-[Foo dict]", metadata !"-[Foo dict]", metadata !"", metadata !11, i32 8, metadata !30, i1 true, i1 true, i32 0, i32 0, null, i32 320, i1 false, %1* (%0*, i8*)* @"\01-[Foo dict]", null, null, metadata !32} ; [ DW_TAG_subprogram ] diff --git a/test/CodeGenObjC/debug-property-synth.m b/test/CodeGenObjC/debug-property-synth.m index 954620a635..05852b7e29 100644 --- a/test/CodeGenObjC/debug-property-synth.m +++ b/test/CodeGenObjC/debug-property-synth.m @@ -16,5 +16,4 @@ int main() { return 0; } -// FIXME: Make this test ir files. -// CHECK: .loc 2 6 0 +// CHECK: .loc 2 10 0