[clang] a764358 - [clang][NFC] Convert DeclUpdateKind to scoped enum
Vlad Serebrennikov via cfe-commits
cfe-commits at lists.llvm.org
Sun Apr 27 22:05:51 PDT 2025
Author: Vlad Serebrennikov
Date: 2025-04-28T08:05:46+03:00
New Revision: a764358a9d86e9169bea895c8efbb61cc37ec788
URL: https://github.com/llvm/llvm-project/commit/a764358a9d86e9169bea895c8efbb61cc37ec788
DIFF: https://github.com/llvm/llvm-project/commit/a764358a9d86e9169bea895c8efbb61cc37ec788.diff
LOG: [clang][NFC] Convert DeclUpdateKind to scoped enum
Added:
Modified:
clang/include/clang/Serialization/ASTWriter.h
clang/lib/Serialization/ASTCommon.h
clang/lib/Serialization/ASTReaderDecl.cpp
clang/lib/Serialization/ASTWriter.cpp
clang/lib/Serialization/ASTWriterDecl.cpp
Removed:
################################################################################
diff --git a/clang/include/clang/Serialization/ASTWriter.h b/clang/include/clang/Serialization/ASTWriter.h
index bdf3aca0637c8..9f0570eddc34e 100644
--- a/clang/include/clang/Serialization/ASTWriter.h
+++ b/clang/include/clang/Serialization/ASTWriter.h
@@ -75,6 +75,10 @@ class StoredDeclsList;
class SwitchCase;
class Token;
+namespace serialization {
+enum class DeclUpdateKind;
+} // namespace serialization
+
namespace SrcMgr {
class FileInfo;
} // namespace SrcMgr
@@ -374,8 +378,7 @@ class ASTWriter : public ASTDeserializationListener,
/// An update to a Decl.
class DeclUpdate {
- /// A DeclUpdateKind.
- unsigned Kind;
+ serialization::DeclUpdateKind Kind;
union {
const Decl *Dcl;
void *Type;
@@ -386,18 +389,21 @@ class ASTWriter : public ASTDeserializationListener,
};
public:
- DeclUpdate(unsigned Kind) : Kind(Kind), Dcl(nullptr) {}
- DeclUpdate(unsigned Kind, const Decl *Dcl) : Kind(Kind), Dcl(Dcl) {}
- DeclUpdate(unsigned Kind, QualType Type)
+ DeclUpdate(serialization::DeclUpdateKind Kind) : Kind(Kind), Dcl(nullptr) {}
+ DeclUpdate(serialization::DeclUpdateKind Kind, const Decl *Dcl)
+ : Kind(Kind), Dcl(Dcl) {}
+ DeclUpdate(serialization::DeclUpdateKind Kind, QualType Type)
: Kind(Kind), Type(Type.getAsOpaquePtr()) {}
- DeclUpdate(unsigned Kind, SourceLocation Loc)
+ DeclUpdate(serialization::DeclUpdateKind Kind, SourceLocation Loc)
: Kind(Kind), Loc(Loc.getRawEncoding()) {}
- DeclUpdate(unsigned Kind, unsigned Val) : Kind(Kind), Val(Val) {}
- DeclUpdate(unsigned Kind, Module *M) : Kind(Kind), Mod(M) {}
- DeclUpdate(unsigned Kind, const Attr *Attribute)
- : Kind(Kind), Attribute(Attribute) {}
-
- unsigned getKind() const { return Kind; }
+ DeclUpdate(serialization::DeclUpdateKind Kind, unsigned Val)
+ : Kind(Kind), Val(Val) {}
+ DeclUpdate(serialization::DeclUpdateKind Kind, Module *M)
+ : Kind(Kind), Mod(M) {}
+ DeclUpdate(serialization::DeclUpdateKind Kind, const Attr *Attribute)
+ : Kind(Kind), Attribute(Attribute) {}
+
+ serialization::DeclUpdateKind getKind() const { return Kind; }
const Decl *getDecl() const { return Dcl; }
QualType getType() const { return QualType::getFromOpaquePtr(Type); }
diff --git a/clang/lib/Serialization/ASTCommon.h b/clang/lib/Serialization/ASTCommon.h
index 7c9ec884ea049..ed6b8d00115ea 100644
--- a/clang/lib/Serialization/ASTCommon.h
+++ b/clang/lib/Serialization/ASTCommon.h
@@ -22,26 +22,26 @@ namespace clang {
namespace serialization {
-enum DeclUpdateKind {
- UPD_CXX_ADDED_IMPLICIT_MEMBER,
- UPD_CXX_ADDED_ANONYMOUS_NAMESPACE,
- UPD_CXX_ADDED_FUNCTION_DEFINITION,
- UPD_CXX_ADDED_VAR_DEFINITION,
- UPD_CXX_POINT_OF_INSTANTIATION,
- UPD_CXX_INSTANTIATED_CLASS_DEFINITION,
- UPD_CXX_INSTANTIATED_DEFAULT_ARGUMENT,
- UPD_CXX_INSTANTIATED_DEFAULT_MEMBER_INITIALIZER,
- UPD_CXX_RESOLVED_DTOR_DELETE,
- UPD_CXX_RESOLVED_EXCEPTION_SPEC,
- UPD_CXX_DEDUCED_RETURN_TYPE,
- UPD_DECL_MARKED_USED,
- UPD_MANGLING_NUMBER,
- UPD_STATIC_LOCAL_NUMBER,
- UPD_DECL_MARKED_OPENMP_THREADPRIVATE,
- UPD_DECL_MARKED_OPENMP_ALLOCATE,
- UPD_DECL_MARKED_OPENMP_DECLARETARGET,
- UPD_DECL_EXPORTED,
- UPD_ADDED_ATTR_TO_RECORD
+enum class DeclUpdateKind {
+ CXXAddedImplicitMember,
+ CXXAddedAnonymousNamespace,
+ CXXAddedFunctionDefinition,
+ CXXAddedVarDefinition,
+ CXXPointOfInstantiation,
+ CXXInstantiatedClassDefinition,
+ CXXInstantiatedDefaultArgument,
+ CXXInstantiatedDefaultMemberInitializer,
+ CXXResolvedDtorDelete,
+ CXXResolvedExceptionSpec,
+ CXXDeducedReturnType,
+ DeclMarkedUsed,
+ ManglingNumber,
+ StaticLocalNumber,
+ DeclMarkedOpenMPThreadPrivate,
+ DeclMarkedOpenMPAllocate,
+ DeclMarkedOpenMPDeclareTarget,
+ DeclExported,
+ AddedAttrToRecord
};
TypeIdx TypeIdxFromBuiltin(const BuiltinType *BT);
diff --git a/clang/lib/Serialization/ASTReaderDecl.cpp b/clang/lib/Serialization/ASTReaderDecl.cpp
index 0f54aa5c5e062..b1bec20b40390 100644
--- a/clang/lib/Serialization/ASTReaderDecl.cpp
+++ b/clang/lib/Serialization/ASTReaderDecl.cpp
@@ -4689,7 +4689,7 @@ static void forAllLaterRedecls(DeclT *D, Fn F) {
void ASTDeclReader::UpdateDecl(Decl *D) {
while (Record.getIdx() < Record.size()) {
switch ((DeclUpdateKind)Record.readInt()) {
- case UPD_CXX_ADDED_IMPLICIT_MEMBER: {
+ case DeclUpdateKind::CXXAddedImplicitMember: {
auto *RD = cast<CXXRecordDecl>(D);
Decl *MD = Record.readDecl();
assert(MD && "couldn't read decl from update record");
@@ -4697,7 +4697,7 @@ void ASTDeclReader::UpdateDecl(Decl *D) {
break;
}
- case UPD_CXX_ADDED_ANONYMOUS_NAMESPACE: {
+ case DeclUpdateKind::CXXAddedAnonymousNamespace: {
auto *Anon = readDeclAs<NamespaceDecl>();
// Each module has its own anonymous namespace, which is disjoint from
@@ -4712,7 +4712,7 @@ void ASTDeclReader::UpdateDecl(Decl *D) {
break;
}
- case UPD_CXX_ADDED_VAR_DEFINITION: {
+ case DeclUpdateKind::CXXAddedVarDefinition: {
auto *VD = cast<VarDecl>(D);
VD->NonParmVarDeclBits.IsInline = Record.readInt();
VD->NonParmVarDeclBits.IsInlineSpecified = Record.readInt();
@@ -4720,7 +4720,7 @@ void ASTDeclReader::UpdateDecl(Decl *D) {
break;
}
- case UPD_CXX_POINT_OF_INSTANTIATION: {
+ case DeclUpdateKind::CXXPointOfInstantiation: {
SourceLocation POI = Record.readSourceLocation();
if (auto *VTSD = dyn_cast<VarTemplateSpecializationDecl>(D)) {
VTSD->setPointOfInstantiation(POI);
@@ -4740,7 +4740,7 @@ void ASTDeclReader::UpdateDecl(Decl *D) {
break;
}
- case UPD_CXX_INSTANTIATED_DEFAULT_ARGUMENT: {
+ case DeclUpdateKind::CXXInstantiatedDefaultArgument: {
auto *Param = cast<ParmVarDecl>(D);
// We have to read the default argument regardless of whether we use it
@@ -4755,7 +4755,7 @@ void ASTDeclReader::UpdateDecl(Decl *D) {
break;
}
- case UPD_CXX_INSTANTIATED_DEFAULT_MEMBER_INITIALIZER: {
+ case DeclUpdateKind::CXXInstantiatedDefaultMemberInitializer: {
auto *FD = cast<FieldDecl>(D);
auto *DefaultInit = Record.readExpr();
@@ -4772,7 +4772,7 @@ void ASTDeclReader::UpdateDecl(Decl *D) {
break;
}
- case UPD_CXX_ADDED_FUNCTION_DEFINITION: {
+ case DeclUpdateKind::CXXAddedFunctionDefinition: {
auto *FD = cast<FunctionDecl>(D);
if (Reader.PendingBodies[FD]) {
// FIXME: Maybe check for ODR violations.
@@ -4794,7 +4794,7 @@ void ASTDeclReader::UpdateDecl(Decl *D) {
break;
}
- case UPD_CXX_INSTANTIATED_CLASS_DEFINITION: {
+ case DeclUpdateKind::CXXInstantiatedClassDefinition: {
auto *RD = cast<CXXRecordDecl>(D);
auto *OldDD = RD->getCanonicalDecl()->DefinitionData;
bool HadRealDefinition =
@@ -4855,7 +4855,7 @@ void ASTDeclReader::UpdateDecl(Decl *D) {
break;
}
- case UPD_CXX_RESOLVED_DTOR_DELETE: {
+ case DeclUpdateKind::CXXResolvedDtorDelete: {
// Set the 'operator delete' directly to avoid emitting another update
// record.
auto *Del = readDeclAs<FunctionDecl>();
@@ -4869,7 +4869,7 @@ void ASTDeclReader::UpdateDecl(Decl *D) {
break;
}
- case UPD_CXX_RESOLVED_EXCEPTION_SPEC: {
+ case DeclUpdateKind::CXXResolvedExceptionSpec: {
SmallVector<QualType, 8> ExceptionStorage;
auto ESI = Record.readExceptionSpecInfo(ExceptionStorage);
@@ -4891,7 +4891,7 @@ void ASTDeclReader::UpdateDecl(Decl *D) {
break;
}
- case UPD_CXX_DEDUCED_RETURN_TYPE: {
+ case DeclUpdateKind::CXXDeducedReturnType: {
auto *FD = cast<FunctionDecl>(D);
QualType DeducedResultType = Record.readType();
Reader.PendingDeducedTypeUpdates.insert(
@@ -4899,27 +4899,27 @@ void ASTDeclReader::UpdateDecl(Decl *D) {
break;
}
- case UPD_DECL_MARKED_USED:
+ case DeclUpdateKind::DeclMarkedUsed:
// Maintain AST consistency: any later redeclarations are used too.
D->markUsed(Reader.getContext());
break;
- case UPD_MANGLING_NUMBER:
+ case DeclUpdateKind::ManglingNumber:
Reader.getContext().setManglingNumber(cast<NamedDecl>(D),
Record.readInt());
break;
- case UPD_STATIC_LOCAL_NUMBER:
+ case DeclUpdateKind::StaticLocalNumber:
Reader.getContext().setStaticLocalNumber(cast<VarDecl>(D),
Record.readInt());
break;
- case UPD_DECL_MARKED_OPENMP_THREADPRIVATE:
+ case DeclUpdateKind::DeclMarkedOpenMPThreadPrivate:
D->addAttr(OMPThreadPrivateDeclAttr::CreateImplicit(Reader.getContext(),
readSourceRange()));
break;
- case UPD_DECL_MARKED_OPENMP_ALLOCATE: {
+ case DeclUpdateKind::DeclMarkedOpenMPAllocate: {
auto AllocatorKind =
static_cast<OMPAllocateDeclAttr::AllocatorTypeTy>(Record.readInt());
Expr *Allocator = Record.readExpr();
@@ -4930,7 +4930,7 @@ void ASTDeclReader::UpdateDecl(Decl *D) {
break;
}
- case UPD_DECL_EXPORTED: {
+ case DeclUpdateKind::DeclExported: {
unsigned SubmoduleID = readSubmoduleID();
auto *Exported = cast<NamedDecl>(D);
Module *Owner = SubmoduleID ? Reader.getSubmodule(SubmoduleID) : nullptr;
@@ -4939,7 +4939,7 @@ void ASTDeclReader::UpdateDecl(Decl *D) {
break;
}
- case UPD_DECL_MARKED_OPENMP_DECLARETARGET: {
+ case DeclUpdateKind::DeclMarkedOpenMPDeclareTarget: {
auto MapType = Record.readEnum<OMPDeclareTargetDeclAttr::MapTypeTy>();
auto DevType = Record.readEnum<OMPDeclareTargetDeclAttr::DevTypeTy>();
Expr *IndirectE = Record.readExpr();
@@ -4951,7 +4951,7 @@ void ASTDeclReader::UpdateDecl(Decl *D) {
break;
}
- case UPD_ADDED_ATTR_TO_RECORD:
+ case DeclUpdateKind::AddedAttrToRecord:
AttrVec Attrs;
Record.readAttributes(Attrs);
assert(Attrs.size() == 1);
diff --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp
index bea8fd5055358..2772038bf3755 100644
--- a/clang/lib/Serialization/ASTWriter.cpp
+++ b/clang/lib/Serialization/ASTWriter.cpp
@@ -6155,13 +6155,14 @@ void ASTWriter::AddedManglingNumber(const Decl *D, unsigned Number) {
if (D->isFromASTFile())
return;
- DeclUpdates[D].push_back(DeclUpdate(UPD_MANGLING_NUMBER, Number));
+ DeclUpdates[D].push_back(DeclUpdate(DeclUpdateKind::ManglingNumber, Number));
}
void ASTWriter::AddedStaticLocalNumbers(const Decl *D, unsigned Number) {
if (D->isFromASTFile())
return;
- DeclUpdates[D].push_back(DeclUpdate(UPD_STATIC_LOCAL_NUMBER, Number));
+ DeclUpdates[D].push_back(
+ DeclUpdate(DeclUpdateKind::StaticLocalNumber, Number));
}
void ASTWriter::AddedAnonymousNamespace(const TranslationUnitDecl *TU,
@@ -6172,7 +6173,8 @@ void ASTWriter::AddedAnonymousNamespace(const TranslationUnitDecl *TU,
if (NamespaceDecl *NS = TU->getAnonymousNamespace()) {
ASTWriter::UpdateRecord &Record = DeclUpdates[TU];
if (Record.empty())
- Record.push_back(DeclUpdate(UPD_CXX_ADDED_ANONYMOUS_NAMESPACE, NS));
+ Record.push_back(
+ DeclUpdate(DeclUpdateKind::CXXAddedAnonymousNamespace, NS));
}
}
@@ -6374,43 +6376,43 @@ void ASTWriter::WriteDeclUpdatesBlocks(ASTContext &Context,
RecordData RecordData;
ASTRecordWriter Record(Context, *this, RecordData);
for (auto &Update : DeclUpdate.second) {
- DeclUpdateKind Kind = (DeclUpdateKind)Update.getKind();
+ DeclUpdateKind Kind = Update.getKind();
// An updated body is emitted last, so that the reader doesn't need
// to skip over the lazy body to reach statements for other records.
- if (Kind == UPD_CXX_ADDED_FUNCTION_DEFINITION)
+ if (Kind == DeclUpdateKind::CXXAddedFunctionDefinition)
HasUpdatedBody = true;
- else if (Kind == UPD_CXX_ADDED_VAR_DEFINITION)
+ else if (Kind == DeclUpdateKind::CXXAddedVarDefinition)
HasAddedVarDefinition = true;
else
- Record.push_back(Kind);
+ Record.push_back(llvm::to_underlying(Kind));
switch (Kind) {
- case UPD_CXX_ADDED_IMPLICIT_MEMBER:
- case UPD_CXX_ADDED_ANONYMOUS_NAMESPACE:
+ case DeclUpdateKind::CXXAddedImplicitMember:
+ case DeclUpdateKind::CXXAddedAnonymousNamespace:
assert(Update.getDecl() && "no decl to add?");
Record.AddDeclRef(Update.getDecl());
break;
- case UPD_CXX_ADDED_FUNCTION_DEFINITION:
- case UPD_CXX_ADDED_VAR_DEFINITION:
+ case DeclUpdateKind::CXXAddedFunctionDefinition:
+ case DeclUpdateKind::CXXAddedVarDefinition:
break;
- case UPD_CXX_POINT_OF_INSTANTIATION:
+ case DeclUpdateKind::CXXPointOfInstantiation:
// FIXME: Do we need to also save the template specialization kind here?
Record.AddSourceLocation(Update.getLoc());
break;
- case UPD_CXX_INSTANTIATED_DEFAULT_ARGUMENT:
+ case DeclUpdateKind::CXXInstantiatedDefaultArgument:
Record.writeStmtRef(
cast<ParmVarDecl>(Update.getDecl())->getDefaultArg());
break;
- case UPD_CXX_INSTANTIATED_DEFAULT_MEMBER_INITIALIZER:
+ case DeclUpdateKind::CXXInstantiatedDefaultMemberInitializer:
Record.AddStmt(
cast<FieldDecl>(Update.getDecl())->getInClassInitializer());
break;
- case UPD_CXX_INSTANTIATED_CLASS_DEFINITION: {
+ case DeclUpdateKind::CXXInstantiatedClassDefinition: {
auto *RD = cast<CXXRecordDecl>(D);
UpdatedDeclContexts.insert(RD->getPrimaryContext());
Record.push_back(RD->isParamDestroyedInCallee());
@@ -6456,36 +6458,36 @@ void ASTWriter::WriteDeclUpdatesBlocks(ASTContext &Context,
break;
}
- case UPD_CXX_RESOLVED_DTOR_DELETE:
+ case DeclUpdateKind::CXXResolvedDtorDelete:
Record.AddDeclRef(Update.getDecl());
Record.AddStmt(cast<CXXDestructorDecl>(D)->getOperatorDeleteThisArg());
break;
- case UPD_CXX_RESOLVED_EXCEPTION_SPEC: {
+ case DeclUpdateKind::CXXResolvedExceptionSpec: {
auto prototype =
cast<FunctionDecl>(D)->getType()->castAs<FunctionProtoType>();
Record.writeExceptionSpecInfo(prototype->getExceptionSpecInfo());
break;
}
- case UPD_CXX_DEDUCED_RETURN_TYPE:
+ case DeclUpdateKind::CXXDeducedReturnType:
Record.push_back(GetOrCreateTypeID(Context, Update.getType()));
break;
- case UPD_DECL_MARKED_USED:
+ case DeclUpdateKind::DeclMarkedUsed:
break;
- case UPD_MANGLING_NUMBER:
- case UPD_STATIC_LOCAL_NUMBER:
+ case DeclUpdateKind::ManglingNumber:
+ case DeclUpdateKind::StaticLocalNumber:
Record.push_back(Update.getNumber());
break;
- case UPD_DECL_MARKED_OPENMP_THREADPRIVATE:
+ case DeclUpdateKind::DeclMarkedOpenMPThreadPrivate:
Record.AddSourceRange(
D->getAttr<OMPThreadPrivateDeclAttr>()->getRange());
break;
- case UPD_DECL_MARKED_OPENMP_ALLOCATE: {
+ case DeclUpdateKind::DeclMarkedOpenMPAllocate: {
auto *A = D->getAttr<OMPAllocateDeclAttr>();
Record.push_back(A->getAllocatorType());
Record.AddStmt(A->getAllocator());
@@ -6494,17 +6496,17 @@ void ASTWriter::WriteDeclUpdatesBlocks(ASTContext &Context,
break;
}
- case UPD_DECL_MARKED_OPENMP_DECLARETARGET:
+ case DeclUpdateKind::DeclMarkedOpenMPDeclareTarget:
Record.push_back(D->getAttr<OMPDeclareTargetDeclAttr>()->getMapType());
Record.AddSourceRange(
D->getAttr<OMPDeclareTargetDeclAttr>()->getRange());
break;
- case UPD_DECL_EXPORTED:
+ case DeclUpdateKind::DeclExported:
Record.push_back(getSubmoduleID(Update.getModule()));
break;
- case UPD_ADDED_ATTR_TO_RECORD:
+ case DeclUpdateKind::AddedAttrToRecord:
Record.AddAttributes(llvm::ArrayRef(Update.getAttr()));
break;
}
@@ -6515,13 +6517,15 @@ void ASTWriter::WriteDeclUpdatesBlocks(ASTContext &Context,
if (!GeneratingReducedBMI || !CanElideDeclDef(D)) {
if (HasUpdatedBody) {
const auto *Def = cast<FunctionDecl>(D);
- Record.push_back(UPD_CXX_ADDED_FUNCTION_DEFINITION);
+ Record.push_back(
+ llvm::to_underlying(DeclUpdateKind::CXXAddedFunctionDefinition));
Record.push_back(Def->isInlined());
Record.AddSourceLocation(Def->getInnerLocStart());
Record.AddFunctionDefinition(Def);
} else if (HasAddedVarDefinition) {
const auto *VD = cast<VarDecl>(D);
- Record.push_back(UPD_CXX_ADDED_VAR_DEFINITION);
+ Record.push_back(
+ llvm::to_underlying(DeclUpdateKind::CXXAddedVarDefinition));
Record.push_back(VD->isInline());
Record.push_back(VD->isInlineSpecified());
Record.AddVarDeclInit(VD);
@@ -7399,7 +7403,7 @@ void ASTWriter::CompletedTagDefinition(const TagDecl *D) {
assert(isTemplateInstantiation(RD->getTemplateSpecializationKind()) &&
"completed a tag from another module but not by instantiation?");
DeclUpdates[RD].push_back(
- DeclUpdate(UPD_CXX_INSTANTIATED_CLASS_DEFINITION));
+ DeclUpdate(DeclUpdateKind::CXXInstantiatedClassDefinition));
}
}
}
@@ -7462,7 +7466,8 @@ void ASTWriter::AddedCXXImplicitMember(const CXXRecordDecl *RD, const Decl *D) {
// A decl coming from PCH was modified.
assert(RD->isCompleteDefinition());
assert(!WritingAST && "Already writing the AST!");
- DeclUpdates[RD].push_back(DeclUpdate(UPD_CXX_ADDED_IMPLICIT_MEMBER, D));
+ DeclUpdates[RD].push_back(
+ DeclUpdate(DeclUpdateKind::CXXAddedImplicitMember, D));
}
void ASTWriter::ResolvedExceptionSpec(const FunctionDecl *FD) {
@@ -7476,7 +7481,7 @@ void ASTWriter::ResolvedExceptionSpec(const FunctionDecl *FD) {
->getType()
->castAs<FunctionProtoType>()
->getExceptionSpecType()))
- DeclUpdates[D].push_back(UPD_CXX_RESOLVED_EXCEPTION_SPEC);
+ DeclUpdates[D].push_back(DeclUpdateKind::CXXResolvedExceptionSpec);
});
}
@@ -7486,7 +7491,7 @@ void ASTWriter::DeducedReturnType(const FunctionDecl *FD, QualType ReturnType) {
if (!Chain) return;
Chain->forEachImportedKeyDecl(FD, [&](const Decl *D) {
DeclUpdates[D].push_back(
- DeclUpdate(UPD_CXX_DEDUCED_RETURN_TYPE, ReturnType));
+ DeclUpdate(DeclUpdateKind::CXXDeducedReturnType, ReturnType));
});
}
@@ -7498,7 +7503,8 @@ void ASTWriter::ResolvedOperatorDelete(const CXXDestructorDecl *DD,
assert(Delete && "Not given an operator delete");
if (!Chain) return;
Chain->forEachImportedKeyDecl(DD, [&](const Decl *D) {
- DeclUpdates[D].push_back(DeclUpdate(UPD_CXX_RESOLVED_DTOR_DELETE, Delete));
+ DeclUpdates[D].push_back(
+ DeclUpdate(DeclUpdateKind::CXXResolvedDtorDelete, Delete));
});
}
@@ -7513,7 +7519,8 @@ void ASTWriter::CompletedImplicitDefinition(const FunctionDecl *D) {
return;
// Implicit function decl from a PCH was defined.
- DeclUpdates[D].push_back(DeclUpdate(UPD_CXX_ADDED_FUNCTION_DEFINITION));
+ DeclUpdates[D].push_back(
+ DeclUpdate(DeclUpdateKind::CXXAddedFunctionDefinition));
}
void ASTWriter::VariableDefinitionInstantiated(const VarDecl *D) {
@@ -7522,7 +7529,7 @@ void ASTWriter::VariableDefinitionInstantiated(const VarDecl *D) {
if (!D->isFromASTFile())
return;
- DeclUpdates[D].push_back(DeclUpdate(UPD_CXX_ADDED_VAR_DEFINITION));
+ DeclUpdates[D].push_back(DeclUpdate(DeclUpdateKind::CXXAddedVarDefinition));
}
void ASTWriter::FunctionDefinitionInstantiated(const FunctionDecl *D) {
@@ -7535,7 +7542,8 @@ void ASTWriter::FunctionDefinitionInstantiated(const FunctionDecl *D) {
if (!D->doesThisDeclarationHaveABody())
return;
- DeclUpdates[D].push_back(DeclUpdate(UPD_CXX_ADDED_FUNCTION_DEFINITION));
+ DeclUpdates[D].push_back(
+ DeclUpdate(DeclUpdateKind::CXXAddedFunctionDefinition));
}
void ASTWriter::InstantiationRequested(const ValueDecl *D) {
@@ -7551,7 +7559,8 @@ void ASTWriter::InstantiationRequested(const ValueDecl *D) {
POI = VD->getPointOfInstantiation();
else
POI = cast<FunctionDecl>(D)->getPointOfInstantiation();
- DeclUpdates[D].push_back(DeclUpdate(UPD_CXX_POINT_OF_INSTANTIATION, POI));
+ DeclUpdates[D].push_back(
+ DeclUpdate(DeclUpdateKind::CXXPointOfInstantiation, POI));
}
void ASTWriter::DefaultArgumentInstantiated(const ParmVarDecl *D) {
@@ -7561,7 +7570,7 @@ void ASTWriter::DefaultArgumentInstantiated(const ParmVarDecl *D) {
return;
DeclUpdates[D].push_back(
- DeclUpdate(UPD_CXX_INSTANTIATED_DEFAULT_ARGUMENT, D));
+ DeclUpdate(DeclUpdateKind::CXXInstantiatedDefaultArgument, D));
}
void ASTWriter::DefaultMemberInitializerInstantiated(const FieldDecl *D) {
@@ -7570,7 +7579,7 @@ void ASTWriter::DefaultMemberInitializerInstantiated(const FieldDecl *D) {
return;
DeclUpdates[D].push_back(
- DeclUpdate(UPD_CXX_INSTANTIATED_DEFAULT_MEMBER_INITIALIZER, D));
+ DeclUpdate(DeclUpdateKind::CXXInstantiatedDefaultMemberInitializer, D));
}
void ASTWriter::AddedObjCCategoryToInterface(const ObjCCategoryDecl *CatD,
@@ -7596,7 +7605,7 @@ void ASTWriter::DeclarationMarkedUsed(const Decl *D) {
if (IsLocalDecl(Prev))
return;
- DeclUpdates[D].push_back(DeclUpdate(UPD_DECL_MARKED_USED));
+ DeclUpdates[D].push_back(DeclUpdate(DeclUpdateKind::DeclMarkedUsed));
}
void ASTWriter::DeclarationMarkedOpenMPThreadPrivate(const Decl *D) {
@@ -7605,7 +7614,8 @@ void ASTWriter::DeclarationMarkedOpenMPThreadPrivate(const Decl *D) {
if (!D->isFromASTFile())
return;
- DeclUpdates[D].push_back(DeclUpdate(UPD_DECL_MARKED_OPENMP_THREADPRIVATE));
+ DeclUpdates[D].push_back(
+ DeclUpdate(DeclUpdateKind::DeclMarkedOpenMPThreadPrivate));
}
void ASTWriter::DeclarationMarkedOpenMPAllocate(const Decl *D, const Attr *A) {
@@ -7614,7 +7624,8 @@ void ASTWriter::DeclarationMarkedOpenMPAllocate(const Decl *D, const Attr *A) {
if (!D->isFromASTFile())
return;
- DeclUpdates[D].push_back(DeclUpdate(UPD_DECL_MARKED_OPENMP_ALLOCATE, A));
+ DeclUpdates[D].push_back(
+ DeclUpdate(DeclUpdateKind::DeclMarkedOpenMPAllocate, A));
}
void ASTWriter::DeclarationMarkedOpenMPDeclareTarget(const Decl *D,
@@ -7625,14 +7636,14 @@ void ASTWriter::DeclarationMarkedOpenMPDeclareTarget(const Decl *D,
return;
DeclUpdates[D].push_back(
- DeclUpdate(UPD_DECL_MARKED_OPENMP_DECLARETARGET, Attr));
+ DeclUpdate(DeclUpdateKind::DeclMarkedOpenMPDeclareTarget, Attr));
}
void ASTWriter::RedefinedHiddenDefinition(const NamedDecl *D, Module *M) {
if (Chain && Chain->isProcessingUpdateRecords()) return;
assert(!WritingAST && "Already writing the AST!");
assert(!D->isUnconditionallyVisible() && "expected a hidden declaration");
- DeclUpdates[D].push_back(DeclUpdate(UPD_DECL_EXPORTED, M));
+ DeclUpdates[D].push_back(DeclUpdate(DeclUpdateKind::DeclExported, M));
}
void ASTWriter::AddedAttributeToRecord(const Attr *Attr,
@@ -7641,7 +7652,8 @@ void ASTWriter::AddedAttributeToRecord(const Attr *Attr,
assert(!WritingAST && "Already writing the AST!");
if (!Record->isFromASTFile())
return;
- DeclUpdates[Record].push_back(DeclUpdate(UPD_ADDED_ATTR_TO_RECORD, Attr));
+ DeclUpdates[Record].push_back(
+ DeclUpdate(DeclUpdateKind::AddedAttrToRecord, Attr));
}
void ASTWriter::AddedCXXTemplateSpecialization(
diff --git a/clang/lib/Serialization/ASTWriterDecl.cpp b/clang/lib/Serialization/ASTWriterDecl.cpp
index d1f92cea4dfea..f3d260e8671b2 100644
--- a/clang/lib/Serialization/ASTWriterDecl.cpp
+++ b/clang/lib/Serialization/ASTWriterDecl.cpp
@@ -1517,7 +1517,7 @@ void ASTDeclWriter::VisitNamespaceDecl(NamespaceDecl *D) {
D->getParent()->getRedeclContext()->getPrimaryContext());
if (Parent->isFromASTFile() || isa<TranslationUnitDecl>(Parent)) {
Writer.DeclUpdates[Parent].push_back(
- ASTWriter::DeclUpdate(UPD_CXX_ADDED_ANONYMOUS_NAMESPACE, D));
+ ASTWriter::DeclUpdate(DeclUpdateKind::CXXAddedAnonymousNamespace, D));
}
}
}
More information about the cfe-commits
mailing list