[clang] 536b76e - [NFC] [serialization] Refactor the outdated AbrrevToUse of VarDecl

Chuanqi Xu via cfe-commits cfe-commits at lists.llvm.org
Tue May 30 00:10:06 PDT 2023


Author: Chuanqi Xu
Date: 2023-05-30T15:07:35+08:00
New Revision: 536b76e873c56994a7dc611a6081a7a79e9fb526

URL: https://github.com/llvm/llvm-project/commit/536b76e873c56994a7dc611a6081a7a79e9fb526
DIFF: https://github.com/llvm/llvm-project/commit/536b76e873c56994a7dc611a6081a7a79e9fb526.diff

LOG: [NFC] [serialization] Refactor the outdated AbrrevToUse of VarDecl

The implementation and the comment of the AbrrevToUse of VarDecl
looks not consistent with the implementation. This patch refactors it.

Added: 
    

Modified: 
    clang/lib/Serialization/ASTWriterDecl.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Serialization/ASTWriterDecl.cpp b/clang/lib/Serialization/ASTWriterDecl.cpp
index 54b5e3877782d..bd935472bcef4 100644
--- a/clang/lib/Serialization/ASTWriterDecl.cpp
+++ b/clang/lib/Serialization/ASTWriterDecl.cpp
@@ -1136,10 +1136,10 @@ void ASTDeclWriter::VisitVarDecl(VarDecl *D) {
       !D->isConstexpr() &&
       !D->isInitCapture() &&
       !D->isPreviousDeclInSameBlockScope() &&
-      !D->hasAttr<BlocksAttr>() &&
       !D->isEscapingByref() &&
       !HasDeducedType &&
       D->getStorageDuration() != SD_Static &&
+      !D->getDescribedVarTemplate() &&
       !D->getMemberSpecializationInfo())
     AbbrevToUse = Writer.getDeclVarAbbrev();
 
@@ -2244,8 +2244,8 @@ void ASTWriter::WriteDeclAbbrevs() {
   Abv->Add(BitCodeAbbrevOp(0));                       // InitStyle
   Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // isARCPseudoStrong
   Abv->Add(BitCodeAbbrevOp(0));                       // Linkage
-  Abv->Add(BitCodeAbbrevOp(0));                       // HasInit
-  Abv->Add(BitCodeAbbrevOp(0));                   // HasMemberSpecializationInfo
+  Abv->Add(BitCodeAbbrevOp(0));                       // ModulesCodegen
+  Abv->Add(BitCodeAbbrevOp(0));                       // VarKind (local enum)
   // ParmVarDecl
   Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); // IsObjCMethodParameter
   Abv->Add(BitCodeAbbrevOp(0));                       // ScopeDepth
@@ -2334,8 +2334,8 @@ void ASTWriter::WriteDeclAbbrevs() {
   Abv->Add(BitCodeAbbrevOp(0));                         // EscapingByref
   Abv->Add(BitCodeAbbrevOp(0));                         // HasDeducedType
   Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); // Linkage
-  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 3)); // HasConstant*
-  Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 2)); // VarKind (local enum)
+  Abv->Add(BitCodeAbbrevOp(0));                         // ModulesCodeGen
+  Abv->Add(BitCodeAbbrevOp(0));                         // VarKind (local enum)
   // Type Source Info
   Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Array));
   Abv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); // TypeLoc


        


More information about the cfe-commits mailing list