aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Frontend/ASTUnit.cpp
diff options
context:
space:
mode:
authorChuanqi Xu <yedeng.yd@linux.alibaba.com>2024-06-19 10:48:55 +0800
committerChuanqi Xu <yedeng.yd@linux.alibaba.com>2024-06-19 15:18:01 +0800
commit8af86025af2456c70c84aec309cca9a069124671 (patch)
tree3285990755693760253dcd69ca353addb9f17048 /clang/lib/Frontend/ASTUnit.cpp
parent891ec2af45c02718c65f539cb6dad1758f079e73 (diff)
downloadllvm-8af86025af2456c70c84aec309cca9a069124671.zip
llvm-8af86025af2456c70c84aec309cca9a069124671.tar.gz
llvm-8af86025af2456c70c84aec309cca9a069124671.tar.bz2
[NFC] [Serialization] Unify how LocalDeclID can be created
Now we can create a LocalDeclID directly with an integer without verifying. It may be hard to refactor if we want to change the way we serialize DeclIDs (See https://github.com/llvm/llvm-project/pull/95897). Also it is hard for us to debug if someday someone construct a LocalDeclID with an incorrect value. So in this patch, I tried to unify the way we can construct a LocalDeclID in ASTReader, where we will construct the LocalDeclID from the serialized data. Also, now we can verify the constructed LocalDeclID sooner in the new interface.
Diffstat (limited to 'clang/lib/Frontend/ASTUnit.cpp')
-rw-r--r--clang/lib/Frontend/ASTUnit.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/lib/Frontend/ASTUnit.cpp b/clang/lib/Frontend/ASTUnit.cpp
index 8d24d5d..67d4c07 100644
--- a/clang/lib/Frontend/ASTUnit.cpp
+++ b/clang/lib/Frontend/ASTUnit.cpp
@@ -1473,7 +1473,7 @@ void ASTUnit::RealizeTopLevelDeclsFromPreamble() {
for (const auto TopLevelDecl : TopLevelDeclsInPreamble) {
// Resolve the declaration ID to an actual declaration, possibly
// deserializing the declaration in the process.
- if (Decl *D = Reader->GetDecl(Reader->getGlobalDeclID(MF, TopLevelDecl)))
+ if (Decl *D = Reader->GetLocalDecl(MF, TopLevelDecl))
Resolved.push_back(D);
}
TopLevelDeclsInPreamble.clear();