<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Feb 3, 2015, at 11:09 AM, David Blaikie <<a href="mailto:dblaikie@gmail.com" class="">dblaikie@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><br class=""><div class="gmail_extra"><br class=""><div class="gmail_quote">On Tue, Feb 3, 2015 at 10:40 AM, Adrian Prantl <span dir="ltr" class=""><<a href="mailto:aprantl@apple.com" target="_blank" class="">aprantl@apple.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: adrian<br class="">
Date: Tue Feb  3 12:40:42 2015<br class="">
New Revision: 228003<br class="">
<br class="">
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=228003&view=rev" target="_blank" class="">http://llvm.org/viewvc/llvm-project?rev=228003&view=rev</a><br class="">
Log:<br class="">
Merge ArtificialLocation into ApplyDebugLocation and make a clear<br class="">
distinction between the different use-cases. With the previous default<br class="">
behavior we would occasionally emit empty debug locations in situations<br class="">
where they actually were strictly required (= on invoke insns).<br class="">
We now have a choice between defaulting to an empty location or an<br class="">
artificial location.<br class="">
<br class="">
Specifically, this fixes a bug caused by a missing debug location when<br class="">
emitting C++ EH cleanup blocks from within an artificial function, such as<br class="">
an ObjC destroy helper function.<br class="">
<br class="">
<a href="rdar://problem/19670595" class="">rdar://problem/19670595</a><br class="">
<br class="">
Added:<br class="">
    cfe/trunk/test/CodeGenObjCXX/<a href="http://nested-ehlocation.mm/" target="_blank" class="">nested-ehlocation.mm</a><br class="">
Modified:<br class="">
    cfe/trunk/lib/CodeGen/CGBlocks.cpp<br class="">
    cfe/trunk/lib/CodeGen/CGCleanup.cpp<br class="">
    cfe/trunk/lib/CodeGen/CGDebugInfo.cpp<br class="">
    cfe/trunk/lib/CodeGen/CGDebugInfo.h<br class="">
    cfe/trunk/lib/CodeGen/CGDecl.cpp<br class="">
    cfe/trunk/lib/CodeGen/CGDeclCXX.cpp<br class="">
    cfe/trunk/lib/CodeGen/CGException.cpp<br class="">
    cfe/trunk/lib/CodeGen/CGExprScalar.cpp<br class="">
    cfe/trunk/lib/CodeGen/CGStmt.cpp<br class="">
    cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp<br class="">
<br class="">
Modified: cfe/trunk/lib/CodeGen/CGBlocks.cpp<br class="">
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBlocks.cpp?rev=228003&r1=228002&r2=228003&view=diff" target="_blank" class="">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBlocks.cpp?rev=228003&r1=228002&r2=228003&view=diff</a><br class="">
==============================================================================<br class="">
--- cfe/trunk/lib/CodeGen/CGBlocks.cpp (original)<br class="">
+++ cfe/trunk/lib/CodeGen/CGBlocks.cpp Tue Feb  3 12:40:42 2015<br class="">
@@ -1178,7 +1178,7 @@ CodeGenFunction::GenerateBlockFunction(G<br class="">
     Alloca->setAlignment(Align);<br class="">
     // Set the DebugLocation to empty, so the store is recognized as a<br class="">
     // frame setup instruction by llvm::DwarfDebug::beginFunction().<br class="">
-    ApplyDebugLocation NL(*this);<br class="">
+    ApplyDebugLocation NL(*this, ApplyDebugLocation::MarkAsPrologue);<br class="">
     Builder.CreateAlignedStore(BlockPointer, Alloca, Align);<br class="">
     BlockPointerDbgLoc = Alloca;<br class="">
   }<br class="">
@@ -1328,10 +1328,10 @@ CodeGenFunction::GenerateCopyHelperFunct<br class="">
                                           nullptr, SC_Static,<br class="">
                                           false,<br class="">
                                           false);<br class="">
-  // Create a scope with an artificial location for the body of this function.<br class="">
-  ApplyDebugLocation NL(*this);<br class="">
+  ApplyDebugLocation NL(*this, ApplyDebugLocation::MarkAsPrologue);<br class="">
   StartFunction(FD, C.VoidTy, Fn, FI, args);<br class="">
-  ArtificialLocation AL(*this);<br class="">
+  // Create a scope with an artificial location for the body of this function.<br class="">
+  ApplyDebugLocation AL(*this, ApplyDebugLocation::Artificial);<br class="">
<br class="">
   llvm::Type *structPtrTy = blockInfo.StructureType->getPointerTo();<br class="">
