[cfe-commits] r169647 - in /cfe/trunk: test/Index/usrs.cpp tools/libclang/CIndexUSRs.cpp
Argyrios Kyrtzidis
akyrtzi at gmail.com
Fri Dec 7 14:41:46 PST 2012
Author: akirtzidis
Date: Fri Dec 7 16:41:46 2012
New Revision: 169647
URL: http://llvm.org/viewvc/llvm-project?rev=169647&view=rev
Log:
[libclang] Declarations inside anonymous namespaces have internal linkage so
their USR should contain a location.
This uniques them from other declarations with the same name but in different translation units.
rdar://10546541
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=169647&r1=169646&r2=169647&view=diff
==============================================================================
--- cfe/trunk/test/Index/usrs.cpp (original)
+++ cfe/trunk/test/Index/usrs.cpp Fri Dec 7 16:41:46 2012
@@ -101,8 +101,8 @@
// CHECK: usrs.cpp c:@N at foo@C at ClsB@F at ClsB# Extent=[19:5 - 19:27]
// CHECK: usrs.cpp c:@N at foo@C at ClsB@F at result#1 Extent=[20:5 - 20:23]
// CHECK: usrs.cpp c:@N at foo@C at ClsB@F at result#1 Extent=[24:1 - 26:2]
-// CHECK: usrs.cpp c:@aN at C@ClsC Extent=[29:3 - 29:35]
-// CHECK: usrs.cpp c:@aN at w Extent=[30:3 - 30:8]
+// CHECK: usrs.cpp c:usrs.cpp at 360@aN at C@ClsC Extent=[29:3 - 29:35]
+// CHECK: usrs.cpp c:usrs.cpp at 396@aN at w Extent=[30:3 - 30:8]
// CHECK: usrs.cpp c:@z Extent=[33:1 - 33:6]
// CHECK: usrs.cpp c:@N at foo Extent=[35:1 - 40:2]
// CHECK: usrs.cpp c:@N at foo@N at taz Extent=[35:17 - 39:2]
@@ -137,7 +137,7 @@
// 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:usrs.cpp at 1097@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]
Modified: cfe/trunk/tools/libclang/CIndexUSRs.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CIndexUSRs.cpp?rev=169647&r1=169646&r2=169647&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/CIndexUSRs.cpp (original)
+++ cfe/trunk/tools/libclang/CIndexUSRs.cpp Fri Dec 7 16:41:46 2012
@@ -151,14 +151,8 @@
return startSize == endSize;
}
-static bool InAnonymousNamespace(const Decl *D) {
- if (const NamespaceDecl *ND = dyn_cast<NamespaceDecl>(D->getDeclContext()))
- return ND->isAnonymousNamespace();
- return false;
-}
-
static inline bool ShouldGenerateLocation(const NamedDecl *D) {
- return D->getLinkage() != ExternalLinkage && !InAnonymousNamespace(D);
+ return D->getLinkage() != ExternalLinkage;
}
void USRGenerator::VisitDeclContext(DeclContext *DC) {
More information about the cfe-commits
mailing list