diff options
author | kadir çetinkaya <kadircet@google.com> | 2023-10-18 10:51:31 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-18 10:51:31 +0200 |
commit | 48a53509e851c93f352c967da1feb1c8fb2abd9a (patch) | |
tree | 613209c425cdac49e7b835657ce06b1afcd65005 /clang/test/Index | |
parent | 8c369eb4965a1799960872cd65e85b284b97784c (diff) | |
download | llvm-48a53509e851c93f352c967da1feb1c8fb2abd9a.zip llvm-48a53509e851c93f352c967da1feb1c8fb2abd9a.tar.gz llvm-48a53509e851c93f352c967da1feb1c8fb2abd9a.tar.bz2 |
[clang][USR] Encode full decl-context also for anon namespaces (#68325)
Otherwise we create collisions, e.g. a struct named Foo inside an
anonymous
namespace will get the same USR no matter what the surrounding
decl-context is.
Diffstat (limited to 'clang/test/Index')
-rw-r--r-- | clang/test/Index/USR/decl-context.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/clang/test/Index/USR/decl-context.cpp b/clang/test/Index/USR/decl-context.cpp new file mode 100644 index 0000000..a57137a --- /dev/null +++ b/clang/test/Index/USR/decl-context.cpp @@ -0,0 +1,14 @@ +// RUN: c-index-test core -print-source-symbols -- -std=c++20 %s | FileCheck %s + +namespace ns { +namespace { +struct Foo {}; +// CHECK: [[@LINE-1]]:8 | struct/C | Foo | c:decl-context.cpp@N@ns@aN@S@Foo +} +} +namespace ns2 { +namespace { +struct Foo {}; +// CHECK: [[@LINE-1]]:8 | struct/C | Foo | c:decl-context.cpp@N@ns2@aN@S@Foo +} +} |