<br class="">
@@ -1500,9 +1500,9 @@ CodeGenFunction::GenerateDestroyHelperFu<br class="">
                                           nullptr, SC_Static,<br class="">
                                           false, false);<br class="">
   // Create a scope with an artificial location for the body of this function.<br class="">
-  ApplyDebugLocation NL(*this);<br class="">
+  ApplyDebugLocation NL(*this, ApplyDebugLocation::MarkAsPrologue);<br class="">
   StartFunction(FD, C.VoidTy, Fn, FI, args);<br class="">
-  ArtificialLocation AL(*this);<br class="">
+  ApplyDebugLocation AL(*this, ApplyDebugLocation::Artificial);<br class="">
<br class="">
   llvm::Type *structPtrTy = blockInfo.StructureType->getPointerTo();<br class="">
<br class="">
<br class="">
Modified: cfe/trunk/lib/CodeGen/CGCleanup.cpp<br class="">
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCleanup.cpp?rev=228003&r1=228002&r2=228003&view=diff" target="_blank" class="">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCleanup.cpp?rev=228003&r1=228002&r2=228003&view=diff</a><br class="">
==============================================================================<br class="">
--- cfe/trunk/lib/CodeGen/CGCleanup.cpp (original)<br class="">
+++ cfe/trunk/lib/CodeGen/CGCleanup.cpp Tue Feb  3 12:40:42 2015<br class="">
@@ -861,7 +861,7 @@ void CodeGenFunction::PopCleanupBlock(bo<br class="">
<br class="">
   // Emit the EH cleanup if required.<br class="">
   if (RequiresEHCleanup) {<br class="">
-    ApplyDebugLocation AutoRestoreLocation(*this, CurEHLocation);<br class="">
+    ApplyDebugLocation AL(*this, ApplyDebugLocation::Artificial, CurEHLocation);<br class="">
<br class="">
     CGBuilderTy::InsertPoint SavedIP = Builder.saveAndClearIP();<br class="">
<br class="">
<br class="">
Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp<br class="">
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=228003&r1=228002&r2=228003&view=diff" target="_blank" class="">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=228003&r1=228002&r2=228003&view=diff</a><br class="">
==============================================================================<br class="">
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)<br class="">
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Tue Feb  3 12:40:42 2015<br class="">
@@ -52,28 +52,34 @@ CGDebugInfo::~CGDebugInfo() {<br class="">
          "Region stack mismatch, stack not empty!");<br class="">
 }<br class="">
