diff options
author | Adrian Prantl <aprantl@apple.com> | 2014-01-07 19:24:24 +0000 |
---|---|---|
committer | Adrian Prantl <aprantl@apple.com> | 2014-01-07 19:24:24 +0000 |
commit | f5ff0dc29b3129c26c06682f06a871d37090b6bd (patch) | |
tree | a8e05c6888fbf44fd0e7b4aa7ea937888305319e /clang/lib | |
parent | 70d4ba7f19a920087c1201a68a997f54bb878894 (diff) | |
download | bcm5719-llvm-f5ff0dc29b3129c26c06682f06a871d37090b6bd.tar.gz bcm5719-llvm-f5ff0dc29b3129c26c06682f06a871d37090b6bd.zip |
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
llvm-svn: 198699
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/CodeGen/CGDebugInfo.cpp | 5 | ||||
-rw-r--r-- | clang/lib/CodeGen/CGDebugInfo.h | 6 | ||||
-rw-r--r-- | clang/lib/CodeGen/CGObjC.cpp | 3 | ||||
-rw-r--r-- | clang/lib/CodeGen/CGStmt.cpp | 2 | ||||
-rw-r--r-- | clang/lib/CodeGen/CodeGenFunction.cpp | 7 | ||||
-rw-r--r-- | clang/lib/CodeGen/CodeGenFunction.h | 2 |
6 files changed, 10 insertions, 15 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index 3138d82fb8b..2977ed22230 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -2537,8 +2537,7 @@ void CGDebugInfo::EmitFunctionStart(GlobalDecl GD, QualType FnType, /// 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(CGBuilderTy &Builder, SourceLocation Loc, // 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), diff --git a/clang/lib/CodeGen/CGDebugInfo.h b/clang/lib/CodeGen/CGDebugInfo.h index ac31bdf3f58..b38b9c338c9 100644 --- a/clang/lib/CodeGen/CGDebugInfo.h +++ b/clang/lib/CodeGen/CGDebugInfo.h @@ -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. diff --git a/clang/lib/CodeGen/CGObjC.cpp b/clang/lib/CodeGen/CGObjC.cpp index 058ce5686a3..aa990143ac2 100644 --- a/clang/lib/CodeGen/CGObjC.cpp +++ b/clang/lib/CodeGen/CGObjC.cpp @@ -506,7 +506,8 @@ static llvm::Value *emitARCRetainLoadOfScalar(CodeGenFunction &CGF, /// 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()); } diff --git a/clang/lib/CodeGen/CGStmt.cpp b/clang/lib/CodeGen/CGStmt.cpp index 50882c8536b..b18ff09015a 100644 --- a/clang/lib/CodeGen/CGStmt.cpp +++ b/clang/lib/CodeGen/CGStmt.cpp @@ -37,7 +37,7 @@ void CodeGenFunction::EmitStopPoint(const Stmt *S) { Loc = S->getLocStart(); DI->EmitLocation(Builder, Loc); - LastStopPoint = std::make_pair(Loc, DI->getScope()); + LastStopPoint = Loc; } } diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp index fb668e4a168..04c60f61f88 100644 --- a/clang/lib/CodeGen/CodeGenFunction.cpp +++ b/clang/lib/CodeGen/CodeGenFunction.cpp @@ -209,10 +209,9 @@ void CodeGenFunction::FinishFunction(SourceLocation EndLoc) { // 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(SourceLocation EndLoc) { if (CGDebugInfo *DI = getDebugInfo()) if (OnlySimpleReturnStmts) - DI->EmitLocation(Builder, EndLoc, false, LastStopPoint.second); + DI->EmitLocation(Builder, EndLoc, false); } // Emit function epilog (to return). diff --git a/clang/lib/CodeGen/CodeGenFunction.h b/clang/lib/CodeGen/CodeGenFunction.h index c11f2c91729..37bbcf3f342 100644 --- a/clang/lib/CodeGen/CodeGenFunction.h +++ b/clang/lib/CodeGen/CodeGenFunction.h @@ -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 |