<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Feb 3, 2015 at 10:40 AM, Adrian Prantl <span dir="ltr"><<a href="mailto:aprantl@apple.com" target="_blank">aprantl@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: adrian<br>
Date: Tue Feb  3 12:40:42 2015<br>
New Revision: 228003<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=228003&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=228003&view=rev</a><br>
Log:<br>
Merge ArtificialLocation into ApplyDebugLocation and make a clear<br>
distinction between the different use-cases. With the previous default<br>
behavior we would occasionally emit empty debug locations in situations<br>
where they actually were strictly required (= on invoke insns).<br>
We now have a choice between defaulting to an empty location or an<br>
artificial location.<br>
<br>
Specifically, this fixes a bug caused by a missing debug location when<br>
emitting C++ EH cleanup blocks from within an artificial function, such as<br>
an ObjC destroy helper function.<br>
<br>
rdar://problem/19670595<br>
<br>
Added:<br>
    cfe/trunk/test/CodeGenObjCXX/<a href="http://nested-ehlocation.mm" target="_blank">nested-ehlocation.mm</a><br>
Modified:<br>
    cfe/trunk/lib/CodeGen/CGBlocks.cpp<br>
    cfe/trunk/lib/CodeGen/CGCleanup.cpp<br>
    cfe/trunk/lib/CodeGen/CGDebugInfo.cpp<br>
    cfe/trunk/lib/CodeGen/CGDebugInfo.h<br>
    cfe/trunk/lib/CodeGen/CGDecl.cpp<br>
    cfe/trunk/lib/CodeGen/CGDeclCXX.cpp<br>
    cfe/trunk/lib/CodeGen/CGException.cpp<br>
    cfe/trunk/lib/CodeGen/CGExprScalar.cpp<br>
    cfe/trunk/lib/CodeGen/CGStmt.cpp<br>
    cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp<br>
<br>
Modified: cfe/trunk/lib/CodeGen/CGBlocks.cpp<br>
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">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBlocks.cpp?rev=228003&r1=228002&r2=228003&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/CodeGen/CGBlocks.cpp (original)<br>
+++ cfe/trunk/lib/CodeGen/CGBlocks.cpp Tue Feb  3 12:40:42 2015<br>
@@ -1178,7 +1178,7 @@ CodeGenFunction::GenerateBlockFunction(G<br>
     Alloca->setAlignment(Align);<br>
     // Set the DebugLocation to empty, so the store is recognized as a<br>
     // frame setup instruction by llvm::DwarfDebug::beginFunction().<br>
-    ApplyDebugLocation NL(*this);<br>
+    ApplyDebugLocation NL(*this, ApplyDebugLocation::MarkAsPrologue);<br>
     Builder.CreateAlignedStore(BlockPointer, Alloca, Align);<br>
     BlockPointerDbgLoc = Alloca;<br>
   }<br>
@@ -1328,10 +1328,10 @@ CodeGenFunction::GenerateCopyHelperFunct<br>
                                           nullptr, SC_Static,<br>
                                           false,<br>
                                           false);<br>
-  // Create a scope with an artificial location for the body of this function.<br>
-  ApplyDebugLocation NL(*this);<br>
+  ApplyDebugLocation NL(*this, ApplyDebugLocation::MarkAsPrologue);<br>
   StartFunction(FD, C.VoidTy, Fn, FI, args);<br>
-  ArtificialLocation AL(*this);<br>
+  // Create a scope with an artificial location for the body of this function.<br>
+  ApplyDebugLocation AL(*this, ApplyDebugLocation::Artificial);<br>
<br>
   llvm::Type *structPtrTy = blockInfo.StructureType->getPointerTo();<br>
<br>
@@ -1500,9 +1500,9 @@ CodeGenFunction::GenerateDestroyHelperFu<br>
                                           nullptr, SC_Static,<br>
                                           false, false);<br>
   // Create a scope with an artificial location for the body of this function.<br>
-  ApplyDebugLocation NL(*this);<br>
+  ApplyDebugLocation NL(*this, ApplyDebugLocation::MarkAsPrologue);<br>
   StartFunction(FD, C.VoidTy, Fn, FI, args);<br>
