forked from OSchip/llvm-project
Convert sequence of 'if's on the same value to a switch. No functionality change intended.
llvm-svn: 293354
This commit is contained in:
parent
351099022a
commit
b55f75826a
|
@ -2958,56 +2958,47 @@ void Parser::SkipCXXMemberSpecification(SourceLocation RecordLoc,
|
||||||
Parser::DeclGroupPtrTy Parser::ParseCXXClassMemberDeclarationWithPragmas(
|
Parser::DeclGroupPtrTy Parser::ParseCXXClassMemberDeclarationWithPragmas(
|
||||||
AccessSpecifier &AS, ParsedAttributesWithRange &AccessAttrs,
|
AccessSpecifier &AS, ParsedAttributesWithRange &AccessAttrs,
|
||||||
DeclSpec::TST TagType, Decl *TagDecl) {
|
DeclSpec::TST TagType, Decl *TagDecl) {
|
||||||
if (getLangOpts().MicrosoftExt &&
|
switch (Tok.getKind()) {
|
||||||
Tok.isOneOf(tok::kw___if_exists, tok::kw___if_not_exists)) {
|
case tok::kw___if_exists:
|
||||||
|
case tok::kw___if_not_exists:
|
||||||
ParseMicrosoftIfExistsClassDeclaration(TagType, AS);
|
ParseMicrosoftIfExistsClassDeclaration(TagType, AS);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
|
||||||
|
|
||||||
|
case tok::semi:
|
||||||
// Check for extraneous top-level semicolon.
|
// Check for extraneous top-level semicolon.
|
||||||
if (Tok.is(tok::semi)) {
|
|
||||||
ConsumeExtraSemi(InsideStruct, TagType);
|
ConsumeExtraSemi(InsideStruct, TagType);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
|
||||||
|
|
||||||
if (Tok.is(tok::annot_pragma_vis)) {
|
// Handle pragmas that can appear as member declarations.
|
||||||
|
case tok::annot_pragma_vis:
|
||||||
HandlePragmaVisibility();
|
HandlePragmaVisibility();
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
case tok::annot_pragma_pack:
|
||||||
|
|
||||||
if (Tok.is(tok::annot_pragma_pack)) {
|
|
||||||
HandlePragmaPack();
|
HandlePragmaPack();
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
case tok::annot_pragma_align:
|
||||||
|
|
||||||
if (Tok.is(tok::annot_pragma_align)) {
|
|
||||||
HandlePragmaAlign();
|
HandlePragmaAlign();
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
case tok::annot_pragma_ms_pointers_to_members:
|
||||||
|
|
||||||
if (Tok.is(tok::annot_pragma_ms_pointers_to_members)) {
|
|
||||||
HandlePragmaMSPointersToMembers();
|
HandlePragmaMSPointersToMembers();
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
case tok::annot_pragma_ms_pragma:
|
||||||
|
|
||||||
if (Tok.is(tok::annot_pragma_ms_pragma)) {
|
|
||||||
HandlePragmaMSPragma();
|
HandlePragmaMSPragma();
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
case tok::annot_pragma_ms_vtordisp:
|
||||||
|
|
||||||
if (Tok.is(tok::annot_pragma_ms_vtordisp)) {
|
|
||||||
HandlePragmaMSVtorDisp();
|
HandlePragmaMSVtorDisp();
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
|
||||||
|
|
||||||
|
case tok::kw_namespace:
|
||||||
// If we see a namespace here, a close brace was missing somewhere.
|
// If we see a namespace here, a close brace was missing somewhere.
|
||||||
if (Tok.is(tok::kw_namespace)) {
|
|
||||||
DiagnoseUnexpectedNamespace(cast<NamedDecl>(TagDecl));
|
DiagnoseUnexpectedNamespace(cast<NamedDecl>(TagDecl));
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
|
||||||
|
|
||||||
|
case tok::kw_public:
|
||||||
|
case tok::kw_protected:
|
||||||
|
case tok::kw_private: {
|
||||||
AccessSpecifier NewAS = getAccessSpecifierIfPresent();
|
AccessSpecifier NewAS = getAccessSpecifierIfPresent();
|
||||||
if (NewAS != AS_none) {
|
assert(NewAS != AS_none);
|
||||||
// Current token is a C++ access specifier.
|
// Current token is a C++ access specifier.
|
||||||
AS = NewAS;
|
AS = NewAS;
|
||||||
SourceLocation ASLoc = Tok.getLocation();
|
SourceLocation ASLoc = Tok.getLocation();
|
||||||
|
@ -3042,12 +3033,13 @@ Parser::DeclGroupPtrTy Parser::ParseCXXClassMemberDeclarationWithPragmas(
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Tok.is(tok::annot_pragma_openmp))
|
case tok::annot_pragma_openmp:
|
||||||
return ParseOpenMPDeclarativeDirectiveWithExtDecl(AS, AccessAttrs, TagType,
|
return ParseOpenMPDeclarativeDirectiveWithExtDecl(AS, AccessAttrs, TagType,
|
||||||
TagDecl);
|
TagDecl);
|
||||||
|
|
||||||
// Parse all the comma separated declarators.
|
default:
|
||||||
return ParseCXXClassMemberDeclaration(AS, AccessAttrs.getList());
|
return ParseCXXClassMemberDeclaration(AS, AccessAttrs.getList());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// ParseCXXMemberSpecification - Parse the class definition.
|
/// ParseCXXMemberSpecification - Parse the class definition.
|
||||||
|
|
Loading…
Reference in New Issue