From 42070a5c092ed420bf92ebf38229c594885e94c7 Mon Sep 17 00:00:00 2001 From: Chuanqi Xu Date: Thu, 25 Apr 2024 11:43:13 +0800 Subject: [NFC] [Serialization] Avoid using DeclID directly as much as possible This patch tries to remove all the direct use of DeclID except the real low level reading and writing. All the use of DeclID is converted to the use of LocalDeclID or GlobalDeclID. This is helpful to increase the readability and type safety. --- clang/lib/AST/DeclBase.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'clang/lib/AST/DeclBase.cpp') diff --git a/clang/lib/AST/DeclBase.cpp b/clang/lib/AST/DeclBase.cpp index a2d88cf..c33babf 100644 --- a/clang/lib/AST/DeclBase.cpp +++ b/clang/lib/AST/DeclBase.cpp @@ -70,8 +70,8 @@ void Decl::updateOutOfDate(IdentifierInfo &II) const { #define ABSTRACT_DECL(DECL) #include "clang/AST/DeclNodes.inc" -void *Decl::operator new(std::size_t Size, const ASTContext &Context, DeclID ID, - std::size_t Extra) { +void *Decl::operator new(std::size_t Size, const ASTContext &Context, + GlobalDeclID ID, std::size_t Extra) { // Allocate an extra 8 bytes worth of storage, which ensures that the // resulting pointer will still be 8-byte aligned. static_assert(sizeof(unsigned) * 2 >= alignof(Decl), @@ -85,7 +85,7 @@ void *Decl::operator new(std::size_t Size, const ASTContext &Context, DeclID ID, PrefixPtr[0] = 0; // Store the global declaration ID in the second 4 bytes. - PrefixPtr[1] = ID; + PrefixPtr[1] = ID.get(); return Result; } -- cgit v1.1