<div dir="ltr">Could you take a look of r270841 in clang-tools-extra? </div><br><div class="gmail_quote"><div dir="ltr">On Thu, May 26, 2016 at 7:14 AM Hal Finkel via cfe-commits <<a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: hfinkel<br>
Date: Wed May 25 17:08:27 2016<br>
New Revision: 270775<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=270775&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=270775&view=rev</a><br>
Log:<br>
[CGDebugInfo] Modify the preferred expression location for member calls.<br>
<br>
If the callee has a valid location (not all do), then use that. Otherwise, fall<br>
back to the starting location. This makes sure that the debug info for calls<br>
points to the call (not the start of the expression providing the object on<br>
which the member function is being called).<br>
<br>
For example, given this:<br>
<br>
f->foo()->bar();<br>
<br>
we don't want both calls to point to the 'f', but rather to the 'foo()' and<br>
the 'bar()'.<br>
<br>
Fixes PR27567.<br>
<br>
Differential Revision: <a href="http://reviews.llvm.org/D19708" rel="noreferrer" target="_blank">http://reviews.llvm.org/D19708</a><br>
<br>
Added:<br>
cfe/trunk/test/CodeGenCXX/debug-info-member-call.cpp<br>
Modified:<br>
cfe/trunk/include/clang/AST/ExprCXX.h<br>
<br>
Modified: cfe/trunk/include/clang/AST/ExprCXX.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ExprCXX.h?rev=270775&r1=270774&r2=270775&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ExprCXX.h?rev=270775&r1=270774&r2=270775&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/include/clang/AST/ExprCXX.h (original)<br>
+++ cfe/trunk/include/clang/AST/ExprCXX.h Wed May 25 17:08:27 2016<br>
@@ -143,6 +143,14 @@ public:<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>
Added: cfe/trunk/test/CodeGenCXX/debug-info-member-call.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-member-call.cpp?rev=270775&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-info-member-call.cpp?rev=270775&view=auto</a><br>
==============================================================================<br>
--- cfe/trunk/test/CodeGenCXX/debug-info-member-call.cpp (added)<br>
+++ cfe/trunk/test/CodeGenCXX/debug-info-member-call.cpp Wed May 25 17:08:27 2016<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>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">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>
</blockquote></div>