-  ArtificialLocation AL(*this);<br>
+  ApplyDebugLocation AL(*this, ApplyDebugLocation::Artificial);<br>
<br>
   llvm::Type *structPtrTy = blockInfo.StructureType->getPointerTo();<br>
<br>
<br>
Modified: cfe/trunk/lib/CodeGen/CGCleanup.cpp<br>
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">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCleanup.cpp?rev=228003&r1=228002&r2=228003&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/CodeGen/CGCleanup.cpp (original)<br>
+++ cfe/trunk/lib/CodeGen/CGCleanup.cpp Tue Feb  3 12:40:42 2015<br>
@@ -861,7 +861,7 @@ void CodeGenFunction::PopCleanupBlock(bo<br>
<br>
   // Emit the EH cleanup if required.<br>
   if (RequiresEHCleanup) {<br>
-    ApplyDebugLocation AutoRestoreLocation(*this, CurEHLocation);<br>
+    ApplyDebugLocation AL(*this, ApplyDebugLocation::Artificial, CurEHLocation);<br>
<br>
     CGBuilderTy::InsertPoint SavedIP = Builder.saveAndClearIP();<br>
<br>
<br>
Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp<br>
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">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=228003&r1=228002&r2=228003&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)<br>
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Tue Feb  3 12:40:42 2015<br>
@@ -52,28 +52,34 @@ CGDebugInfo::~CGDebugInfo() {<br>
          "Region stack mismatch, stack not empty!");<br>
 }<br>
<br>
-ArtificialLocation::ArtificialLocation(CodeGenFunction &CGF)<br>
-    : ApplyDebugLocation(CGF) {<br>
-  if (auto *DI = CGF.getDebugInfo()) {<br>
-    // Construct a location that has a valid scope, but no line info.<br>
-    assert(!DI->LexicalBlockStack.empty());<br>
-    llvm::DIDescriptor Scope(DI->LexicalBlockStack.back());<br>
-    CGF.Builder.SetCurrentDebugLocation(llvm::DebugLoc::get(0, 0, Scope));<br>
-  }<br>
+ApplyDebugLocation::ApplyDebugLocation(CodeGenFunction &CGF,<br>
+                                       SourceLocation TemporaryLocation)<br>
+    : CGF(CGF) {<br>
+  assert(!TemporaryLocation.isInvalid() && "invalid location");<br>
+  init(TemporaryLocation);<br>
 }<br>
<br>
 ApplyDebugLocation::ApplyDebugLocation(CodeGenFunction &CGF,<br>
+                                       bool MarkAsPrologue,<br>
                                        SourceLocation TemporaryLocation)<br>
     : CGF(CGF) {<br>
-  init(TemporaryLocation);<br>
+  init(TemporaryLocation, MarkAsPrologue);<br>
 }<br>
<br>
-void ApplyDebugLocation::init(SourceLocation TemporaryLocation) {<br>
+void ApplyDebugLocation::init(SourceLocation TemporaryLocation,<br>
+                              bool MarkAsPrologue) {<br>
   if (auto *DI = CGF.getDebugInfo()) {<br>
     OriginalLocation = CGF.Builder.getCurrentDebugLocation();<br>
-    if (TemporaryLocation.isInvalid())<br>
-      CGF.Builder.SetCurrentDebugLocation(llvm::DebugLoc());<br>
-    else<br>
+    if (TemporaryLocation.isInvalid()) {<br>
+      if (MarkAsPrologue)<br>
+        CGF.Builder.SetCurrentDebugLocation(llvm::DebugLoc());<br>
+      else {<br>
+        // Construct a location that has a valid scope, but no line info.<br>
+        assert(!DI->LexicalBlockStack.empty());<br>
+        llvm::DIDescriptor Scope(DI->LexicalBlockStack.back());<br>
+        CGF.Builder.SetCurrentDebugLocation(llvm::DebugLoc::get(0, 0, Scope));<br>
+      }<br>
+    } else<br>
       DI->EmitLocation(CGF.Builder, TemporaryLocation);<br>
   }<br>
 }<br>
<br>
Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.h<br>
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">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.h?rev=228003&r1=228002&r2=228003&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/CodeGen/CGDebugInfo.h (original)<br>
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.h Tue Feb  3 12:40:42 2015<br>
@@ -47,7 +47,7 @@ namespace CodeGen {<br>
 /// and is responsible for emitting to llvm globals or pass directly to<br>
 /// the backend.<br>
 class CGDebugInfo {<br>
-  friend class ArtificialLocation;<br>
+  friend class ApplyDebugLocation;<br>
   friend class SaveAndRestoreLocation;<br>
   CodeGenModule &CGM;<br>
   const CodeGenOptions::DebugInfoKind DebugKind;<br>
@@ -447,38 +447,36 @@ private:<br>
 /// location or preferred location of the specified Expr.<br>
 class ApplyDebugLocation {<br>
 private:<br>
-  void init(SourceLocation TemporaryLocation);<br>
+  void init(SourceLocation TemporaryLocation, bool MarkAsPrologue = false);<br>
<br>
 protected:<br>
   llvm::DebugLoc OriginalLocation;<br>
   CodeGenFunction &CGF;<br>
<br>
 public:<br>
-  /// If TemporaryLocation is invalid, the IRBuilder will be set to not attach<br>
-  /// debug locations, thus marking the instructions as prologue.<br>
-  ApplyDebugLocation(CodeGenFunction &CGF,<br>
+  enum { Artificial = false, MarkAsPrologue = true, NoLocation = true };<br>
+<br>
+  /// \brief Set the location to the (valid) TemporaryLocation.<br>
+  ApplyDebugLocation(CodeGenFunction &CGF, SourceLocation TemporaryLocation);<br>
+  /// \brief Apply TemporaryLocation if it is valid, or apply a default<br>
+  /// location: If MarkAsPrologue is true, the IRBuilder will be set to not<br>
+  /// attach debug locations, thus marking the instructions as<br>
+  /// prologue. Otherwise this switches to an artificial debug location that has<br>
+  /// a valid scope, but no line information.<br>
+  ///<br>
+  /// Artificial locations are useful when emitting compiler-generated helper<br>
+  /// functions that have no source location associated with them. The DWARF<br>
+  /// specification allows the compiler to use the special line number 0 to<br>
+  /// indicate code that can not be attributed to any source location. Note that<br>
+  /// passing an empty SourceLocation to CGDebugInfo::setLocation() will result<br>
+  /// in the last valid location being reused.<br>
+  ApplyDebugLocation(CodeGenFunction &CGF, bool MarkAsPrologue,<br>
                      SourceLocation TemporaryLocation = SourceLocation());<br></blockquote><div><br>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><br>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> </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>
   ApplyDebugLocation(CodeGenFunction &CGF, llvm::DebugLoc Loc);<br>
   ~ApplyDebugLocation();<br>
 };<br>
<br>
-/// \brief An RAII object that temporarily switches to<br>
-/// an artificial debug location that has a valid scope, but no line<br>
-/// information. This is useful when emitting compiler-generated<br>
-/// helper functions that have no source location associated with<br>
-/// them. The DWARF specification allows the compiler to use the<br>
-/// special line number 0 to indicate code that can not be attributed<br>
-/// to any source location.<br>
-///<br>
-/// This is necessary because passing an empty SourceLocation to<br>
-/// CGDebugInfo::setLocation() will result in the last valid location<br>
-/// being reused.<br>
-class ArtificialLocation : public ApplyDebugLocation {<br>
-public:<br>
-  ArtificialLocation(CodeGenFunction &CGF);<br>
-};<br>
-<br>
<br>
 } // namespace CodeGen<br>
 } // namespace clang<br>
<br>
Modified: cfe/trunk/lib/CodeGen/CGDecl.cpp<br>
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">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDecl.cpp?rev=228003&r1=228002&r2=228003&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/CodeGen/CGDecl.cpp (original)<br>
+++ cfe/trunk/lib/CodeGen/CGDecl.cpp Tue Feb  3 12:40:42 2015<br>
@@ -1090,7 +1090,7 @@ void CodeGenFunction::EmitAutoVarInit(co<br>
   if (emission.wasEmittedAsGlobal()) return;<br>
<br>
   const VarDecl &D = *emission.Variable;<br>
-  ApplyDebugLocation DL(*this, D.getLocation());<br>
+  ApplyDebugLocation DL(*this, ApplyDebugLocation::Artificial, D.getLocation());<br>
   QualType type = D.getType();<br>
<br>
   // If this local has an initializer, emit it now.<br>
<br>
Modified: cfe/trunk/lib/CodeGen/CGDeclCXX.cpp<br>
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">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDeclCXX.cpp?rev=228003&r1=228002&r2=228003&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/CodeGen/CGDeclCXX.cpp (original)<br>
+++ cfe/trunk/lib/CodeGen/CGDeclCXX.cpp Tue Feb  3 12:40:42 2015<br>
@@ -469,11 +469,11 @@ CodeGenFunction::GenerateCXXGlobalInitFu<br>
                                            ArrayRef<llvm::Function *> Decls,<br>
                                            llvm::GlobalVariable *Guard) {<br>
   {<br>
-    ApplyDebugLocation NL(*this);<br>
+    ApplyDebugLocation NL(*this, ApplyDebugLocation::MarkAsPrologue);<br>
     StartFunction(GlobalDecl(), getContext().VoidTy, Fn,<br>
                   getTypes().arrangeNullaryFunction(), FunctionArgList());<br>
     // Emit an artificial location for this function.<br>
-    ArtificialLocation AL(*this);<br>
+    ApplyDebugLocation AL(*this, ApplyDebugLocation::Artificial);<br>
<br>
     llvm::BasicBlock *ExitBlock = nullptr;<br>
     if (Guard) {<br>
@@ -520,11 +520,11 @@ void CodeGenFunction::GenerateCXXGlobalD<br>
                   const std::vector<std::pair<llvm::WeakVH, llvm::Constant*> ><br>
                                                 &DtorsAndObjects) {<br>
   {<br>
-    ApplyDebugLocation NL(*this);<br>
+    ApplyDebugLocation NL(*this, ApplyDebugLocation::MarkAsPrologue);<br>
     StartFunction(GlobalDecl(), getContext().VoidTy, Fn,<br>
                   getTypes().arrangeNullaryFunction(), FunctionArgList());<br>
     // Emit an artificial location for this function.<br>
-    ArtificialLocation AL(*this);<br>
+    ApplyDebugLocation AL(*this, ApplyDebugLocation::Artificial);<br>
<br>
     // Emit the dtors, in reverse order from construction.<br>
     for (unsigned i = 0, e = DtorsAndObjects.size(); i != e; ++i) {<br>
<br>
Modified: cfe/trunk/lib/CodeGen/CGException.cpp<br>
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">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGException.cpp?rev=228003&r1=228002&r2=228003&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/CodeGen/CGException.cpp (original)<br>
+++ cfe/trunk/lib/CodeGen/CGException.cpp Tue Feb  3 12:40:42 2015<br>
@@ -770,7 +770,7 @@ llvm::BasicBlock *CodeGenFunction::EmitL<br>
<br>
   // Save the current IR generation state.<br>
   CGBuilderTy::InsertPoint savedIP = Builder.saveAndClearIP();<br>
-  ApplyDebugLocation AutoRestoreLocation(*this, CurEHLocation);<br>
+  ApplyDebugLocation AL(*this, ApplyDebugLocation::Artificial, CurEHLocation);<br>
<br>
   const EHPersonality &personality = EHPersonality::get(CGM);<br>
<br>
<br>
Modified: cfe/trunk/lib/CodeGen/CGExprScalar.cpp<br>
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">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprScalar.cpp?rev=228003&r1=228002&r2=228003&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/CodeGen/CGExprScalar.cpp (original)<br>
+++ cfe/trunk/lib/CodeGen/CGExprScalar.cpp Tue Feb  3 12:40:42 2015<br>
@@ -3043,7 +3043,7 @@ Value *ScalarExprEmitter::VisitBinLAnd(c<br>
   // Emit an unconditional branch from this block to ContBlock.<br>
   {<br>
     // There is no need to emit line number for unconditional branch.<br>
-    ApplyDebugLocation DL(CGF);<br>
+    ApplyDebugLocation NL(CGF, ApplyDebugLocation::NoLocation);<br>
     CGF.EmitBlock(ContBlock);<br>
   }<br>
   // Insert an entry into the phi node for the edge with the value of RHSCond.<br>
<br>
Modified: cfe/trunk/lib/CodeGen/CGStmt.cpp<br>
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">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmt.cpp?rev=228003&r1=228002&r2=228003&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/CodeGen/CGStmt.cpp (original)<br>
+++ cfe/trunk/lib/CodeGen/CGStmt.cpp Tue Feb  3 12:40:42 2015<br>
@@ -564,8 +564,8 @@ void CodeGenFunction::EmitIfStmt(const I<br>
   // Emit the 'else' code if present.<br>
   if (const Stmt *Else = S.getElse()) {<br>
     {<br>
-      // There is no need to emit line number for unconditional branch.<br>
-      ApplyDebugLocation DL(*this);<br>
+      // There is no need to emit line number for an unconditional branch.<br>
+      ApplyDebugLocation NL(*this, ApplyDebugLocation::NoLocation);<br>
       EmitBlock(ElseBlock);<br>
     }<br>
     {<br>
@@ -573,8 +573,8 @@ void CodeGenFunction::EmitIfStmt(const I<br>
       EmitStmt(Else);<br>
     }<br>
     {<br>
-      // There is no need to emit line number for unconditional branch.<br>
-      ApplyDebugLocation DL(*this);<br>
+      // There is no need to emit line number for an unconditional branch.<br>
+      ApplyDebugLocation NL(*this, ApplyDebugLocation::NoLocation);<br>
       EmitBranch(ContBlock);<br>
     }<br>
   }<br>
<br>
Modified: cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp<br>
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">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp?rev=228003&r1=228002&r2=228003&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp (original)<br>
+++ cfe/trunk/lib/CodeGen/CGStmtOpenMP.cpp Tue Feb  3 12:40:42 2015<br>
@@ -86,13 +86,13 @@ static void EmitOMPIfClause(CodeGenFunct<br>
   // Emit the 'else' code if present.<br>
   {<br>
     // There is no need to emit line number for unconditional branch.<br>
-    ApplyDebugLocation DL(CGF);<br>
+    ApplyDebugLocation NL(CGF, ApplyDebugLocation::NoLocation);<br>
     CGF.EmitBlock(ElseBlock);<br>
   }<br>
   CodeGen(/*ThenBlock*/ false);<br>
   {<br>
     // There is no need to emit line number for unconditional branch.<br>
-    ApplyDebugLocation DL(CGF);<br>
+    ApplyDebugLocation NL(CGF, ApplyDebugLocation::NoLocation);<br>
     CGF.EmitBranch(ContBlock);<br>
   }<br>
   // Emit the continuation block for code after the if.<br>
<br>
Added: cfe/trunk/test/CodeGenObjCXX/<a href="http://nested-ehlocation.mm" target="_blank">nested-ehlocation.mm</a><br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjCXX/nested-ehlocation.mm?rev=228003&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjCXX/nested-ehlocation.mm?rev=228003&view=auto</a><br>
==============================================================================<br>
--- cfe/trunk/test/CodeGenObjCXX/<a href="http://nested-ehlocation.mm" target="_blank">nested-ehlocation.mm</a> (added)<br>
+++ cfe/trunk/test/CodeGenObjCXX/<a href="http://nested-ehlocation.mm" target="_blank">nested-ehlocation.mm</a> Tue Feb  3 12:40:42 2015<br>
@@ -0,0 +1,24 @@<br>
+// RUN: %clang_cc1  -triple x86_64-apple-macosx -emit-llvm -g -stdlib=libc++ -fblocks -fexceptions -x objective-c++ -o - %s | FileCheck %s<br>
+<br>
+// Verify that all invoke instructions have a debug location.<br>
+// Literally: There are no unwind lines that don't end with ", (!dbg 123)".<br>
+// CHECK-NOT: {{to label %.* unwind label [^,]+$}}<br></blockquote><div><br>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><br>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><br>- David<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+<br>
+void block(void (^)(void));<br>
+extern void foo();<br>
+struct A {<br>
+  ~A(void) { foo(); }<br>
+  void bar() const {}<br>
+};<br>
+void baz(void const *const) {}<br>
+struct B : A {};<br>
+void test() {<br>
+  A a;<br>
+  B b;<br>
+  block(^(void) {<br>
+    baz(&b);<br>
+    block(^() {<br>
+      a.bar();<br>
+    });<br>
+  });<br>
+}<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
</blockquote></div><br></div></div>