diff options
author | Fangrui Song <maskray@google.com> | 2018-10-09 01:02:56 +0000 |
---|---|---|
committer | Fangrui Song <maskray@google.com> | 2018-10-09 01:02:56 +0000 |
commit | 63a8b6c3046d2aaa83f1410c32771e7eb21e7a6c (patch) | |
tree | 369842da4afd9a33113f87937700ec7b0cf5050e /clang/lib/Index | |
parent | 03128d62b85a737ae6005a226693d472192a740f (diff) | |
download | bcm5719-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.cpp | 7 |
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); |