diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2012-12-07 22:41:46 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2012-12-07 22:41:46 +0000 |
commit | e1c2c2023ee160bd3051682faff04c4f9c5e8ebd (patch) | |
tree | 95e465cec02135139802e06ec86badb167bb05bf | |
parent | 60c4612d70229d1d079deaec62c7c8613070fbff (diff) |
[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
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169647 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | test/Index/usrs.cpp | 6 | ||||
-rw-r--r-- | tools/libclang/CIndexUSRs.cpp | 8 |
2 files changed, 4 insertions, 10 deletions
diff --git a/test/Index/usrs.cpp b/test/Index/usrs.cpp index 023818c591..e350f5cedf 100644 --- a/test/Index/usrs.cpp +++ b/test/Index/usrs.cpp @@ -101,8 +101,8 @@ void rdar9371763() { // CHECK: usrs.cpp c:@N@foo@C@ClsB@F@ClsB# Extent=[19:5 - 19:27] // CHECK: usrs.cpp c:@N@foo@C@ClsB@F@result#1 Extent=[20:5 - 20:23] // CHECK: usrs.cpp c:@N@foo@C@ClsB@F@result#1 Extent=[24:1 - 26:2] -// CHECK: usrs.cpp c:@aN@C@ClsC Extent=[29:3 - 29:35] -// CHECK: usrs.cpp c:@aN@w Extent=[30:3 - 30:8] +// CHECK: usrs.cpp c:usrs.cpp@360@aN@C@ClsC Extent=[29:3 - 29:35] +// CHECK: usrs.cpp c:usrs.cpp@396@aN@w Extent=[30:3 - 30:8] // CHECK: usrs.cpp c:@z Extent=[33:1 - 33:6] // CHECK: usrs.cpp c:@N@foo Extent=[35:1 - 40:2] // CHECK: usrs.cpp c:@N@foo@N@taz Extent=[35:17 - 39:2] @@ -137,7 +137,7 @@ void rdar9371763() { // CHECK-NOT: ClsB // CHECK: usrs.cpp c:@NA@foo_alias3 // CHECK: usrs.cpp c:@aN Extent=[68:1 - 73:2] -// CHECK: usrs.cpp c:@aN@C@RDar9371763_Foo Extent=[69:1 - 72:2] +// CHECK: usrs.cpp c:usrs.cpp@1097@aN@C@RDar9371763_Foo Extent=[69:1 - 72:2] // CHECK: usrs.cpp c: Extent=[70:1 - 70:8] // CHECK: usrs.cpp c:usrs.cpp@1131@aN@C@RDar9371763_Foo@F@bar# Extent=[71:3 - 71:13] // CHECK: usrs.cpp c:usrs.cpp@1131@aN@C@RDar9371763_Foo@F@bar# Extent=[75:1 - 75:31] diff --git a/tools/libclang/CIndexUSRs.cpp b/tools/libclang/CIndexUSRs.cpp index 6140032729..b76363e324 100644 --- a/tools/libclang/CIndexUSRs.cpp +++ b/tools/libclang/CIndexUSRs.cpp @@ -151,14 +151,8 @@ bool USRGenerator::EmitDeclName(const NamedDecl *D) { 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) { |