Skip to content

Commit 64c6495

Browse files
committed
[clang][NFC] Move Sema::SkipBodyInfo into namespace scope
This makes it forward-declarable, and needed from splitting `Sema` up.
1 parent 1bccbe1 commit 64c6495

File tree

6 files changed

+15
-15
lines changed

6 files changed

+15
-15
lines changed

clang/include/clang/Sema/Sema.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,14 @@ class PreferredTypeBuilder {
352352
llvm::function_ref<QualType()> ComputeType;
353353
};
354354

355+
struct SkipBodyInfo {
356+
SkipBodyInfo() = default;
357+
bool ShouldSkip = false;
358+
bool CheckSameAsPrevious = false;
359+
NamedDecl *Previous = nullptr;
360+
NamedDecl *New = nullptr;
361+
};
362+
355363
/// Describes the result of template argument deduction.
356364
///
357365
/// The TemplateDeductionResult enumeration describes the result of
@@ -2627,14 +2635,6 @@ class Sema final : public SemaBase {
26272635
return Entity->getOwningModule();
26282636
}
26292637

2630-
struct SkipBodyInfo {
2631-
SkipBodyInfo() = default;
2632-
bool ShouldSkip = false;
2633-
bool CheckSameAsPrevious = false;
2634-
NamedDecl *Previous = nullptr;
2635-
NamedDecl *New = nullptr;
2636-
};
2637-
26382638
DeclGroupPtrTy ConvertDeclToDeclGroup(Decl *Ptr, Decl *OwnedType = nullptr);
26392639

26402640
ParsedType getTypeName(const IdentifierInfo &II, SourceLocation NameLoc,

clang/lib/Parse/ParseDecl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5331,7 +5331,7 @@ void Parser::ParseEnumSpecifier(SourceLocation StartLoc, DeclSpec &DS,
53315331

53325332
stripTypeAttributesOffDeclSpec(attrs, DS, TUK);
53335333

5334-
Sema::SkipBodyInfo SkipBody;
5334+
SkipBodyInfo SkipBody;
53355335
if (!Name && TUK == Sema::TUK_Definition && Tok.is(tok::l_brace) &&
53365336
NextToken().is(tok::identifier))
53375337
SkipBody = Actions.shouldSkipAnonEnumBody(getCurScope(),

clang/lib/Parse/ParseDeclCXX.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2092,7 +2092,7 @@ void Parser::ParseClassSpecifier(tok::TokenKind TagTokKind,
20922092
TypeResult TypeResult = true; // invalid
20932093

20942094
bool Owned = false;
2095-
Sema::SkipBodyInfo SkipBody;
2095+
SkipBodyInfo SkipBody;
20962096
if (TemplateId) {
20972097
// Explicit specialization, class template partial specialization,
20982098
// or explicit instantiation.

clang/lib/Parse/ParseObjc.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ Decl *Parser::ParseObjCAtInterfaceDeclaration(SourceLocation AtLoc,
375375
Actions.ActOnTypedefedProtocols(protocols, protocolLocs,
376376
superClassId, superClassLoc);
377377

378-
Sema::SkipBodyInfo SkipBody;
378+
SkipBodyInfo SkipBody;
379379
ObjCInterfaceDecl *ClsType = Actions.ActOnStartClassInterface(
380380
getCurScope(), AtLoc, nameId, nameLoc, typeParameterList, superClassId,
381381
superClassLoc, typeArgs,
@@ -2133,7 +2133,7 @@ Parser::ParseObjCAtProtocolDeclaration(SourceLocation AtLoc,
21332133
/*consumeLastToken=*/true))
21342134
return nullptr;
21352135

2136-
Sema::SkipBodyInfo SkipBody;
2136+
SkipBodyInfo SkipBody;
21372137
ObjCProtocolDecl *ProtoType = Actions.ActOnStartProtocolInterface(
21382138
AtLoc, protocolName, nameLoc, ProtocolRefs.data(), ProtocolRefs.size(),
21392139
ProtocolLocs.data(), EndProtoLoc, attrs, &SkipBody);

clang/lib/Parse/Parser.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1441,7 +1441,7 @@ Decl *Parser::ParseFunctionDefinition(ParsingDeclarator &D,
14411441

14421442
// Tell the actions module that we have entered a function definition with the
14431443
// specified Declarator for the function.
1444-
Sema::SkipBodyInfo SkipBody;
1444+
SkipBodyInfo SkipBody;
14451445
Decl *Res = Actions.ActOnStartOfFunctionDef(getCurScope(), D,
14461446
TemplateInfo.TemplateParams
14471447
? *TemplateInfo.TemplateParams

clang/lib/Sema/SemaDecl.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3037,7 +3037,7 @@ static void checkNewAttributesAfterDef(Sema &S, Decl *New, const Decl *Old) {
30373037

30383038
if (isa<AliasAttr>(NewAttribute) || isa<IFuncAttr>(NewAttribute)) {
30393039
if (FunctionDecl *FD = dyn_cast<FunctionDecl>(New)) {
3040-
Sema::SkipBodyInfo SkipBody;
3040+
SkipBodyInfo SkipBody;
30413041
S.CheckForFunctionRedefinition(FD, cast<FunctionDecl>(Def), &SkipBody);
30423042

30433043
// If we're skipping this definition, drop the "alias" attribute.
@@ -19999,7 +19999,7 @@ EnumConstantDecl *Sema::CheckEnumConstant(EnumDecl *Enum,
1999919999
Val, EnumVal);
2000020000
}
2000120001

20002-
Sema::SkipBodyInfo Sema::shouldSkipAnonEnumBody(Scope *S, IdentifierInfo *II,
20002+
SkipBodyInfo Sema::shouldSkipAnonEnumBody(Scope *S, IdentifierInfo *II,
2000320003
SourceLocation IILoc) {
2000420004
if (!(getLangOpts().Modules || getLangOpts().ModulesLocalVisibility) ||
2000520005
!getLangOpts().CPlusPlus)

0 commit comments

Comments
 (0)