diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2021-07-29 20:15:26 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2021-07-29 20:15:26 +0000 |
commit | 344a3780b2e33f6ca763666c380202b18aab72a3 (patch) | |
tree | f0b203ee6eb71d7fdd792373e3c81eb18d6934dd /clang/lib/AST/ASTImporterLookupTable.cpp | |
parent | b60736ec1405bb0a8dd40989f67ef4c93da068ab (diff) | |
download | src-344a3780b2e33f6ca763666c380202b18aab72a3.tar.gz src-344a3780b2e33f6ca763666c380202b18aab72a3.zip |
Vendor import of llvm-project main 88e66fa60ae5, the last commit beforevendor/llvm-project/llvmorg-13-init-16847-g88e66fa60ae5vendor/llvm-project/llvmorg-12.0.1-rc2-0-ge7dac564cd0evendor/llvm-project/llvmorg-12.0.1-0-gfed41342a82f
the upstream release/13.x branch was created.
Diffstat (limited to 'clang/lib/AST/ASTImporterLookupTable.cpp')
-rw-r--r-- | clang/lib/AST/ASTImporterLookupTable.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/clang/lib/AST/ASTImporterLookupTable.cpp b/clang/lib/AST/ASTImporterLookupTable.cpp index e17d6082dcdc..b78cc0c053f6 100644 --- a/clang/lib/AST/ASTImporterLookupTable.cpp +++ b/clang/lib/AST/ASTImporterLookupTable.cpp @@ -117,6 +117,19 @@ void ASTImporterLookupTable::remove(NamedDecl *ND) { remove(ReDC, ND); } +void ASTImporterLookupTable::update(NamedDecl *ND, DeclContext *OldDC) { + assert(OldDC != ND->getDeclContext() && + "DeclContext should be changed before update"); + if (contains(ND->getDeclContext(), ND)) { + assert(!contains(OldDC, ND) && + "Decl should not be found in the old context if already in the new"); + return; + } + + remove(OldDC, ND); + add(ND); +} + ASTImporterLookupTable::LookupResult ASTImporterLookupTable::lookup(DeclContext *DC, DeclarationName Name) const { auto DCI = LookupTable.find(DC->getPrimaryContext()); @@ -131,6 +144,10 @@ ASTImporterLookupTable::lookup(DeclContext *DC, DeclarationName Name) const { return NamesI->second; } +bool ASTImporterLookupTable::contains(DeclContext *DC, NamedDecl *ND) const { + return 0 < lookup(DC, ND->getDeclName()).count(ND); +} + void ASTImporterLookupTable::dump(DeclContext *DC) const { auto DCI = LookupTable.find(DC->getPrimaryContext()); if (DCI == LookupTable.end()) |