<br class="">
-ArtificialLocation::ArtificialLocation(CodeGenFunction &CGF)<br class="">
-    : ApplyDebugLocation(CGF) {<br class="">
-  if (auto *DI = CGF.getDebugInfo()) {<br class="">
-    // Construct a location that has a valid scope, but no line info.<br class="">
-    assert(!DI->LexicalBlockStack.empty());<br class="">
-    llvm::DIDescriptor Scope(DI->LexicalBlockStack.back());<br class="">
-    CGF.Builder.SetCurrentDebugLocation(llvm::DebugLoc::get(0, 0, Scope));<br class="">
-  }<br class="">
+ApplyDebugLocation::ApplyDebugLocation(CodeGenFunction &CGF,<br class="">
+                                       SourceLocation TemporaryLocation)<br class="">
+    : CGF(CGF) {<br class="">
+  assert(!TemporaryLocation.isInvalid() && "invalid location");<br class="">
+  init(TemporaryLocation);<br class="">
 }<br class="">
<br class="">
 ApplyDebugLocation::ApplyDebugLocation(CodeGenFunction &CGF,<br class="">
+                                       bool MarkAsPrologue,<br class="">
                                        SourceLocation TemporaryLocation)<br class="">
     : CGF(CGF) {<br class="">
-  init(TemporaryLocation);<br class="">
+  init(TemporaryLocation, MarkAsPrologue);<br class="">
 }<br class="">
<br class="">
-void ApplyDebugLocation::init(SourceLocation TemporaryLocation) {<br class="">
+void ApplyDebugLocation::init(SourceLocation TemporaryLocation,<br class="">
+                              bool MarkAsPrologue) {<br class="">
   if (auto *DI = CGF.getDebugInfo()) {<br class="">
     OriginalLocation = CGF.Builder.getCurrentDebugLocation();<br class="">
-    if (TemporaryLocation.isInvalid())<br class="">
-      CGF.Builder.SetCurrentDebugLocation(llvm::DebugLoc());<br class="">
-    else<br class="">
+    if (TemporaryLocation.isInvalid()) {<br class="">
+      if (MarkAsPrologue)<br class="">
+        CGF.Builder.SetCurrentDebugLocation(llvm::DebugLoc());<br class="">
+      else {<br class="">
+        // Construct a location that has a valid scope, but no line info.<br class="">
+        assert(!DI->LexicalBlockStack.empty());<br class="">
+        llvm::DIDescriptor Scope(DI->LexicalBlockStack.back());<br class="">
+        CGF.Builder.SetCurrentDebugLocation(llvm::DebugLoc::get(0, 0, Scope));<br class="">
+      }<br class="">
+    } else<br class="">
       DI->EmitLocation(CGF.Builder, TemporaryLocation);<br class="">
   }<br class="">
 }<br class="">
<br class="">
Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.h<br class="">
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.h?rev=228003&r1=228002&r2=228003&view=diff" target="_blank" class="">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.h?rev=228003&r1=228002&r2=228003&view=diff</a><br class="">
==============================================================================<br class="">
--- cfe/trunk/lib/CodeGen/CGDebugInfo.h (original)<br class="">
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.h Tue Feb  3 12:40:42 2015<br class="">
@@ -47,7 +47,7 @@ namespace CodeGen {<br class="">
 /// and is responsible for emitting to llvm globals or pass directly to<br class="">
 /// the backend.<br class="">
 class CGDebugInfo {<br class="">
-  friend class ArtificialLocation;<br class="">
+  friend class ApplyDebugLocation;<br class="">
   friend class SaveAndRestoreLocation;<br class="">
   CodeGenModule &CGM;<br class="">
   const CodeGenOptions::DebugInfoKind DebugKind;<br class="">
@@ -447,38 +447,36 @@ private:<br class="">
 /// location or preferred location of the specified Expr.<br class="">
 class ApplyDebugLocation {<br class="">
 private:<br class="">
-  void init(SourceLocation TemporaryLocation);<br class="">
+  void init(SourceLocation TemporaryLocation, bool MarkAsPrologue = false);<br class="">
<br class="">
 protected:<br class="">
   llvm::DebugLoc OriginalLocation;<br class="">
   CodeGenFunction &CGF;<br class="">
<br class="">
 public:<br class="">
-  /// If TemporaryLocation is invalid, the IRBuilder will be set to not attach<br class="">
-  /// debug locations, thus marking the instructions as prologue.<br class="">
-  ApplyDebugLocation(CodeGenFunction &CGF,<br class="">
+  enum { Artificial = false, MarkAsPrologue = true, NoLocation = true };<br class="">
+<br class="">
+  /// \brief Set the location to the (valid) TemporaryLocation.<br class="">
+  ApplyDebugLocation(CodeGenFunction &CGF, SourceLocation TemporaryLocation);<br class="">
+  /// \brief Apply TemporaryLocation if it is valid, or apply a default<br class="">
+  /// location: If MarkAsPrologue is true, the IRBuilder will be set to not<br class="">
+  /// attach debug locations, thus marking the instructions as<br class="">
+  /// prologue. Otherwise this switches to an artificial debug location that has<br class="">
+  /// a valid scope, but no line information.<br class="">
+  ///<br class="">
+  /// Artificial locations are useful when emitting compiler-generated helper<br class="">
+  /// functions that have no source location associated with them. The DWARF<br class="">
+  /// specification allows the compiler to use the special line number 0 to<br class="">
+  /// indicate code that can not be attributed to any source location. Note that<br class="">
+  /// passing an empty SourceLocation to CGDebugInfo::setLocation() will result<br class="">
+  /// in the last valid location being reused.<br class="">
+  ApplyDebugLocation(CodeGenFunction &CGF, bool MarkAsPrologue,<br class="">
                      SourceLocation TemporaryLocation = SourceLocation());<br class=""></blockquote><div class=""><br class="">This seems confusing to me - Both having 2 names for the same constant value (true), and having the ability to specify a location even when passing a parameter that means, either "don't specify any location" or "use line zero”.<br class=""></div></div></div></div></div></blockquote><div><br class=""></div><div>About the 2 names: My goal was to separate intent from implementation. The fact that the backend conflates no location and prologue locations shouldn’t leak into the frontend.</div><div><br class=""></div>As mentioned in the commit message, this is a way of specifying two different kinds of default behavior if the location is invalid.<br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote"><div class=""><br class="">Also, having a runtime property for a compile-time use case is a bit awkward (no caller is going to get a dynamic value for these parameters, hopefully - so I'd be inclined to either use named ctors (static functions that return by the scoped device by value) or type-based ctor tags like std::pair's piecewise_construct thing)).<br class=""></div></div></div></div></div></blockquote><div><br class=""></div>That’s a good idea! I’ll do that.</div><div><br class=""></div><div>-- adrian<br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote"><div class=""> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
   ApplyDebugLocation(CodeGenFunction &CGF, const Expr *E);<br class="">
   ApplyDebugLocation(CodeGenFunction &CGF, llvm::DebugLoc Loc);<br class="">
   ~ApplyDebugLocation();<br class="">
 };<br class="">
<br class="">
-/// \brief An RAII object that temporarily switches to<br class="">
-/// an artificial debug location that has a valid scope, but no line<br class="">
-/// information. This is useful when emitting compiler-generated<br class="">
-/// helper functions that have no source location associated with<br class="">
-/// them. The DWARF specification allows the compiler to use the<br class="">
-/// special line number 0 to indicate code that can not be attributed<br class="">
-/// to any source location.<br class="">
-///<br class="">
-/// This is necessary because passing an empty SourceLocation to<br class="">
-/// CGDebugInfo::setLocation() will result in the last valid location<br class="">
-/// being reused.<br class="">
-class ArtificialLocation : public ApplyDebugLocation {<br class="">
-public:<br class="">
-  ArtificialLocation(CodeGenFunction &CGF);<br class="">
-};<br class="">
-<br class="">
<br class="">
 } // namespace CodeGen<br class="">
 } // namespace clang<br class="">
<br class="">
Modified: cfe/trunk/lib/CodeGen/CGDecl.cpp<br class="">
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDecl.cpp?rev=228003&r1=228002&r2=228003&view=diff" target="_blank" class="">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDecl.cpp?rev=228003&r1=228002&r2=228003&view=diff</a><br class="">
==============================================================================<br class="">
--- cfe/trunk/lib/CodeGen/CGDecl.cpp (original)<br class="">
+++ cfe/trunk/lib/CodeGen/CGDecl.cpp Tue Feb  3 12:40:42 2015<br class="">
@@ -1090,7 +1090,7 @@ void CodeGenFunction::EmitAutoVarInit(co<br class="">
   if (emission.wasEmittedAsGlobal()) return;<br class="">
<br class="">
   const VarDecl &D = *emission.Variable;<br class="">
-  ApplyDebugLocation DL(*this, D.getLocation());<br class="">
+  ApplyDebugLocation DL(*this, ApplyDebugLocation::Artificial, D.getLocation());<br class="">
   QualType type = D.getType();<br class="">
<br class="">
   // If this local has an initializer, emit it now.<br class="">
<br class="">
Modified: cfe/trunk/lib/CodeGen/CGDeclCXX.cpp<br class="">
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDeclCXX.cpp?rev=228003&r1=228002&r2=228003&view=diff" target="_blank" class="">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDeclCXX.cpp?rev=228003&r1=228002&r2=228003&view=diff</a><br class="">
==============================================================================<br class="">
--- cfe/trunk/lib/CodeGen/CGDeclCXX.cpp (original)<br class="">
+++ cfe/trunk/lib/CodeGen/CGDeclCXX.cpp Tue Feb  3 12:40:42 2015<br class="">
@@ -469,11 +469,11 @@ CodeGenFunction::GenerateCXXGlobalInitFu<br class="">
                                            ArrayRef<llvm::Function *> Decls,<br class="">
                                            llvm::GlobalVariable *Guard) {<br class="">
   {<br class="">
-    ApplyDebugLocation NL(*this);<br class="">
+    ApplyDebugLocation NL(*this, ApplyDebugLocation::MarkAsPrologue);<br class="">
     StartFunction(GlobalDecl(), getContext().VoidTy, Fn,<br class="">
                   getTypes().arrangeNullaryFunction(), FunctionArgList());<br class="">
     // Emit an artificial location for this function.<br class="">
-    ArtificialLocation AL(*this);<br class="">
+    ApplyDebugLocation AL(*this, ApplyDebugLocation::Artificial);<br class="">
<br class="">
     llvm::BasicBlock *ExitBlock = nullptr;<br class="">
     if (Guard) {<br class="">
@@ -520,11 +520,11 @@ void CodeGenFunction::GenerateCXXGlobalD<br class="">
                   const std::vector<std::pair<llvm::WeakVH, llvm::Constant*> ><br class="">
                                                 &DtorsAndObjects) {<br class="">
   {<br class="">
-    ApplyDebugLocation NL(*this);<br class="">
+    ApplyDebugLocation NL(*this, ApplyDebugLocation::MarkAsPrologue);<br class="">
     StartFunction(GlobalDecl(), getContext().VoidTy, Fn,<br class="">
                   getTypes().arrangeNullaryFunction(), FunctionArgList());<br class="">
     // Emit an artificial location for this function.<br class="">
-    ArtificialLocation AL(*this);<br class="">
+    ApplyDebugLocation AL(*this, ApplyDebugLocation::Artificial);<br class="">
<br class="">
     // Emit the dtors, in reverse order from construction.<br class="">
     for (unsigned i = 0, e = DtorsAndObjects.size(); i != e; ++i) {<br class="">
<br class="">
Modified: cfe/trunk/lib/CodeGen/CGException.cpp<br class="">
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGException.cpp?rev=228003&r1=228002&r2=228003&view=diff" target="_blank" class="">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGException.cpp?rev=228003&r1=228002&r2=228003&view=diff</a><br class="">
==============================================================================<br class="">
--- cfe/trunk/lib/CodeGen/CGException.cpp (original)<br class="">
+++ cfe/trunk/lib/CodeGen/CGException.cpp Tue Feb  3 12:40:42 2015<br class="">
@@ -770,7 +770,7 @@ llvm::BasicBlock *CodeGenFunction::EmitL<br class="">
<br class="">
   // Save the current IR generation state.<br class="">
   CGBuilderTy::InsertPoint savedIP = Builder.saveAndClearIP();<br class="">
-  ApplyDebugLocation AutoRestoreLocation(*this, CurEHLocation);<br class="">
+  ApplyDebugLocation AL(*this, ApplyDebugLocation::Artificial, CurEHLocation);<br class="">
<br class="">
   const EHPersonality &personality = EHPersonality::get(CGM);<br class="">
<br class="">
<br class="">
Modified: cfe/trunk/lib/CodeGen/CGExprScalar.cpp<br class="">
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprScalar.cpp?rev=228003&r1=228002&r2=228003&view=diff" target="_blank" class="">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprScalar.cpp?rev=228003&r1=228002&r2=228003&view=diff</a><br class="">
==============================================================================<br class="">
--- cfe/trunk/lib/CodeGen/CGExprScalar.cpp (original)<br class="">
+++ cfe/trunk/lib/CodeGen/CGExprScalar.cpp Tue Feb  3 12:40:42 2015<br class="">
@@ -3043,7 +3043,7 @@ Value *ScalarExprEmitter::VisitBinLAnd(c<br class="">
   // Emit an unconditional branch from this block to ContBlock.<br class="">
   {<br class="">
     // There is no need to emit line number for unconditional branch.<br class="">
-    ApplyDebugLocation DL(CGF);<br class="">
+    ApplyDebugLocation NL(CGF, ApplyDebugLocation::NoLocation);<br class="">
     CGF.EmitBlock(ContBlock);<br class="">
   }<br class="">
   // Insert an entry into the phi node for the edge with the value of RHSCond.<br class="">
<br class="">
Modified: cfe/trunk/lib/CodeGen/CGStmt.cpp<br class="">
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmt.cpp?rev=228003&r1=228002&r2=228003&view=diff" target="_blank" class="">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmt.cpp?rev=228003&r1=228002&r2=228003&view=diff</a><br class="">
==============================================================================<br class="">
--- cfe/trunk/lib/CodeGen/CGStmt.cpp (original)<br class="">
+++ cfe/trunk/lib/CodeGen/CGStmt.cpp Tue Feb  3 12:40:42 2015<br class="">
@@ -564,8 +564,8 @@ void CodeGenFunction::EmitIfStmt(const I<br class="">
   // Emit the 'else' code if present.<br class="">
   if (const Stmt *Else = S.getElse()) {<br class="">
     {<br class="">
-      // There is no need to emit line number for unconditional branch.<br class="">
-      ApplyDebugLocation DL(*this);<br class="">
+      // There is no need to emit line number for an unconditional branch.<br class="">
+      ApplyDebugLocation NL(*this, ApplyDebugLocation::NoLocation);<br class="">
       EmitBlock(ElseBlock);<br class="">
     }<br class="">
     {<br class="">
@@ -573,8 +573,8 @@ void CodeGenFunction::EmitIfStmt(const I<br class="">
       EmitStmt(Else);<br class="">
     }<br class="">
     {<br class="">
-      // There is no need to emit line number for unconditional branch.<br class="">
-      ApplyDebugLocation DL(*this);<br class="">
+      // There is no need to emit line number for an unconditional branch.<br class="">
+      ApplyDebugLocation NL(*this, ApplyDebugLocation::NoLocation);<br class="">
       EmitBranch(ContBlock);<br class="">
     }<br class="">
   }<br class="">
<br class="">
Modified: cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp<br class="">
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp?rev=228003&r1=228002&r2=228003&view=diff" target="_blank" class="">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp?rev=228003&r1=228002&r2=228003&view=diff</a><br class="">
==============================================================================<br class="">
--- cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp (original)<br class="">
+++ cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp Tue Feb  3 12:40:42 2015<br class="">
@@ -86,13 +86,13 @@ static void EmitOMPIfClause(CodeGenFunct<br class="">
   // Emit the 'else' code if present.<br class="">
   {<br class="">
     // There is no need to emit line number for unconditional branch.<br class="">
-    ApplyDebugLocation DL(CGF);<br class="">
+    ApplyDebugLocation NL(CGF, ApplyDebugLocation::NoLocation);<br class="">
     CGF.EmitBlock(ElseBlock);<br class="">
   }<br class="">
   CodeGen(/*ThenBlock*/ false);<br class="">
   {<br class="">
     // There is no need to emit line number for unconditional branch.<br class="">
-    ApplyDebugLocation DL(CGF);<br class="">
+    ApplyDebugLocation NL(CGF, ApplyDebugLocation::NoLocation);<br class="">
     CGF.EmitBranch(ContBlock);<br class="">
   }<br class="">
   // Emit the continuation block for code after the if.<br class="">
<br class="">
Added: cfe/trunk/test/CodeGenObjCXX/<a href="http://nested-ehlocation.mm/" target="_blank" class="">nested-ehlocation.mm</a><br class="">
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjCXX/nested-ehlocation.mm?rev=228003&view=auto" target="_blank" class="">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjCXX/nested-ehlocation.mm?rev=228003&view=auto</a><br class="">
==============================================================================<br class="">
--- cfe/trunk/test/CodeGenObjCXX/<a href="http://nested-ehlocation.mm/" target="_blank" class="">nested-ehlocation.mm</a> (added)<br class="">
+++ cfe/trunk/test/CodeGenObjCXX/<a href="http://nested-ehlocation.mm/" target="_blank" class="">nested-ehlocation.mm</a> Tue Feb  3 12:40:42 2015<br class="">
@@ -0,0 +1,24 @@<br class="">
+// RUN: %clang_cc1  -triple x86_64-apple-macosx -emit-llvm -g -stdlib=libc++ -fblocks -fexceptions -x objective-c++ -o - %s | FileCheck %s<br class="">
+<br class="">
+// Verify that all invoke instructions have a debug location.<br class="">
+// Literally: There are no unwind lines that don't end with ", (!dbg 123)".<br class="">
+// CHECK-NOT: {{to label %.* unwind label [^,]+$}}<br class=""></blockquote><div class=""><br class="">Seems like we should actually test that these instructions have the location we desire rather than just "anything location will do, so long as it has a location".<br class=""><br class="">I'm also not sure which cases this test is trying to cover/which parts are necessary, might be helpful to either split it out into separate tests (they can be in the same file, but separated so each has a clear, singular purpose like my debug-info-line.cpp/.c tests) and/or comment it a bit so the important pieces are clear/motivated.<br class=""><br class="">- David<br class=""> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+<br class="">
+void block(void (^)(void));<br class="">
+extern void foo();<br class="">
+struct A {<br class="">
+  ~A(void) { foo(); }<br class="">
+  void bar() const {}<br class="">
+};<br class="">
+void baz(void const *const) {}<br class="">
+struct B : A {};<br class="">
+void test() {<br class="">
+  A a;<br class="">
+  B b;<br class="">
+  block(^(void) {<br class="">
+    baz(&b);<br class="">
+    block(^() {<br class="">
+      a.bar();<br class="">
+    });<br class="">
+  });<br class="">
+}<br class="">
<br class="">
<br class="">
_______________________________________________<br class="">
cfe-commits mailing list<br class="">
<a href="mailto:cfe-commits@cs.uiuc.edu" class="">cfe-commits@cs.uiuc.edu</a><br class="">
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank" class="">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br class="">
</blockquote></div><br class=""></div></div>
</div></blockquote></div><br class=""></body></html>