[cfe-commits] r130748 - in /cfe/trunk: test/Index/usrs.cpp tools/libclang/CIndexUSRs.cpp

Ted Kremenek kremenek at apple.com
Mon May 2 18:33:35 PDT 2011


Author: kremenek
Date: Mon May  2 20:33:35 2011
New Revision: 130748

URL: http://llvm.org/viewvc/llvm-project?rev=130748&view=rev
Log:
Use the canonical decl when generating the locations for USRs.

Modified:
    cfe/trunk/test/Index/usrs.cpp
    cfe/trunk/tools/libclang/CIndexUSRs.cpp

Modified: cfe/trunk/test/Index/usrs.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/usrs.cpp?rev=130748&r1=130747&r2=130748&view=diff
==============================================================================
--- cfe/trunk/test/Index/usrs.cpp (original)
+++ cfe/trunk/test/Index/usrs.cpp Mon May  2 20:33:35 2011
@@ -65,6 +65,20 @@
 
 namespace foo_alias3 = foo;
 
+namespace {
+class RDar9371763_Foo {
+public:
+  void bar();
+};
+}
+
+void RDar9371763_Foo::bar() {}
+
+void rdar9371763() {
+  RDar9371763_Foo foo;
+  foo.bar();
+}
+
 // RUN: c-index-test -test-load-source-usrs all %s | FileCheck %s
 // CHECK: usrs.cpp c:@N at foo Extent=[1:1 - 4:2]
 // CHECK: usrs.cpp c:@N at foo@x Extent=[2:3 - 2:8]
@@ -122,3 +136,11 @@
 // CHECK: usrs.cpp c:@NA at foo_alias2
 // CHECK-NOT: ClsB
 // CHECK: usrs.cpp c:@NA at foo_alias3
+// CHECK: usrs.cpp c:@aN Extent=[68:1 - 73:2]
+// CHECK: usrs.cpp c:@aN at C@RDar9371763_Foo Extent=[69:1 - 72:2]
+// CHECK: usrs.cpp c: Extent=[70:1 - 70:8]
+// CHECK: usrs.cpp c:usrs.cpp at 1131@aN at C@RDar9371763_Foo at F@bar# Extent=[71:3 - 71:13]
+// CHECK: usrs.cpp c:usrs.cpp at 1131@aN at C@RDar9371763_Foo at F@bar# Extent=[75:1 - 75:31]
+// CHECK: usrs.cpp c:@F at rdar9371763# Extent=[77:1 - 80:2]
+// CHECK: usrs.cpp c:usrs.cpp at 1204@F at rdar9371763#@foo Extent=[78:3 - 78:22]
+

Modified: cfe/trunk/tools/libclang/CIndexUSRs.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CIndexUSRs.cpp?rev=130748&r1=130747&r2=130748&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/CIndexUSRs.cpp (original)
+++ cfe/trunk/tools/libclang/CIndexUSRs.cpp Mon May  2 20:33:35 2011
@@ -477,6 +477,9 @@
     return true;
   }
 
+  // Use the location of canonical decl.
+  D = D->getCanonicalDecl();
+
   const SourceManager &SM = AU->getSourceManager();
   SourceLocation L = D->getLocStart();
   if (L.isInvalid()) {





More information about the cfe-commits mailing list