[clang] 38a2f08 - Revert "[NFC] [Serialization] Add static assert for the size of the decls to"
Chuanqi Xu via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 18 18:38:14 PST 2023
Author: Chuanqi Xu
Date: 2023-01-19T10:37:48+08:00
New Revision: 38a2f089b48103922e3ff6c363032704ce52c08e
URL: https://github.com/llvm/llvm-project/commit/38a2f089b48103922e3ff6c363032704ce52c08e
DIFF: https://github.com/llvm/llvm-project/commit/38a2f089b48103922e3ff6c363032704ce52c08e.diff
LOG: Revert "[NFC] [Serialization] Add static assert for the size of the decls to"
This reverts commit c79635cce845d66897970cd7f8d7c77b0a3c0286. Since I
forgot the case for 32-bit machine.
Added:
Modified:
clang/include/clang/AST/DeclBase.h
clang/lib/Serialization/ASTWriter.cpp
clang/lib/Serialization/ASTWriterDecl.cpp
Removed:
################################################################################
diff --git a/clang/include/clang/AST/DeclBase.h b/clang/include/clang/AST/DeclBase.h
index d4e4fa48e5da3..8a5f75573095b 100644
--- a/clang/include/clang/AST/DeclBase.h
+++ b/clang/include/clang/AST/DeclBase.h
@@ -1389,8 +1389,6 @@ class DeclContextLookupResult {
class DeclContext {
/// For makeDeclVisibleInContextImpl
friend class ASTDeclReader;
- /// For checking the new bits in the Serialization part.
- friend class ASTDeclWriter;
/// For reconcileExternalVisibleStorage, CreateStoredDeclsMap,
/// hasNeedToReconcileExternalVisibleStorage
friend class ExternalASTSource;
diff --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp
index 1813529373ff2..43a74cdb5a5b7 100644
--- a/clang/lib/Serialization/ASTWriter.cpp
+++ b/clang/lib/Serialization/ASTWriter.cpp
@@ -5899,11 +5899,6 @@ void ASTRecordWriter::AddCXXCtorInitializers(
}
void ASTRecordWriter::AddCXXDefinitionData(const CXXRecordDecl *D) {
- static_assert(sizeof(decltype(D->data())) == 104 &&
- sizeof(CXXRecordDecl::LambdaDefinitionData) == 144,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
auto &Data = D->data();
Record->push_back(Data.IsLambda);
diff --git a/clang/lib/Serialization/ASTWriterDecl.cpp b/clang/lib/Serialization/ASTWriterDecl.cpp
index 1b44ac9d59caf..ca59dd69f4fd5 100644
--- a/clang/lib/Serialization/ASTWriterDecl.cpp
+++ b/clang/lib/Serialization/ASTWriterDecl.cpp
@@ -300,9 +300,6 @@ void ASTDeclWriter::Visit(Decl *D) {
}
void ASTDeclWriter::VisitDecl(Decl *D) {
- static_assert(sizeof(Decl) == 40, "You need to update the serializer after "
- "you change the fields of Decls.");
-
Record.AddDeclRef(cast_or_null<Decl>(D->getDeclContext()));
if (D->getDeclContext() != D->getLexicalDeclContext())
Record.AddDeclRef(cast_or_null<Decl>(D->getLexicalDeclContext()));
@@ -342,10 +339,6 @@ void ASTDeclWriter::VisitDecl(Decl *D) {
}
void ASTDeclWriter::VisitPragmaCommentDecl(PragmaCommentDecl *D) {
- static_assert(sizeof(PragmaCommentDecl) == 40,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
StringRef Arg = D->getArg();
Record.push_back(Arg.size());
VisitDecl(D);
@@ -357,10 +350,6 @@ void ASTDeclWriter::VisitPragmaCommentDecl(PragmaCommentDecl *D) {
void ASTDeclWriter::VisitPragmaDetectMismatchDecl(
PragmaDetectMismatchDecl *D) {
- static_assert(sizeof(PragmaDetectMismatchDecl) == 48,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
StringRef Name = D->getName();
StringRef Value = D->getValue();
Record.push_back(Name.size() + 1 + Value.size());
@@ -376,10 +365,6 @@ void ASTDeclWriter::VisitTranslationUnitDecl(TranslationUnitDecl *D) {
}
void ASTDeclWriter::VisitNamedDecl(NamedDecl *D) {
- static_assert(sizeof(NamedDecl) == 48,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
VisitDecl(D);
Record.AddDeclarationName(D->getDeclName());
Record.push_back(needsAnonymousDeclarationNumber(D)
@@ -388,20 +373,12 @@ void ASTDeclWriter::VisitNamedDecl(NamedDecl *D) {
}
void ASTDeclWriter::VisitTypeDecl(TypeDecl *D) {
- static_assert(sizeof(TypeDecl) == 64,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
VisitNamedDecl(D);
Record.AddSourceLocation(D->getBeginLoc());
Record.AddTypeRef(QualType(D->getTypeForDecl(), 0));
}
void ASTDeclWriter::VisitTypedefNameDecl(TypedefNameDecl *D) {
- static_assert(sizeof(TypedefNameDecl) == 88,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
VisitRedeclarable(D);
VisitTypeDecl(D);
Record.AddTypeSourceInfo(D->getTypeSourceInfo());
@@ -412,10 +389,6 @@ void ASTDeclWriter::VisitTypedefNameDecl(TypedefNameDecl *D) {
}
void ASTDeclWriter::VisitTypedefDecl(TypedefDecl *D) {
- static_assert(sizeof(TypedefDecl) == 88,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
VisitTypedefNameDecl(D);
if (D->getDeclContext() == D->getLexicalDeclContext() &&
!D->hasAttrs() &&
@@ -432,20 +405,12 @@ void ASTDeclWriter::VisitTypedefDecl(TypedefDecl *D) {
}
void ASTDeclWriter::VisitTypeAliasDecl(TypeAliasDecl *D) {
- static_assert(sizeof(TypeAliasDecl) == 96,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
VisitTypedefNameDecl(D);
Record.AddDeclRef(D->getDescribedAliasTemplate());
Code = serialization::DECL_TYPEALIAS;
}
void ASTDeclWriter::VisitTagDecl(TagDecl *D) {
- static_assert(DeclContext::NumTagDeclBits == 10 && sizeof(TagDecl) == 128,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
VisitRedeclarable(D);
VisitTypeDecl(D);
Record.push_back(D->getIdentifierNamespace());
@@ -470,10 +435,6 @@ void ASTDeclWriter::VisitTagDecl(TagDecl *D) {
}
void ASTDeclWriter::VisitEnumDecl(EnumDecl *D) {
- static_assert(DeclContext::NumEnumDeclBits == 20 && sizeof(EnumDecl) == 160,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
VisitTagDecl(D);
Record.AddTypeSourceInfo(D->getIntegerTypeSourceInfo());
if (!D->getIntegerTypeSourceInfo())
@@ -517,11 +478,6 @@ void ASTDeclWriter::VisitEnumDecl(EnumDecl *D) {
}
void ASTDeclWriter::VisitRecordDecl(RecordDecl *D) {
- static_assert(DeclContext::NumRecordDeclBits == 15 &&
- sizeof(RecordDecl) == 128,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
VisitTagDecl(D);
Record.push_back(D->hasFlexibleArrayMember());
Record.push_back(D->isAnonymousStructOrUnion());
@@ -557,19 +513,11 @@ void ASTDeclWriter::VisitRecordDecl(RecordDecl *D) {
}
void ASTDeclWriter::VisitValueDecl(ValueDecl *D) {
- static_assert(sizeof(ValueDecl) == 56,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
VisitNamedDecl(D);
Record.AddTypeRef(D->getType());
}
void ASTDeclWriter::VisitEnumConstantDecl(EnumConstantDecl *D) {
- static_assert(sizeof(EnumConstantDecl) == 80,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
VisitValueDecl(D);
Record.push_back(D->getInitExpr()? 1 : 0);
if (D->getInitExpr())
@@ -580,10 +528,6 @@ void ASTDeclWriter::VisitEnumConstantDecl(EnumConstantDecl *D) {
}
void ASTDeclWriter::VisitDeclaratorDecl(DeclaratorDecl *D) {
- static_assert(sizeof(DeclaratorDecl) == 72,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
VisitValueDecl(D);
Record.AddSourceLocation(D->getInnerLocStart());
Record.push_back(D->hasExtInfo());
@@ -598,11 +542,6 @@ void ASTDeclWriter::VisitDeclaratorDecl(DeclaratorDecl *D) {
}
void ASTDeclWriter::VisitFunctionDecl(FunctionDecl *D) {
- static_assert(DeclContext::NumFunctionDeclBits == 29 &&
- sizeof(FunctionDecl) == 168,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
VisitRedeclarable(D);
Record.push_back(D->getTemplatedKind());
@@ -746,10 +685,6 @@ static void addExplicitSpecifier(ExplicitSpecifier ES,
}
void ASTDeclWriter::VisitCXXDeductionGuideDecl(CXXDeductionGuideDecl *D) {
- static_assert(sizeof(CXXDeductionGuideDecl) == 184,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
addExplicitSpecifier(D->getExplicitSpecifier(), Record);
Record.AddDeclRef(D->Ctor);
VisitFunctionDecl(D);
@@ -758,11 +693,6 @@ void ASTDeclWriter::VisitCXXDeductionGuideDecl(CXXDeductionGuideDecl *D) {
}
void ASTDeclWriter::VisitObjCMethodDecl(ObjCMethodDecl *D) {
- static_assert(DeclContext::NumObjCMethodDeclBits == 24 &&
- sizeof(ObjCMethodDecl) == 136,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
VisitNamedDecl(D);
// FIXME: convert to LazyStmtPtr?
// Unlike C/C++, method bodies will never be in header files.
@@ -811,10 +741,6 @@ void ASTDeclWriter::VisitObjCMethodDecl(ObjCMethodDecl *D) {
}
void ASTDeclWriter::VisitObjCTypeParamDecl(ObjCTypeParamDecl *D) {
- static_assert(sizeof(ObjCTypeParamDecl) == 104,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
VisitTypedefNameDecl(D);
Record.push_back(D->Variance);
Record.push_back(D->Index);
@@ -825,11 +751,6 @@ void ASTDeclWriter::VisitObjCTypeParamDecl(ObjCTypeParamDecl *D) {
}
void ASTDeclWriter::VisitObjCContainerDecl(ObjCContainerDecl *D) {
- static_assert(DeclContext::NumObjCContainerDeclBits == 51 &&
- sizeof(ObjCContainerDecl) == 88,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
VisitNamedDecl(D);
Record.AddSourceLocation(D->getAtStartLoc());
Record.AddSourceRange(D->getAtEndRange());
@@ -837,10 +758,6 @@ void ASTDeclWriter::VisitObjCContainerDecl(ObjCContainerDecl *D) {
}
void ASTDeclWriter::VisitObjCInterfaceDecl(ObjCInterfaceDecl *D) {
- static_assert(sizeof(ObjCInterfaceDecl) == 128,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
VisitRedeclarable(D);
VisitObjCContainerDecl(D);
Record.AddTypeRef(QualType(D->getTypeForDecl(), 0));
@@ -885,10 +802,6 @@ void ASTDeclWriter::VisitObjCInterfaceDecl(ObjCInterfaceDecl *D) {
}
void ASTDeclWriter::VisitObjCIvarDecl(ObjCIvarDecl *D) {
- static_assert(sizeof(ObjCIvarDecl) == 96,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
VisitFieldDecl(D);
// FIXME: stable encoding for @public/@private/@protected/@package
Record.push_back(D->getAccessControl());
@@ -910,10 +823,6 @@ void ASTDeclWriter::VisitObjCIvarDecl(ObjCIvarDecl *D) {
}
void ASTDeclWriter::VisitObjCProtocolDecl(ObjCProtocolDecl *D) {
- static_assert(sizeof(ObjCProtocolDecl) == 112,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
VisitRedeclarable(D);
VisitObjCContainerDecl(D);
@@ -931,19 +840,11 @@ void ASTDeclWriter::VisitObjCProtocolDecl(ObjCProtocolDecl *D) {
}
void ASTDeclWriter::VisitObjCAtDefsFieldDecl(ObjCAtDefsFieldDecl *D) {
- static_assert(sizeof(ObjCAtDefsFieldDecl) == 80,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
VisitFieldDecl(D);
Code = serialization::DECL_OBJC_AT_DEFS_FIELD;
}
void ASTDeclWriter::VisitObjCCategoryDecl(ObjCCategoryDecl *D) {
- static_assert(sizeof(ObjCCategoryDecl) == 152,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
VisitObjCContainerDecl(D);
Record.AddSourceLocation(D->getCategoryNameLoc());
Record.AddSourceLocation(D->getIvarLBraceLoc());
@@ -959,20 +860,12 @@ void ASTDeclWriter::VisitObjCCategoryDecl(ObjCCategoryDecl *D) {
}
void ASTDeclWriter::VisitObjCCompatibleAliasDecl(ObjCCompatibleAliasDecl *D) {
- static_assert(sizeof(ObjCCompatibleAliasDecl) == 56,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
VisitNamedDecl(D);
Record.AddDeclRef(D->getClassInterface());
Code = serialization::DECL_OBJC_COMPATIBLE_ALIAS;
}
void ASTDeclWriter::VisitObjCPropertyDecl(ObjCPropertyDecl *D) {
- static_assert(sizeof(ObjCPropertyDecl) == 128,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
VisitNamedDecl(D);
Record.AddSourceLocation(D->getAtLoc());
Record.AddSourceLocation(D->getLParenLoc());
@@ -994,30 +887,18 @@ void ASTDeclWriter::VisitObjCPropertyDecl(ObjCPropertyDecl *D) {
}
void ASTDeclWriter::VisitObjCImplDecl(ObjCImplDecl *D) {
- static_assert(sizeof(ObjCImplDecl) == 96,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
VisitObjCContainerDecl(D);
Record.AddDeclRef(D->getClassInterface());
// Abstract class (no need to define a stable serialization::DECL code).
}
void ASTDeclWriter::VisitObjCCategoryImplDecl(ObjCCategoryImplDecl *D) {
- static_assert(sizeof(ObjCCategoryImplDecl) == 104,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
VisitObjCImplDecl(D);
Record.AddSourceLocation(D->getCategoryNameLoc());
Code = serialization::DECL_OBJC_CATEGORY_IMPL;
}
void ASTDeclWriter::VisitObjCImplementationDecl(ObjCImplementationDecl *D) {
- static_assert(sizeof(ObjCImplementationDecl) == 136,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
VisitObjCImplDecl(D);
Record.AddDeclRef(D->getSuperClass());
Record.AddSourceLocation(D->getSuperClassLoc());
@@ -1033,10 +914,6 @@ void ASTDeclWriter::VisitObjCImplementationDecl(ObjCImplementationDecl *D) {
}
void ASTDeclWriter::VisitObjCPropertyImplDecl(ObjCPropertyImplDecl *D) {
- static_assert(sizeof(ObjCPropertyImplDecl) == 96,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
VisitDecl(D);
Record.AddSourceLocation(D->getBeginLoc());
Record.AddDeclRef(D->getPropertyDecl());
@@ -1050,10 +927,6 @@ void ASTDeclWriter::VisitObjCPropertyImplDecl(ObjCPropertyImplDecl *D) {
}
void ASTDeclWriter::VisitFieldDecl(FieldDecl *D) {
- static_assert(sizeof(FieldDecl) == 80,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
VisitDeclaratorDecl(D);
Record.push_back(D->isMutable());
@@ -1090,10 +963,6 @@ void ASTDeclWriter::VisitFieldDecl(FieldDecl *D) {
}
void ASTDeclWriter::VisitMSPropertyDecl(MSPropertyDecl *D) {
- static_assert(sizeof(MSPropertyDecl) == 88,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
VisitDeclaratorDecl(D);
Record.AddIdentifierRef(D->getGetterId());
Record.AddIdentifierRef(D->getSetterId());
@@ -1101,10 +970,6 @@ void ASTDeclWriter::VisitMSPropertyDecl(MSPropertyDecl *D) {
}
void ASTDeclWriter::VisitMSGuidDecl(MSGuidDecl *D) {
- static_assert(sizeof(MSGuidDecl) == 152,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
VisitValueDecl(D);
MSGuidDecl::Parts Parts = D->getParts();
Record.push_back(Parts.Part1);
@@ -1116,30 +981,18 @@ void ASTDeclWriter::VisitMSGuidDecl(MSGuidDecl *D) {
void ASTDeclWriter::VisitUnnamedGlobalConstantDecl(
UnnamedGlobalConstantDecl *D) {
- static_assert(sizeof(UnnamedGlobalConstantDecl) == 136,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
VisitValueDecl(D);
Record.AddAPValue(D->getValue());
Code = serialization::DECL_UNNAMED_GLOBAL_CONSTANT;
}
void ASTDeclWriter::VisitTemplateParamObjectDecl(TemplateParamObjectDecl *D) {
- static_assert(sizeof(TemplateParamObjectDecl) == 136,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
VisitValueDecl(D);
Record.AddAPValue(D->getValue());
Code = serialization::DECL_TEMPLATE_PARAM_OBJECT;
}
void ASTDeclWriter::VisitIndirectFieldDecl(IndirectFieldDecl *D) {
- static_assert(sizeof(IndirectFieldDecl) == 72,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
VisitValueDecl(D);
Record.push_back(D->getChainingSize());
@@ -1149,10 +1002,6 @@ void ASTDeclWriter::VisitIndirectFieldDecl(IndirectFieldDecl *D) {
}
void ASTDeclWriter::VisitVarDecl(VarDecl *D) {
- static_assert(sizeof(VarDecl) == 104,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
VisitRedeclarable(D);
VisitDeclaratorDecl(D);
Record.push_back(D->getStorageClass());
@@ -1250,19 +1099,11 @@ void ASTDeclWriter::VisitVarDecl(VarDecl *D) {
}
void ASTDeclWriter::VisitImplicitParamDecl(ImplicitParamDecl *D) {
- static_assert(sizeof(ImplicitParamDecl) == 104,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
VisitVarDecl(D);
Code = serialization::DECL_IMPLICIT_PARAM;
}
void ASTDeclWriter::VisitParmVarDecl(ParmVarDecl *D) {
- static_assert(sizeof(ParmVarDecl) == 104,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
VisitVarDecl(D);
Record.push_back(D->isObjCMethodParameter());
Record.push_back(D->getFunctionScopeDepth());
@@ -1320,20 +1161,12 @@ void ASTDeclWriter::VisitDecompositionDecl(DecompositionDecl *D) {
}
void ASTDeclWriter::VisitBindingDecl(BindingDecl *D) {
- static_assert(sizeof(BindingDecl) == 72,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
VisitValueDecl(D);
Record.AddStmt(D->getBinding());
Code = serialization::DECL_BINDING;
}
void ASTDeclWriter::VisitFileScopeAsmDecl(FileScopeAsmDecl *D) {
- static_assert(sizeof(FileScopeAsmDecl) == 56,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
VisitDecl(D);
Record.AddStmt(D->getAsmString());
Record.AddSourceLocation(D->getRParenLoc());
@@ -1341,30 +1174,18 @@ void ASTDeclWriter::VisitFileScopeAsmDecl(FileScopeAsmDecl *D) {
}
void ASTDeclWriter::VisitTopLevelStmtDecl(TopLevelStmtDecl *D) {
- static_assert(sizeof(TopLevelStmtDecl) == 48,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
VisitDecl(D);
Record.AddStmt(D->getStmt());
Code = serialization::DECL_TOP_LEVEL_STMT_DECL;
}
void ASTDeclWriter::VisitEmptyDecl(EmptyDecl *D) {
- static_assert(sizeof(EmptyDecl) == 40,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
VisitDecl(D);
Code = serialization::DECL_EMPTY;
}
void ASTDeclWriter::VisitLifetimeExtendedTemporaryDecl(
LifetimeExtendedTemporaryDecl *D) {
- static_assert(sizeof(LifetimeExtendedTemporaryDecl) == 72,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
VisitDecl(D);
Record.AddDeclRef(D->getExtendingDecl());
Record.AddStmt(D->getTemporaryExpr());
@@ -1375,10 +1196,6 @@ void ASTDeclWriter::VisitLifetimeExtendedTemporaryDecl(
Code = serialization::DECL_LIFETIME_EXTENDED_TEMPORARY;
}
void ASTDeclWriter::VisitBlockDecl(BlockDecl *D) {
- static_assert(DeclContext::NumBlockDeclBits == 5 && sizeof(BlockDecl) == 128,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
VisitDecl(D);
Record.AddStmt(D->getBody());
Record.AddTypeSourceInfo(D->getSignatureAsWritten());
@@ -1408,10 +1225,6 @@ void ASTDeclWriter::VisitBlockDecl(BlockDecl *D) {
}
void ASTDeclWriter::VisitCapturedDecl(CapturedDecl *CD) {
- static_assert(sizeof(CapturedDecl) == 88,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
Record.push_back(CD->getNumParams());
VisitDecl(CD);
Record.push_back(CD->getContextParamPosition());
@@ -1423,11 +1236,6 @@ void ASTDeclWriter::VisitCapturedDecl(CapturedDecl *CD) {
}
void ASTDeclWriter::VisitLinkageSpecDecl(LinkageSpecDecl *D) {
- static_assert(DeclContext::NumLinkageSpecDeclBits == 4 &&
- sizeof(LinkageSpecDecl) == 80,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
VisitDecl(D);
Record.push_back(D->getLanguage());
Record.AddSourceLocation(D->getExternLoc());
@@ -1436,20 +1244,12 @@ void ASTDeclWriter::VisitLinkageSpecDecl(LinkageSpecDecl *D) {
}
void ASTDeclWriter::VisitExportDecl(ExportDecl *D) {
- static_assert(sizeof(ExportDecl) == 80,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
VisitDecl(D);
Record.AddSourceLocation(D->getRBraceLoc());
Code = serialization::DECL_EXPORT;
}
void ASTDeclWriter::VisitLabelDecl(LabelDecl *D) {
- static_assert(sizeof(LabelDecl) == 80,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
VisitNamedDecl(D);
Record.AddSourceLocation(D->getBeginLoc());
Code = serialization::DECL_LABEL;
@@ -1457,10 +1257,6 @@ void ASTDeclWriter::VisitLabelDecl(LabelDecl *D) {
void ASTDeclWriter::VisitNamespaceDecl(NamespaceDecl *D) {
- static_assert(sizeof(NamespaceDecl) == 112,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
VisitRedeclarable(D);
VisitNamedDecl(D);
Record.push_back(D->isInline());
@@ -1488,10 +1284,6 @@ void ASTDeclWriter::VisitNamespaceDecl(NamespaceDecl *D) {
}
void ASTDeclWriter::VisitNamespaceAliasDecl(NamespaceAliasDecl *D) {
- static_assert(sizeof(NamespaceAliasDecl) == 96,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
VisitRedeclarable(D);
VisitNamedDecl(D);
Record.AddSourceLocation(D->getNamespaceLoc());
@@ -1502,10 +1294,6 @@ void ASTDeclWriter::VisitNamespaceAliasDecl(NamespaceAliasDecl *D) {
}
void ASTDeclWriter::VisitUsingDecl(UsingDecl *D) {
- static_assert(sizeof(UsingDecl) == 88,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
VisitNamedDecl(D);
Record.AddSourceLocation(D->getUsingLoc());
Record.AddNestedNameSpecifierLoc(D->getQualifierLoc());
@@ -1517,10 +1305,6 @@ void ASTDeclWriter::VisitUsingDecl(UsingDecl *D) {
}
void ASTDeclWriter::VisitUsingEnumDecl(UsingEnumDecl *D) {
- static_assert(sizeof(UsingEnumDecl) == 72,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
VisitNamedDecl(D);
Record.AddSourceLocation(D->getUsingLoc());
Record.AddSourceLocation(D->getEnumLoc());
@@ -1531,10 +1315,6 @@ void ASTDeclWriter::VisitUsingEnumDecl(UsingEnumDecl *D) {
}
void ASTDeclWriter::VisitUsingPackDecl(UsingPackDecl *D) {
- static_assert(sizeof(UsingPackDecl) == 64,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
Record.push_back(D->NumExpansions);
VisitNamedDecl(D);
Record.AddDeclRef(D->getInstantiatedFromUsingDecl());
@@ -1544,10 +1324,6 @@ void ASTDeclWriter::VisitUsingPackDecl(UsingPackDecl *D) {
}
void ASTDeclWriter::VisitUsingShadowDecl(UsingShadowDecl *D) {
- static_assert(sizeof(UsingShadowDecl) == 80,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
VisitRedeclarable(D);
VisitNamedDecl(D);
Record.AddDeclRef(D->getTargetDecl());
@@ -1559,10 +1335,6 @@ void ASTDeclWriter::VisitUsingShadowDecl(UsingShadowDecl *D) {
void ASTDeclWriter::VisitConstructorUsingShadowDecl(
ConstructorUsingShadowDecl *D) {
- static_assert(sizeof(ConstructorUsingShadowDecl) == 104,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
VisitUsingShadowDecl(D);
Record.AddDeclRef(D->NominatedBaseClassShadowDecl);
Record.AddDeclRef(D->ConstructedBaseClassShadowDecl);
@@ -1571,10 +1343,6 @@ void ASTDeclWriter::VisitConstructorUsingShadowDecl(
}
void ASTDeclWriter::VisitUsingDirectiveDecl(UsingDirectiveDecl *D) {
- static_assert(sizeof(UsingDirectiveDecl) == 88,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
VisitNamedDecl(D);
Record.AddSourceLocation(D->getUsingLoc());
Record.AddSourceLocation(D->getNamespaceKeyLocation());
@@ -1585,10 +1353,6 @@ void ASTDeclWriter::VisitUsingDirectiveDecl(UsingDirectiveDecl *D) {
}
void ASTDeclWriter::VisitUnresolvedUsingValueDecl(UnresolvedUsingValueDecl *D) {
- static_assert(sizeof(UnresolvedUsingValueDecl) == 88,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
VisitValueDecl(D);
Record.AddSourceLocation(D->getUsingLoc());
Record.AddNestedNameSpecifierLoc(D->getQualifierLoc());
@@ -1599,10 +1363,6 @@ void ASTDeclWriter::VisitUnresolvedUsingValueDecl(UnresolvedUsingValueDecl *D) {
void ASTDeclWriter::VisitUnresolvedUsingTypenameDecl(
UnresolvedUsingTypenameDecl *D) {
- static_assert(sizeof(UnresolvedUsingTypenameDecl) == 88,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
VisitTypeDecl(D);
Record.AddSourceLocation(D->getTypenameLoc());
Record.AddNestedNameSpecifierLoc(D->getQualifierLoc());
@@ -1612,19 +1372,11 @@ void ASTDeclWriter::VisitUnresolvedUsingTypenameDecl(
void ASTDeclWriter::VisitUnresolvedUsingIfExistsDecl(
UnresolvedUsingIfExistsDecl *D) {
- static_assert(sizeof(UnresolvedUsingIfExistsDecl) == 48,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
VisitNamedDecl(D);
Code = serialization::DECL_UNRESOLVED_USING_IF_EXISTS;
}
void ASTDeclWriter::VisitCXXRecordDecl(CXXRecordDecl *D) {
- static_assert(sizeof(CXXRecordDecl) == 144,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
VisitRecordDecl(D);
enum {
@@ -1656,10 +1408,6 @@ void ASTDeclWriter::VisitCXXRecordDecl(CXXRecordDecl *D) {
}
void ASTDeclWriter::VisitCXXMethodDecl(CXXMethodDecl *D) {
- static_assert(sizeof(CXXMethodDecl) == 168,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
VisitFunctionDecl(D);
if (D->isCanonicalDecl()) {
Record.push_back(D->size_overridden_methods());
@@ -1683,11 +1431,6 @@ void ASTDeclWriter::VisitCXXMethodDecl(CXXMethodDecl *D) {
}
void ASTDeclWriter::VisitCXXConstructorDecl(CXXConstructorDecl *D) {
- static_assert(DeclContext::NumCXXConstructorDeclBits == 22 &&
- sizeof(CXXConstructorDecl) == 176,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
Record.push_back(D->getTrailingAllocKind());
addExplicitSpecifier(D->getExplicitSpecifier(), Record);
if (auto Inherited = D->getInheritedConstructor()) {
@@ -1700,10 +1443,6 @@ void ASTDeclWriter::VisitCXXConstructorDecl(CXXConstructorDecl *D) {
}
void ASTDeclWriter::VisitCXXDestructorDecl(CXXDestructorDecl *D) {
- static_assert(sizeof(CXXDestructorDecl) == 184,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
VisitCXXMethodDecl(D);
Record.AddDeclRef(D->getOperatorDelete());
@@ -1714,20 +1453,12 @@ void ASTDeclWriter::VisitCXXDestructorDecl(CXXDestructorDecl *D) {
}
void ASTDeclWriter::VisitCXXConversionDecl(CXXConversionDecl *D) {
- static_assert(sizeof(CXXConversionDecl) == 176,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
addExplicitSpecifier(D->getExplicitSpecifier(), Record);
VisitCXXMethodDecl(D);
Code = serialization::DECL_CXX_CONVERSION;
}
void ASTDeclWriter::VisitImportDecl(ImportDecl *D) {
- static_assert(sizeof(ImportDecl) == 56,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
VisitDecl(D);
Record.push_back(Writer.getSubmoduleID(D->getImportedModule()));
ArrayRef<SourceLocation> IdentifierLocs = D->getIdentifierLocs();
@@ -1746,20 +1477,12 @@ void ASTDeclWriter::VisitImportDecl(ImportDecl *D) {
}
void ASTDeclWriter::VisitAccessSpecDecl(AccessSpecDecl *D) {
- static_assert(sizeof(AccessSpecDecl) == 40,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
VisitDecl(D);
Record.AddSourceLocation(D->getColonLoc());
Code = serialization::DECL_ACCESS_SPEC;
}
void ASTDeclWriter::VisitFriendDecl(FriendDecl *D) {
- static_assert(sizeof(FriendDecl) == 64,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
// Record the number of friend type template parameter lists here
// so as to simplify memory allocation during deserialization.
Record.push_back(D->NumTPLists);
@@ -1779,10 +1502,6 @@ void ASTDeclWriter::VisitFriendDecl(FriendDecl *D) {
}
void ASTDeclWriter::VisitFriendTemplateDecl(FriendTemplateDecl *D) {
- static_assert(sizeof(FriendTemplateDecl) == 64,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
VisitDecl(D);
Record.push_back(D->getNumTemplateParameters());
for (unsigned i = 0, e = D->getNumTemplateParameters(); i != e; ++i)
@@ -1797,10 +1516,6 @@ void ASTDeclWriter::VisitFriendTemplateDecl(FriendTemplateDecl *D) {
}
void ASTDeclWriter::VisitTemplateDecl(TemplateDecl *D) {
- static_assert(sizeof(TemplateDecl) == 64,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
VisitNamedDecl(D);
Record.AddTemplateParameterList(D->getTemplateParameters());
@@ -1808,10 +1523,6 @@ void ASTDeclWriter::VisitTemplateDecl(TemplateDecl *D) {
}
void ASTDeclWriter::VisitConceptDecl(ConceptDecl *D) {
- static_assert(sizeof(ConceptDecl) == 72,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
VisitTemplateDecl(D);
Record.AddStmt(D->getConstraintExpr());
Code = serialization::DECL_CONCEPT;
@@ -1819,10 +1530,6 @@ void ASTDeclWriter::VisitConceptDecl(ConceptDecl *D) {
void ASTDeclWriter::VisitImplicitConceptSpecializationDecl(
ImplicitConceptSpecializationDecl *D) {
- static_assert(sizeof(ImplicitConceptSpecializationDecl) == 40,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
Record.push_back(D->getTemplateArguments().size());
VisitDecl(D);
for (const TemplateArgument &Arg : D->getTemplateArguments())
@@ -1831,18 +1538,10 @@ void ASTDeclWriter::VisitImplicitConceptSpecializationDecl(
}
void ASTDeclWriter::VisitRequiresExprBodyDecl(RequiresExprBodyDecl *D) {
- static_assert(sizeof(RequiresExprBodyDecl) == 72,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
Code = serialization::DECL_REQUIRES_EXPR_BODY;
}
void ASTDeclWriter::VisitRedeclarableTemplateDecl(RedeclarableTemplateDecl *D) {
- static_assert(sizeof(RedeclarableTemplateDecl) == 88,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
VisitRedeclarable(D);
// Emit data to initialize CommonOrPrev before VisitTemplateDecl so that
@@ -1859,10 +1558,6 @@ void ASTDeclWriter::VisitRedeclarableTemplateDecl(RedeclarableTemplateDecl *D) {
}
void ASTDeclWriter::VisitClassTemplateDecl(ClassTemplateDecl *D) {
- static_assert(sizeof(ClassTemplateDecl) == 88,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
VisitRedeclarableTemplateDecl(D);
if (D->isFirstDecl())
@@ -1872,10 +1567,6 @@ void ASTDeclWriter::VisitClassTemplateDecl(ClassTemplateDecl *D) {
void ASTDeclWriter::VisitClassTemplateSpecializationDecl(
ClassTemplateSpecializationDecl *D) {
- static_assert(sizeof(ClassTemplateSpecializationDecl) == 184,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
RegisterTemplateSpecialization(D->getSpecializedTemplate(), D);
VisitCXXRecordDecl(D);
@@ -1912,10 +1603,6 @@ void ASTDeclWriter::VisitClassTemplateSpecializationDecl(
void ASTDeclWriter::VisitClassTemplatePartialSpecializationDecl(
ClassTemplatePartialSpecializationDecl *D) {
- static_assert(sizeof(ClassTemplatePartialSpecializationDecl) == 208,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
Record.AddTemplateParameterList(D->getTemplateParameters());
Record.AddASTTemplateArgumentListInfo(D->getTemplateArgsAsWritten());
@@ -1931,10 +1618,6 @@ void ASTDeclWriter::VisitClassTemplatePartialSpecializationDecl(
}
void ASTDeclWriter::VisitVarTemplateDecl(VarTemplateDecl *D) {
- static_assert(sizeof(VarTemplateDecl) == 88,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
VisitRedeclarableTemplateDecl(D);
if (D->isFirstDecl())
@@ -1944,10 +1627,6 @@ void ASTDeclWriter::VisitVarTemplateDecl(VarTemplateDecl *D) {
void ASTDeclWriter::VisitVarTemplateSpecializationDecl(
VarTemplateSpecializationDecl *D) {
- static_assert(sizeof(VarTemplateSpecializationDecl) == 152,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
RegisterTemplateSpecialization(D->getSpecializedTemplate(), D);
llvm::PointerUnion<VarTemplateDecl *, VarTemplatePartialSpecializationDecl *>
@@ -1985,10 +1664,6 @@ void ASTDeclWriter::VisitVarTemplateSpecializationDecl(
void ASTDeclWriter::VisitVarTemplatePartialSpecializationDecl(
VarTemplatePartialSpecializationDecl *D) {
- static_assert(sizeof(VarTemplatePartialSpecializationDecl) == 176,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
Record.AddTemplateParameterList(D->getTemplateParameters());
Record.AddASTTemplateArgumentListInfo(D->getTemplateArgsAsWritten());
@@ -2005,10 +1680,6 @@ void ASTDeclWriter::VisitVarTemplatePartialSpecializationDecl(
void ASTDeclWriter::VisitClassScopeFunctionSpecializationDecl(
ClassScopeFunctionSpecializationDecl *D) {
- static_assert(sizeof(ClassScopeFunctionSpecializationDecl) == 56,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
VisitDecl(D);
Record.AddDeclRef(D->getSpecialization());
Record.push_back(D->hasExplicitTemplateArgs());
@@ -2019,10 +1690,6 @@ void ASTDeclWriter::VisitClassScopeFunctionSpecializationDecl(
void ASTDeclWriter::VisitFunctionTemplateDecl(FunctionTemplateDecl *D) {
- static_assert(sizeof(FunctionTemplateDecl) == 88,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
VisitRedeclarableTemplateDecl(D);
if (D->isFirstDecl())
@@ -2031,10 +1698,6 @@ void ASTDeclWriter::VisitFunctionTemplateDecl(FunctionTemplateDecl *D) {
}
void ASTDeclWriter::VisitTemplateTypeParmDecl(TemplateTypeParmDecl *D) {
- static_assert(sizeof(TemplateTypeParmDecl) == 80,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
Record.push_back(D->hasTypeConstraint());
VisitTypeDecl(D);
@@ -2065,10 +1728,6 @@ void ASTDeclWriter::VisitTemplateTypeParmDecl(TemplateTypeParmDecl *D) {
}
void ASTDeclWriter::VisitNonTypeTemplateParmDecl(NonTypeTemplateParmDecl *D) {
- static_assert(sizeof(NonTypeTemplateParmDecl) == 88,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
// For an expanded parameter pack, record the number of expansion types here
// so that it's easier for deserialization to allocate the right amount of
// memory.
@@ -2104,10 +1763,6 @@ void ASTDeclWriter::VisitNonTypeTemplateParmDecl(NonTypeTemplateParmDecl *D) {
}
void ASTDeclWriter::VisitTemplateTemplateParmDecl(TemplateTemplateParmDecl *D) {
- static_assert(sizeof(TemplateTemplateParmDecl) == 88,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
// For an expanded parameter pack, record the number of expansion types here
// so that it's easier for deserialization to allocate the right amount of
// memory.
@@ -2137,19 +1792,11 @@ void ASTDeclWriter::VisitTemplateTemplateParmDecl(TemplateTemplateParmDecl *D) {
}
void ASTDeclWriter::VisitTypeAliasTemplateDecl(TypeAliasTemplateDecl *D) {
- static_assert(sizeof(TypeAliasTemplateDecl) == 88,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
VisitRedeclarableTemplateDecl(D);
Code = serialization::DECL_TYPE_ALIAS_TEMPLATE;
}
void ASTDeclWriter::VisitStaticAssertDecl(StaticAssertDecl *D) {
- static_assert(sizeof(StaticAssertDecl) == 64,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
VisitDecl(D);
Record.AddStmt(D->getAssertExpr());
Record.push_back(D->isFailed());
@@ -2160,11 +1807,6 @@ void ASTDeclWriter::VisitStaticAssertDecl(StaticAssertDecl *D) {
/// Emit the DeclContext part of a declaration context decl.
void ASTDeclWriter::VisitDeclContext(DeclContext *DC) {
- static_assert(DeclContext::NumDeclContextBits == 13 &&
- sizeof(DeclContext) == 32,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
Record.AddOffset(Writer.WriteDeclContextLexicalBlock(Context, DC));
Record.AddOffset(Writer.WriteDeclContextVisibleBlock(Context, DC));
}
@@ -2246,10 +1888,6 @@ void ASTDeclWriter::VisitRedeclarable(Redeclarable<T> *D) {
}
void ASTDeclWriter::VisitHLSLBufferDecl(HLSLBufferDecl *D) {
- static_assert(sizeof(HLSLBufferDecl) == 96,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
VisitNamedDecl(D);
VisitDeclContext(D);
Record.push_back(D->isCBuffer());
@@ -2261,41 +1899,24 @@ void ASTDeclWriter::VisitHLSLBufferDecl(HLSLBufferDecl *D) {
}
void ASTDeclWriter::VisitOMPThreadPrivateDecl(OMPThreadPrivateDecl *D) {
- static_assert(sizeof(OMPThreadPrivateDecl) == 48,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
Record.writeOMPChildren(D->Data);
VisitDecl(D);
Code = serialization::DECL_OMP_THREADPRIVATE;
}
void ASTDeclWriter::VisitOMPAllocateDecl(OMPAllocateDecl *D) {
- static_assert(sizeof(OMPAllocateDecl) == 48,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
Record.writeOMPChildren(D->Data);
VisitDecl(D);
Code = serialization::DECL_OMP_ALLOCATE;
}
void ASTDeclWriter::VisitOMPRequiresDecl(OMPRequiresDecl *D) {
- static_assert(sizeof(OMPRequiresDecl) == 48,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
Record.writeOMPChildren(D->Data);
VisitDecl(D);
Code = serialization::DECL_OMP_REQUIRES;
}
void ASTDeclWriter::VisitOMPDeclareReductionDecl(OMPDeclareReductionDecl *D) {
- static_assert(DeclContext::NumOMPDeclareReductionDeclBits == 2 &&
- sizeof(OMPDeclareReductionDecl) == 144,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
VisitValueDecl(D);
Record.AddSourceLocation(D->getBeginLoc());
Record.AddStmt(D->getCombinerIn());
@@ -2310,10 +1931,6 @@ void ASTDeclWriter::VisitOMPDeclareReductionDecl(OMPDeclareReductionDecl *D) {
}
void ASTDeclWriter::VisitOMPDeclareMapperDecl(OMPDeclareMapperDecl *D) {
- static_assert(sizeof(OMPDeclareMapperDecl) == 120,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
Record.writeOMPChildren(D->Data);
VisitValueDecl(D);
Record.AddDeclarationName(D->getVarName());
@@ -2322,10 +1939,6 @@ void ASTDeclWriter::VisitOMPDeclareMapperDecl(OMPDeclareMapperDecl *D) {
}
void ASTDeclWriter::VisitOMPCapturedExprDecl(OMPCapturedExprDecl *D) {
- static_assert(sizeof(OMPCapturedExprDecl) == 104,
- "You need to update the serializer after you change the fields "
- "of Decls.");
-
VisitVarDecl(D);
Code = serialization::DECL_OMP_CAPTUREDEXPR;
}
More information about the cfe-commits
mailing list