r198699 - Debug info: Implement a cleaner version of r198461. For symmetry with
Adrian Prantl
aprantl at apple.com
Tue Jan 7 11:24:25 PST 2014
Author: adrian
Date: Tue Jan 7 13:24:24 2014
New Revision: 198699
URL: http://llvm.org/viewvc/llvm-project?rev=198699&view=rev
Log:
Debug info: Implement a cleaner version of r198461. For symmetry with
C and C++ don't emit an extra lexical scope for the compound statement
that is the body of an Objective-C method.
rdar://problem/15010825
Modified:
cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
cfe/trunk/lib/CodeGen/CGDebugInfo.h
cfe/trunk/lib/CodeGen/CGObjC.cpp
cfe/trunk/lib/CodeGen/CGStmt.cpp
cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
cfe/trunk/lib/CodeGen/CodeGenFunction.h
cfe/trunk/test/CodeGenObjC/arc-linetable-autorelease.m
cfe/trunk/test/CodeGenObjC/arc-linetable.m
Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=198699&r1=198698&r2=198699&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Tue Jan 7 13:24:24 2014
@@ -2537,8 +2537,7 @@ void CGDebugInfo::EmitFunctionStart(Glob
/// information in the source file. If the location is invalid, the
/// previous location will be reused.
void CGDebugInfo::EmitLocation(CGBuilderTy &Builder, SourceLocation Loc,
- bool ForceColumnInfo,
- llvm::MDNode *ForceScope) {
+ bool ForceColumnInfo) {
// Update our current location
setLocation(Loc);
@@ -2557,7 +2556,7 @@ void CGDebugInfo::EmitLocation(CGBuilder
// Update last state.
PrevLoc = CurLoc;
- llvm::MDNode *Scope = ForceScope ? ForceScope : &*LexicalBlockStack.back();
+ llvm::MDNode *Scope = LexicalBlockStack.back();
Builder.SetCurrentDebugLocation(llvm::DebugLoc::get
(getLineNumber(CurLoc),
getColumnNumber(CurLoc, ForceColumnInfo),
Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.h?rev=198699&r1=198698&r2=198699&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.h (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.h Tue Jan 7 13:24:24 2014
@@ -211,17 +211,13 @@ public:
/// getLocation - Return the current source location.
SourceLocation getLocation() const { return CurLoc; }
- /// getScope() - Return the current scope.
- llvm::MDNode *getScope() const { return LexicalBlockStack.back(); }
-
/// EmitLocation - Emit metadata to indicate a change in line/column
/// information in the source file.
/// \param ForceColumnInfo Assume DebugColumnInfo option is true.
/// \param ForceScope Force the location to be in a specific lexical
/// scope rather than the top of LexicalBlockStack.
void EmitLocation(CGBuilderTy &Builder, SourceLocation Loc,
- bool ForceColumnInfo = false,
- llvm::MDNode *ForceScope = 0);
+ bool ForceColumnInfo = false);
/// EmitFunctionStart - Emit a call to llvm.dbg.function.start to indicate
/// start of a new function.
Modified: cfe/trunk/lib/CodeGen/CGObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjC.cpp?rev=198699&r1=198698&r2=198699&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjC.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjC.cpp Tue Jan 7 13:24:24 2014
@@ -506,7 +506,8 @@ static llvm::Value *emitARCRetainLoadOfS
/// its pointer, name, and types registered in the class struture.
void CodeGenFunction::GenerateObjCMethod(const ObjCMethodDecl *OMD) {
StartObjCMethod(OMD, OMD->getClassInterface(), OMD->getLocStart());
- EmitStmt(OMD->getBody());
+ assert(isa<CompoundStmt>(OMD->getBody()));
+ EmitCompoundStmtWithoutScope(*cast<CompoundStmt>(OMD->getBody()));
FinishFunction(OMD->getBodyRBrace());
}
Modified: cfe/trunk/lib/CodeGen/CGStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmt.cpp?rev=198699&r1=198698&r2=198699&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGStmt.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGStmt.cpp Tue Jan 7 13:24:24 2014
@@ -37,7 +37,7 @@ void CodeGenFunction::EmitStopPoint(cons
Loc = S->getLocStart();
DI->EmitLocation(Builder, Loc);
- LastStopPoint = std::make_pair(Loc, DI->getScope());
+ LastStopPoint = Loc;
}
}
Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.cpp?rev=198699&r1=198698&r2=198699&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenFunction.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.cpp Tue Jan 7 13:24:24 2014
@@ -209,10 +209,9 @@ void CodeGenFunction::FinishFunction(Sou
// all will be fine.
if (CGDebugInfo *DI = getDebugInfo()) {
if (OnlySimpleReturnStmts)
- DI->EmitLocation(Builder, LastStopPoint.first,
- false, LastStopPoint.second);
+ DI->EmitLocation(Builder, LastStopPoint, false);
else
- DI->EmitLocation(Builder, EndLoc, false, LastStopPoint.second);
+ DI->EmitLocation(Builder, EndLoc, false);
}
// Pop any cleanups that might have been associated with the
@@ -229,7 +228,7 @@ void CodeGenFunction::FinishFunction(Sou
if (CGDebugInfo *DI = getDebugInfo())
if (OnlySimpleReturnStmts)
- DI->EmitLocation(Builder, EndLoc, false, LastStopPoint.second);
+ DI->EmitLocation(Builder, EndLoc, false);
}
// Emit function epilog (to return).
Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.h?rev=198699&r1=198698&r2=198699&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenFunction.h (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.h Tue Jan 7 13:24:24 2014
@@ -877,7 +877,7 @@ private:
unsigned NumSimpleReturnExprs;
/// The last regular (non-return) debug location (breakpoint) in the function.
- std::pair<SourceLocation, llvm::MDNode*> LastStopPoint;
+ SourceLocation LastStopPoint;
public:
/// A scope within which we are constructing the fields of an object which
Modified: cfe/trunk/test/CodeGenObjC/arc-linetable-autorelease.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/arc-linetable-autorelease.m?rev=198699&r1=198698&r2=198699&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenObjC/arc-linetable-autorelease.m (original)
+++ cfe/trunk/test/CodeGenObjC/arc-linetable-autorelease.m Tue Jan 7 13:24:24 2014
@@ -29,12 +29,11 @@ NSRect NSMakeRect(CGFloat x, CGFloat y,
CGFloat pattern[2];
// CHECK: define {{.*}}_createBezierPathWithWidth
// CHECK: load {{.*}} %path, align {{.*}}, !dbg ![[RET:[0-9]+]]
- // CHECK: call void @objc_storeStrong{{.*}} !dbg ![[ARC1:[0-9]+]]
- // CHECK: call {{.*}} @objc_autoreleaseReturnValue{{.*}} !dbg ![[ARC2:[0-9]+]]
- // CHECK: ret {{.*}} !dbg ![[ARC2]]
+ // CHECK: call void @objc_storeStrong{{.*}} !dbg ![[ARC:[0-9]+]]
+ // CHECK: call {{.*}} @objc_autoreleaseReturnValue{{.*}} !dbg ![[ARC]]
+ // CHECK: ret {{.*}} !dbg ![[ARC]]
// CHECK: ![[RET]] = metadata !{i32 [[@LINE+1]], i32 0, metadata !{{.*}}, null}
return path;
- // CHECK: ![[ARC1]] = metadata !{i32 [[@LINE+2]], i32 0, metadata !{{.*}}, null}
- // CHECK: ![[ARC2]] = metadata !{i32 [[@LINE+1]], i32 0, metadata !{{.*}}, null}
+ // CHECK: ![[ARC]] = metadata !{i32 [[@LINE+1]], i32 0, metadata !{{.*}}, null}
}
@end
Modified: cfe/trunk/test/CodeGenObjC/arc-linetable.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/arc-linetable.m?rev=198699&r1=198698&r2=198699&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenObjC/arc-linetable.m (original)
+++ cfe/trunk/test/CodeGenObjC/arc-linetable.m Tue Jan 7 13:24:24 2014
@@ -49,9 +49,8 @@
// CHECK: ![[TESTNOSIDEEFFECT:.*]] = {{.*}}[ DW_TAG_subprogram ] [line [[@LINE+1]]] [local] [def] [-[AppDelegate testNoSideEffect:]]
- (int)testNoSideEffect:(NSString *)foo {
- // CHECK: ![[COMPOUND_STMT:.*]] = metadata !{i32 786443, metadata !{{.*}}, metadata ![[TESTNOSIDEEFFECT]], i32 [[@LINE-1]], i32 0, i32 0} ; [ DW_TAG_lexical_block ]
int x = 1;
- // CHECK: ![[ARC1]] = metadata !{i32 [[@LINE+1]], i32 0, metadata ![[COMPOUND_STMT]], null}
+ // CHECK: ![[ARC1]] = metadata !{i32 [[@LINE+1]], i32 0, metadata ![[TESTNOSIDEEFFECT]], null}
return 1; // Return expression
// CHECK: ![[RET1]] = metadata !{i32 [[@LINE+1]], i32 0, metadata !{{.*}}, null}
} // Cleanup + Ret
More information about the cfe-commits
mailing list