diff options
| author | Fangrui Song <i@maskray.me> | 2025-06-20 20:13:04 -0700 |
|---|---|---|
| committer | Fangrui Song <i@maskray.me> | 2025-06-20 20:13:04 -0700 |
| commit | 95fbfc9be5d2842a945c04a20fe6244df9b10e18 (patch) | |
| tree | 00f80558d11aa5805e6d6f290663c6da44e5e6ef /clang/lib/Serialization/ASTReader.cpp | |
| parent | a9ba028b98ffd53d9c7d00ca7563d74810fcf6e7 (diff) | |
| parent | 17e8465a3eb0cae48b9f62d27fd26f2b070f1f9b (diff) | |
[𝘀𝗽𝗿] changes introduced through rebaseusers/MaskRay/spr/main.move-relocation-specifier-constants-to-aarch64
Created using spr 1.3.5-bogner
[skip ci]
Diffstat (limited to 'clang/lib/Serialization/ASTReader.cpp')
| -rw-r--r-- | clang/lib/Serialization/ASTReader.cpp | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp index acda5a7c879d..a3fbc3d25aca 100644 --- a/clang/lib/Serialization/ASTReader.cpp +++ b/clang/lib/Serialization/ASTReader.cpp @@ -4097,8 +4097,8 @@ llvm::Error ASTReader::ReadASTBlock(ModuleFile &F, uint64_t TULocalOffset = TULocalLocalOffset ? BaseOffset + TULocalLocalOffset : 0; - DelayedNamespaceOffsetMap[ID] = {LexicalOffset, VisibleOffset, - ModuleLocalOffset, TULocalOffset}; + DelayedNamespaceOffsetMap[ID] = { + {VisibleOffset, TULocalOffset, ModuleLocalOffset}, LexicalOffset}; assert(!GetExistingDecl(ID) && "We shouldn't load the namespace in the front of delayed " @@ -8544,17 +8544,21 @@ bool ASTReader::FindExternalVisibleDeclsByName(const DeclContext *DC, SmallVector<NamedDecl *, 64> Decls; llvm::SmallPtrSet<NamedDecl *, 8> Found; + auto Find = [&, this](auto &&Table, auto &&Key) { + for (GlobalDeclID ID : Table.find(Key)) { + NamedDecl *ND = cast<NamedDecl>(GetDecl(ID)); + if (ND->getDeclName() == Name && Found.insert(ND).second) + Decls.push_back(ND); + } + }; + Deserializing LookupResults(this); // FIXME: Clear the redundancy with templated lambda in C++20 when that's // available. if (auto It = Lookups.find(DC); It != Lookups.end()) { ++NumVisibleDeclContextsRead; - for (GlobalDeclID ID : It->second.Table.find(Name)) { - NamedDecl *ND = cast<NamedDecl>(GetDecl(ID)); - if (ND->getDeclName() == Name && Found.insert(ND).second) - Decls.push_back(ND); - } + Find(It->second.Table, Name); } if (auto *NamedModule = @@ -8562,21 +8566,13 @@ bool ASTReader::FindExternalVisibleDeclsByName(const DeclContext *DC, : nullptr) { if (auto It = ModuleLocalLookups.find(DC); It != ModuleLocalLookups.end()) { ++NumModuleLocalVisibleDeclContexts; - for (GlobalDeclID ID : It->second.Table.find({Name, NamedModule})) { - NamedDecl *ND = cast<NamedDecl>(GetDecl(ID)); - if (ND->getDeclName() == Name && Found.insert(ND).second) - Decls.push_back(ND); - } + Find(It->second.Table, std::make_pair(Name, NamedModule)); } } if (auto It = TULocalLookups.find(DC); It != TULocalLookups.end()) { ++NumTULocalVisibleDeclContexts; - for (GlobalDeclID ID : It->second.Table.find(Name)) { - NamedDecl *ND = cast<NamedDecl>(GetDecl(ID)); - if (ND->getDeclName() == Name && Found.insert(ND).second) - Decls.push_back(ND); - } + Find(It->second.Table, Name); } SetExternalVisibleDeclsForName(DC, Name, Decls); |
