Skip to content

Commit edd690b

Browse files
authored
[clang][NFC] Refactor TagTypeKind (#71160)
This patch converts TagTypeKind into scoped enum. Among other benefits, this allows us to forward-declare it where necessary.
1 parent 9dfdbd7 commit edd690b

File tree

65 files changed

+486
-403
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+486
-403
lines changed

clang-tools-extra/clang-doc/BitcodeReader.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,13 @@ llvm::Error decodeRecord(const Record &R, AccessSpecifier &Field,
6767

6868
llvm::Error decodeRecord(const Record &R, TagTypeKind &Field,
6969
llvm::StringRef Blob) {
70-
switch (R[0]) {
71-
case TTK_Struct:
72-
case TTK_Interface:
73-
case TTK_Union:
74-
case TTK_Class:
75-
case TTK_Enum:
76-
Field = (TagTypeKind)R[0];
70+
switch (static_cast<TagTypeKind>(R[0])) {
71+
case TagTypeKind::Struct:
72+
case TagTypeKind::Interface:
73+
case TagTypeKind::Union:
74+
case TagTypeKind::Class:
75+
case TagTypeKind::Enum:
76+
Field = static_cast<TagTypeKind>(R[0]);
7777
return llvm::Error::success();
7878
default:
7979
return llvm::createStringError(llvm::inconvertibleErrorCode(),

clang-tools-extra/clang-doc/BitcodeWriter.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,7 @@ void ClangDocBitcodeWriter::emitBlock(const RecordInfo &I) {
551551
emitRecord(*I.DefLoc, RECORD_DEFLOCATION);
552552
for (const auto &L : I.Loc)
553553
emitRecord(L, RECORD_LOCATION);
554-
emitRecord(I.TagType, RECORD_TAG_TYPE);
554+
emitRecord(llvm::to_underlying(I.TagType), RECORD_TAG_TYPE);
555555
emitRecord(I.IsTypeDef, RECORD_IS_TYPE_DEF);
556556
for (const auto &N : I.Members)
557557
emitBlock(N);
@@ -578,7 +578,7 @@ void ClangDocBitcodeWriter::emitBlock(const BaseRecordInfo &I) {
578578
emitRecord(I.USR, BASE_RECORD_USR);
579579
emitRecord(I.Name, BASE_RECORD_NAME);
580580
emitRecord(I.Path, BASE_RECORD_PATH);
581-
emitRecord(I.TagType, BASE_RECORD_TAG_TYPE);
581+
emitRecord(llvm::to_underlying(I.TagType), BASE_RECORD_TAG_TYPE);
582582
emitRecord(I.IsVirtual, BASE_RECORD_IS_VIRTUAL);
583583
emitRecord(I.Access, BASE_RECORD_ACCESS);
584584
emitRecord(I.IsParent, BASE_RECORD_IS_PARENT);

clang-tools-extra/clang-doc/Generators.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,15 @@ findGeneratorByName(llvm::StringRef Format) {
2828

2929
std::string getTagType(TagTypeKind AS) {
3030
switch (AS) {
31-
case TagTypeKind::TTK_Class:
31+
case TagTypeKind::Class:
3232
return "class";
33-
case TagTypeKind::TTK_Union:
33+
case TagTypeKind::Union:
3434
return "union";
35-
case TagTypeKind::TTK_Interface:
35+
case TagTypeKind::Interface:
3636
return "interface";
37-
case TagTypeKind::TTK_Struct:
37+
case TagTypeKind::Struct:
3838
return "struct";
39-
case TagTypeKind::TTK_Enum:
39+
case TagTypeKind::Enum:
4040
return "enum";
4141
}
4242
llvm_unreachable("Unknown TagTypeKind");

clang-tools-extra/clang-doc/Representation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ RecordInfo::RecordInfo(SymbolID USR, StringRef Name, StringRef Path)
239239

240240
void RecordInfo::merge(RecordInfo &&Other) {
241241
assert(mergeable(Other));
242-
if (!TagType)
242+
if (!llvm::to_underlying(TagType))
243243
TagType = Other.TagType;
244244
IsTypeDef = IsTypeDef || Other.IsTypeDef;
245245
if (Members.empty())

clang-tools-extra/clang-doc/Representation.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ struct RecordInfo : public SymbolInfo {
350350
void merge(RecordInfo &&I);
351351

352352
// Type of this record (struct, class, union, interface).
353-
TagTypeKind TagType = TagTypeKind::TTK_Struct;
353+
TagTypeKind TagType = TagTypeKind::Struct;
354354

355355
// Full qualified name of this record, including namespaces and template
356356
// specializations.

clang-tools-extra/clang-doc/YAMLGenerator.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,11 @@ template <> struct ScalarEnumerationTraits<clang::AccessSpecifier> {
4747

4848
template <> struct ScalarEnumerationTraits<clang::TagTypeKind> {
4949
static void enumeration(IO &IO, clang::TagTypeKind &Value) {
50-
IO.enumCase(Value, "Struct", clang::TagTypeKind::TTK_Struct);
51-
IO.enumCase(Value, "Interface", clang::TagTypeKind::TTK_Interface);
52-
IO.enumCase(Value, "Union", clang::TagTypeKind::TTK_Union);
53-
IO.enumCase(Value, "Class", clang::TagTypeKind::TTK_Class);
54-
IO.enumCase(Value, "Enum", clang::TagTypeKind::TTK_Enum);
50+
IO.enumCase(Value, "Struct", clang::TagTypeKind::Struct);
51+
IO.enumCase(Value, "Interface", clang::TagTypeKind::Interface);
52+
IO.enumCase(Value, "Union", clang::TagTypeKind::Union);
53+
IO.enumCase(Value, "Class", clang::TagTypeKind::Class);
54+
IO.enumCase(Value, "Enum", clang::TagTypeKind::Enum);
5555
}
5656
};
5757

clang-tools-extra/clangd/refactor/InsertionPoint.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@ SourceLocation endLoc(const DeclContext &DC) {
8585
}
8686

8787
AccessSpecifier getAccessAtEnd(const CXXRecordDecl &C) {
88-
AccessSpecifier Spec = (C.getTagKind() == TTK_Class ? AS_private : AS_public);
88+
AccessSpecifier Spec =
89+
(C.getTagKind() == TagTypeKind::Class ? AS_private : AS_public);
8990
for (const auto *D : C.decls())
9091
if (const auto *ASD = llvm::dyn_cast<AccessSpecDecl>(D))
9192
Spec = ASD->getAccess();

clang-tools-extra/unittests/clang-doc/BitcodeTest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ TEST(BitcodeTest, emitRecordInfoBitcode) {
8181
I.Loc.emplace_back(12, llvm::SmallString<16>{"test.cpp"});
8282

8383
I.Members.emplace_back(TypeInfo("int"), "X", AccessSpecifier::AS_private);
84-
I.TagType = TagTypeKind::TTK_Class;
84+
I.TagType = TagTypeKind::Class;
8585
I.IsTypeDef = true;
8686
I.Bases.emplace_back(EmptySID, "F", "path/to/F", true,
8787
AccessSpecifier::AS_public, true);

clang-tools-extra/unittests/clang-doc/HTMLGeneratorTest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ TEST(HTMLGeneratorTest, emitRecordHTML) {
154154
SmallString<16> PathTo;
155155
llvm::sys::path::native("path/to", PathTo);
156156
I.Members.emplace_back(TypeInfo("int"), "X", AccessSpecifier::AS_private);
157-
I.TagType = TagTypeKind::TTK_Class;
157+
I.TagType = TagTypeKind::Class;
158158
I.Parents.emplace_back(EmptySID, "F", InfoType::IT_record, "F", PathTo);
159159
I.VirtualParents.emplace_back(EmptySID, "G", InfoType::IT_record);
160160

clang-tools-extra/unittests/clang-doc/MDGeneratorTest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ TEST(MDGeneratorTest, emitRecordMD) {
8686
I.Loc.emplace_back(12, llvm::SmallString<16>{"test.cpp"});
8787

8888
I.Members.emplace_back(TypeInfo("int"), "X", AccessSpecifier::AS_private);
89-
I.TagType = TagTypeKind::TTK_Class;
89+
I.TagType = TagTypeKind::Class;
9090
I.Parents.emplace_back(EmptySID, "F", InfoType::IT_record);
9191
I.VirtualParents.emplace_back(EmptySID, "G", InfoType::IT_record);
9292

clang-tools-extra/unittests/clang-doc/MergeTest.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ TEST(MergeTest, mergeRecordInfos) {
8484
One.DefLoc = Location(10, llvm::SmallString<16>{"test.cpp"});
8585

8686
One.Members.emplace_back(TypeInfo("int"), "X", AccessSpecifier::AS_private);
87-
One.TagType = TagTypeKind::TTK_Class;
87+
One.TagType = TagTypeKind::Class;
8888
One.Parents.emplace_back(EmptySID, "F", InfoType::IT_record);
8989
One.VirtualParents.emplace_back(EmptySID, "G", InfoType::IT_record);
9090

@@ -105,7 +105,7 @@ TEST(MergeTest, mergeRecordInfos) {
105105

106106
Two.Loc.emplace_back(12, llvm::SmallString<16>{"test.cpp"});
107107

108-
Two.TagType = TagTypeKind::TTK_Class;
108+
Two.TagType = TagTypeKind::Class;
109109

110110
Two.Children.Records.emplace_back(NonEmptySID, "SharedChildStruct",
111111
InfoType::IT_record, "path");
@@ -128,7 +128,7 @@ TEST(MergeTest, mergeRecordInfos) {
128128

129129
Expected->Members.emplace_back(TypeInfo("int"), "X",
130130
AccessSpecifier::AS_private);
131-
Expected->TagType = TagTypeKind::TTK_Class;
131+
Expected->TagType = TagTypeKind::Class;
132132
Expected->Parents.emplace_back(EmptySID, "F", InfoType::IT_record);
133133
Expected->VirtualParents.emplace_back(EmptySID, "G", InfoType::IT_record);
134134
Expected->Bases.emplace_back(EmptySID, "F", "path/to/F", true,

clang-tools-extra/unittests/clang-doc/SerializeTest.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ typedef struct {} G;)raw",
167167
RecordInfo ExpectedE(EmptySID, /*Name=*/"E", /*Path=*/"GlobalNamespace");
168168
ExpectedE.Namespace.emplace_back(EmptySID, "GlobalNamespace",
169169
InfoType::IT_namespace);
170-
ExpectedE.TagType = TagTypeKind::TTK_Class;
170+
ExpectedE.TagType = TagTypeKind::Class;
171171
ExpectedE.DefLoc = Location(0, llvm::SmallString<16>{"test.cpp"});
172172
ExpectedE.Members.emplace_back(TypeInfo("int"), "value",
173173
AccessSpecifier::AS_public);
@@ -210,7 +210,7 @@ typedef struct {} G;)raw",
210210
RecordInfo ExpectedF(EmptySID, /*Name=*/"F", /*Path=*/"GlobalNamespace");
211211
ExpectedF.Namespace.emplace_back(EmptySID, "GlobalNamespace",
212212
InfoType::IT_namespace);
213-
ExpectedF.TagType = TagTypeKind::TTK_Struct;
213+
ExpectedF.TagType = TagTypeKind::Struct;
214214
ExpectedF.DefLoc = Location(0, llvm::SmallString<16>{"test.cpp"});
215215
CheckRecordInfo(&ExpectedF, F);
216216

@@ -253,7 +253,7 @@ typedef struct {} G;)raw",
253253
RecordInfo ExpectedG(EmptySID, /*Name=*/"G", /*Path=*/"GlobalNamespace");
254254
ExpectedG.Namespace.emplace_back(EmptySID, "GlobalNamespace",
255255
InfoType::IT_namespace);
256-
ExpectedG.TagType = TagTypeKind::TTK_Struct;
256+
ExpectedG.TagType = TagTypeKind::Struct;
257257
ExpectedG.DefLoc = Location(0, llvm::SmallString<16>{"test.cpp"});
258258
ExpectedG.IsTypeDef = true;
259259
CheckRecordInfo(&ExpectedG, G);
@@ -295,7 +295,7 @@ TEST(SerializeTest, emitUndefinedRecordInfo) {
295295
RecordInfo ExpectedE(EmptySID, /*Name=*/"E", /*Path=*/"GlobalNamespace");
296296
ExpectedE.Namespace.emplace_back(EmptySID, "GlobalNamespace",
297297
InfoType::IT_namespace);
298-
ExpectedE.TagType = TagTypeKind::TTK_Class;
298+
ExpectedE.TagType = TagTypeKind::Class;
299299
ExpectedE.Loc.emplace_back(0, llvm::SmallString<16>{"test.cpp"});
300300
CheckRecordInfo(&ExpectedE, E);
301301
}
@@ -308,7 +308,7 @@ TEST(SerializeTest, emitRecordMemberInfo) {
308308
RecordInfo ExpectedE(EmptySID, /*Name=*/"E", /*Path=*/"GlobalNamespace");
309309
ExpectedE.Namespace.emplace_back(EmptySID, "GlobalNamespace",
310310
InfoType::IT_namespace);
311-
ExpectedE.TagType = TagTypeKind::TTK_Struct;
311+
ExpectedE.TagType = TagTypeKind::Struct;
312312
ExpectedE.DefLoc = Location(0, llvm::SmallString<16>{"test.cpp"});
313313
ExpectedE.Members.emplace_back(TypeInfo("int"), "I",
314314
AccessSpecifier::AS_public);
@@ -324,15 +324,15 @@ TEST(SerializeTest, emitInternalRecordInfo) {
324324
ExpectedE.Namespace.emplace_back(EmptySID, "GlobalNamespace",
325325
InfoType::IT_namespace);
326326
ExpectedE.DefLoc = Location(0, llvm::SmallString<16>{"test.cpp"});
327-
ExpectedE.TagType = TagTypeKind::TTK_Class;
327+
ExpectedE.TagType = TagTypeKind::Class;
328328
CheckRecordInfo(&ExpectedE, E);
329329

330330
RecordInfo *G = InfoAsRecord(Infos[2].get());
331331
llvm::SmallString<128> ExpectedGPath("GlobalNamespace/E");
332332
llvm::sys::path::native(ExpectedGPath);
333333
RecordInfo ExpectedG(EmptySID, /*Name=*/"G", /*Path=*/ExpectedGPath);
334334
ExpectedG.DefLoc = Location(0, llvm::SmallString<16>{"test.cpp"});
335-
ExpectedG.TagType = TagTypeKind::TTK_Class;
335+
ExpectedG.TagType = TagTypeKind::Class;
336336
ExpectedG.Namespace.emplace_back(EmptySID, "E", InfoType::IT_record);
337337
ExpectedG.Namespace.emplace_back(EmptySID, "GlobalNamespace",
338338
InfoType::IT_namespace);
@@ -391,15 +391,15 @@ class J : public I<int> {} ;)raw",
391391
RecordInfo ExpectedF(EmptySID, /*Name=*/"F", /*Path=*/"GlobalNamespace");
392392
ExpectedF.Namespace.emplace_back(EmptySID, "GlobalNamespace",
393393
InfoType::IT_namespace, "");
394-
ExpectedF.TagType = TagTypeKind::TTK_Class;
394+
ExpectedF.TagType = TagTypeKind::Class;
395395
ExpectedF.DefLoc = Location(0, llvm::SmallString<16>{"test.cpp"});
396396
CheckRecordInfo(&ExpectedF, F);
397397

398398
RecordInfo *G = InfoAsRecord(Infos[3].get());
399399
RecordInfo ExpectedG(EmptySID, /*Name=*/"G", /*Path=*/"GlobalNamespace");
400400
ExpectedG.Namespace.emplace_back(EmptySID, "GlobalNamespace",
401401
InfoType::IT_namespace);
402-
ExpectedG.TagType = TagTypeKind::TTK_Class;
402+
ExpectedG.TagType = TagTypeKind::Class;
403403
ExpectedG.DefLoc = Location(0, llvm::SmallString<16>{"test.cpp"});
404404
ExpectedG.Members.emplace_back(TypeInfo("int"), "I",
405405
AccessSpecifier::AS_protected);
@@ -446,14 +446,14 @@ class J : public I<int> {} ;)raw",
446446
ExpectedE.Bases.back().Members.emplace_back(TypeInfo("int"), "I",
447447
AccessSpecifier::AS_private);
448448
ExpectedE.DefLoc = Location(0, llvm::SmallString<16>{"test.cpp"});
449-
ExpectedE.TagType = TagTypeKind::TTK_Class;
449+
ExpectedE.TagType = TagTypeKind::Class;
450450
CheckRecordInfo(&ExpectedE, E);
451451

452452
RecordInfo *H = InfoAsRecord(Infos[8].get());
453453
RecordInfo ExpectedH(EmptySID, /*Name=*/"H", /*Path=*/"GlobalNamespace");
454454
ExpectedH.Namespace.emplace_back(EmptySID, "GlobalNamespace",
455455
InfoType::IT_namespace);
456-
ExpectedH.TagType = TagTypeKind::TTK_Class;
456+
ExpectedH.TagType = TagTypeKind::Class;
457457
ExpectedH.DefLoc = Location(0, llvm::SmallString<16>{"test.cpp"});
458458
ExpectedH.Parents.emplace_back(EmptySID, /*Name=*/"E", InfoType::IT_record,
459459
/*QualName=*/"E", /*Path=*/"GlobalNamespace");
@@ -500,7 +500,7 @@ class J : public I<int> {} ;)raw",
500500
RecordInfo ExpectedI(EmptySID, /*Name=*/"I", /*Path=*/"GlobalNamespace");
501501
ExpectedI.Namespace.emplace_back(EmptySID, "GlobalNamespace",
502502
InfoType::IT_namespace);
503-
ExpectedI.TagType = TagTypeKind::TTK_Class;
503+
ExpectedI.TagType = TagTypeKind::Class;
504504
ExpectedI.DefLoc = Location(0, llvm::SmallString<16>{"test.cpp"});
505505
CheckRecordInfo(&ExpectedI, I);
506506

@@ -514,7 +514,7 @@ class J : public I<int> {} ;)raw",
514514
/*Path=*/"GlobalNamespace", false,
515515
AccessSpecifier::AS_public, true);
516516
ExpectedJ.DefLoc = Location(0, llvm::SmallString<16>{"test.cpp"});
517-
ExpectedJ.TagType = TagTypeKind::TTK_Class;
517+
ExpectedJ.TagType = TagTypeKind::Class;
518518
CheckRecordInfo(&ExpectedJ, J);
519519
}
520520

clang-tools-extra/unittests/clang-doc/YAMLGeneratorTest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ TEST(YAMLGeneratorTest, emitRecordYAML) {
101101
Brief->Children.back()->Text = "Value of the thing.";
102102
I.Members.back().Description.push_back(std::move(TopComment));
103103

104-
I.TagType = TagTypeKind::TTK_Class;
104+
I.TagType = TagTypeKind::Class;
105105
I.Bases.emplace_back(EmptySID, "F", "path/to/F", true,
106106
AccessSpecifier::AS_public, true);
107107
I.Bases.back().Children.Functions.emplace_back();

clang/include/clang/AST/ASTContext.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1197,8 +1197,9 @@ class ASTContext : public RefCountedBase<ASTContext> {
11971197

11981198
/// Create a new implicit TU-level CXXRecordDecl or RecordDecl
11991199
/// declaration.
1200-
RecordDecl *buildImplicitRecord(StringRef Name,
1201-
RecordDecl::TagKind TK = TTK_Struct) const;
1200+
RecordDecl *buildImplicitRecord(
1201+
StringRef Name,
1202+
RecordDecl::TagKind TK = RecordDecl::TagKind::Struct) const;
12021203

12031204
/// Create a new implicit TU-level typedef declaration.
12041205
TypedefDecl *buildImplicitTypedef(QualType T, StringRef Name) const;

clang/include/clang/AST/Decl.h

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3703,13 +3703,15 @@ class TagDecl : public TypeDecl,
37033703
return static_cast<TagKind>(TagDeclBits.TagDeclKind);
37043704
}
37053705

3706-
void setTagKind(TagKind TK) { TagDeclBits.TagDeclKind = TK; }
3706+
void setTagKind(TagKind TK) {
3707+
TagDeclBits.TagDeclKind = llvm::to_underlying(TK);
3708+
}
37073709

3708-
bool isStruct() const { return getTagKind() == TTK_Struct; }
3709-
bool isInterface() const { return getTagKind() == TTK_Interface; }
3710-
bool isClass() const { return getTagKind() == TTK_Class; }
3711-
bool isUnion() const { return getTagKind() == TTK_Union; }
3712-
bool isEnum() const { return getTagKind() == TTK_Enum; }
3710+
bool isStruct() const { return getTagKind() == TagTypeKind::Struct; }
3711+
bool isInterface() const { return getTagKind() == TagTypeKind::Interface; }
3712+
bool isClass() const { return getTagKind() == TagTypeKind::Class; }
3713+
bool isUnion() const { return getTagKind() == TagTypeKind::Union; }
3714+
bool isEnum() const { return getTagKind() == TagTypeKind::Enum; }
37133715

37143716
/// Is this tag type named, either directly or via being defined in
37153717
/// a typedef of this type?

clang/include/clang/AST/Type.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5718,21 +5718,21 @@ enum class ElaboratedTypeKeyword {
57185718
};
57195719

57205720
/// The kind of a tag type.
5721-
enum TagTypeKind {
5721+
enum class TagTypeKind {
57225722
/// The "struct" keyword.
5723-
TTK_Struct,
5723+
Struct,
57245724

57255725
/// The "__interface" keyword.
5726-
TTK_Interface,
5726+
Interface,
57275727

57285728
/// The "union" keyword.
5729-
TTK_Union,
5729+
Union,
57305730

57315731
/// The "class" keyword.
5732-
TTK_Class,
5732+
Class,
57335733

57345734
/// The "enum" keyword.
5735-
TTK_Enum
5735+
Enum
57365736
};
57375737

57385738
/// A helper class for Type nodes having an ElaboratedTypeKeyword.

clang/lib/AST/ASTContext.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6525,12 +6525,12 @@ bool ASTContext::isSameEntity(const NamedDecl *X, const NamedDecl *Y) const {
65256525
if (const auto *TagX = dyn_cast<TagDecl>(X)) {
65266526
const auto *TagY = cast<TagDecl>(Y);
65276527
return (TagX->getTagKind() == TagY->getTagKind()) ||
6528-
((TagX->getTagKind() == TTK_Struct ||
6529-
TagX->getTagKind() == TTK_Class ||
6530-
TagX->getTagKind() == TTK_Interface) &&
6531-
(TagY->getTagKind() == TTK_Struct ||
6532-
TagY->getTagKind() == TTK_Class ||
6533-
TagY->getTagKind() == TTK_Interface));
6528+
((TagX->getTagKind() == TagTypeKind::Struct ||
6529+
TagX->getTagKind() == TagTypeKind::Class ||
6530+
TagX->getTagKind() == TagTypeKind::Interface) &&
6531+
(TagY->getTagKind() == TagTypeKind::Struct ||
6532+
TagY->getTagKind() == TagTypeKind::Class ||
6533+
TagY->getTagKind() == TagTypeKind::Interface));
65346534
}
65356535

65366536
// Functions with the same type and linkage match.

clang/lib/AST/Decl.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4639,8 +4639,8 @@ TagDecl::TagDecl(Kind DK, TagKind TK, const ASTContext &C, DeclContext *DC,
46394639
SourceLocation StartL)
46404640
: TypeDecl(DK, DC, L, Id, StartL), DeclContext(DK), redeclarable_base(C),
46414641
TypedefNameDeclOrQualifier((TypedefNameDecl *)nullptr) {
4642-
assert((DK != Enum || TK == TTK_Enum) &&
4643-
"EnumDecl not matched with TTK_Enum");
4642+
assert((DK != Enum || TK == TagTypeKind::Enum) &&
4643+
"EnumDecl not matched with TagTypeKind::Enum");
46444644
setPreviousDecl(PrevDecl);
46454645
setTagKind(TK);
46464646
setCompleteDefinition(false);
@@ -4773,7 +4773,7 @@ void TagDecl::setTemplateParameterListsInfo(
47734773
EnumDecl::EnumDecl(ASTContext &C, DeclContext *DC, SourceLocation StartLoc,
47744774
SourceLocation IdLoc, IdentifierInfo *Id, EnumDecl *PrevDecl,
47754775
bool Scoped, bool ScopedUsingClassTag, bool Fixed)
4776-
: TagDecl(Enum, TTK_Enum, C, DC, IdLoc, Id, PrevDecl, StartLoc) {
4776+
: TagDecl(Enum, TagTypeKind::Enum, C, DC, IdLoc, Id, PrevDecl, StartLoc) {
47774777
assert(Scoped || !ScopedUsingClassTag);
47784778
IntegerType = nullptr;
47794779
setNumPositiveBits(0);
@@ -4962,9 +4962,9 @@ RecordDecl *RecordDecl::Create(const ASTContext &C, TagKind TK, DeclContext *DC,
49624962
}
49634963

49644964
RecordDecl *RecordDecl::CreateDeserialized(const ASTContext &C, unsigned ID) {
4965-
RecordDecl *R =
4966-
new (C, ID) RecordDecl(Record, TTK_Struct, C, nullptr, SourceLocation(),
4967-
SourceLocation(), nullptr, nullptr);
4965+
RecordDecl *R = new (C, ID)
4966+
RecordDecl(Record, TagTypeKind::Struct, C, nullptr, SourceLocation(),
4967+
SourceLocation(), nullptr, nullptr);
49684968
R->setMayHaveOutOfDateDef(C.getLangOpts().Modules);
49694969
return R;
49704970
}

0 commit comments

Comments
 (0)