summaryrefslogtreecommitdiffstats
path: root/clang/lib/Index
diff options
context:
space:
mode:
authorFangrui Song <maskray@google.com>2018-10-09 01:02:56 +0000
committerFangrui Song <maskray@google.com>2018-10-09 01:02:56 +0000
commit63a8b6c3046d2aaa83f1410c32771e7eb21e7a6c (patch)
tree369842da4afd9a33113f87937700ec7b0cf5050e /clang/lib/Index
parent03128d62b85a737ae6005a226693d472192a740f (diff)
downloadbcm5719-llvm-63a8b6c3046d2aaa83f1410c32771e7eb21e7a6c.tar.gz
bcm5719-llvm-63a8b6c3046d2aaa83f1410c32771e7eb21e7a6c.zip
[Index] Use locations to uniquify function-scope BindingDecl USR
Summary: This makes BindingDecl's of the same name have different USRs, so that references can be correctly attributed. int a[1] = {}; { auto [x] = a; x; } { auto [x] = a; x; } Reviewers: akyrtzi, arphaman, rsmith, hokein Reviewed By: hokein Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D52445 llvm-svn: 344010
Diffstat (limited to 'clang/lib/Index')
-rw-r--r--clang/lib/Index/USRGeneration.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/clang/lib/Index/USRGeneration.cpp b/clang/lib/Index/USRGeneration.cpp
index 8194c9508fb..f7be0a90b0a 100644
--- a/clang/lib/Index/USRGeneration.cpp
+++ b/clang/lib/Index/USRGeneration.cpp
@@ -97,6 +97,7 @@ public:
void VisitTypedefDecl(const TypedefDecl *D);
void VisitTemplateTypeParmDecl(const TemplateTypeParmDecl *D);
void VisitVarDecl(const VarDecl *D);
+ void VisitBindingDecl(const BindingDecl *D);
void VisitNonTypeTemplateParmDecl(const NonTypeTemplateParmDecl *D);
void VisitTemplateTemplateParmDecl(const TemplateTemplateParmDecl *D);
void VisitUnresolvedUsingValueDecl(const UnresolvedUsingValueDecl *D);
@@ -334,6 +335,12 @@ void USRGenerator::VisitVarDecl(const VarDecl *D) {
}
}
+void USRGenerator::VisitBindingDecl(const BindingDecl *D) {
+ if (isLocal(D) && GenLoc(D, /*IncludeOffset=*/true))
+ return;
+ VisitNamedDecl(D);
+}
+
void USRGenerator::VisitNonTypeTemplateParmDecl(
const NonTypeTemplateParmDecl *D) {
GenLoc(D, /*IncludeOffset=*/true);
OpenPOWER on IntegriCloud