<div dir="ltr">You could simplify the test case further, down to just:<br><br>struct foo { void bar(); };<br>void f(foo *f) {<br>  f->bar();<br>}<br><br>and check that the call instruction has the desired column (or if you want a test that doesn't depend on column info (you can force it on with a flag, but we might vary whether it's on by default based on target, etc, I'm not sure) you could put 'bar();' on a separate line from 'f->' and check the call was on the second line and not the first).<br><br>Richard might be able to tell us whether there's a preferred place for a test for a change like this - should it be a debug info test, a diagnostic test, or perhaps just an ast dump test?<br><br>Perhaps a test for the case where there is no valid callee would be good? Where does that come up - call through a member function pointer?</div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Apr 29, 2016 at 9:19 AM, Hal Finkel via cfe-commits <span dir="ltr"><<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">hfinkel updated this revision to Diff 55610.<br>
hfinkel added a comment.<br>
<br>
Use David's suggested approach: Modify the preferred expression location for member calls. If the callee has a valid location (not all do), then use that. Otherwise, fall back to the starting location. This seems to cleanly fix the debug-info problem.<br>
<br>
<br>
<a href="http://reviews.llvm.org/D19708" rel="noreferrer" target="_blank">http://reviews.llvm.org/D19708</a><br>
<br>
Files:<br>
  include/clang/AST/ExprCXX.h<br>
<div><div class="h5">  test/CodeGenCXX/debug-info-member-call.cpp<br>
<br>
Index: test/CodeGenCXX/debug-info-member-call.cpp<br>
===================================================================<br>
--- /dev/null<br>
+++ test/CodeGenCXX/debug-info-member-call.cpp<br>
@@ -0,0 +1,24 @@<br>
+// RUN: %clang_cc1 -triple x86_64-unknown_unknown -emit-llvm -debug-info-kind=standalone -dwarf-column-info %s -o - | FileCheck %s<br>
+void ext();<br>
+<br>
+struct Bar {<br>
+  void bar() { ext(); }<br>
+};<br>
+<br>
+struct Foo {<br>
+  Bar *b;<br>
+<br>
+  Bar *foo() { return b; }<br>
+};<br>
+<br>
+void test(Foo *f) {<br>
+  f->foo()->bar();<br>
+}<br>
+<br>
+// CHECK-LABEL: @_Z4testP3Foo<br>
+// CHECK: call {{.*}} @_ZN3Foo3fooEv{{.*}}, !dbg ![[CALL1LOC:.*]]<br>
+// CHECK: call void @_ZN3Bar3barEv{{.*}}, !dbg ![[CALL2LOC:.*]]<br>
+<br>
+// CHECK: ![[CALL1LOC]] = !DILocation(line: [[LINE:[0-9]+]], column: 6,<br>
+// CHECK: ![[CALL2LOC]] = !DILocation(line: [[LINE]], column: 13,<br>
+<br>
</div></div>Index: include/clang/AST/ExprCXX.h<br>
===================================================================<br>
--- include/clang/AST/ExprCXX.h<br>
+++ include/clang/AST/ExprCXX.h<br>
@@ -145,6 +145,14 @@<br>
   /// FIXME: Returns 0 for member pointer call exprs.<br>
   CXXRecordDecl *getRecordDecl() const;<br>
<br>
+  SourceLocation getExprLoc() const LLVM_READONLY {<br>
+    SourceLocation CLoc = getCallee()->getExprLoc();<br>
+    if (CLoc.isValid())<br>
+      return CLoc;<br>
+<br>
+    return getLocStart();<br>
+  }<br>
+<br>
   static bool classof(const Stmt *T) {<br>
     return T->getStmtClass() == CXXMemberCallExprClass;<br>
   }<br>
<br>
<br>
<br>_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><br>
<br></blockquote></div><br></div>