diff options
author | Jun Zhang <jun@junz.org> | 2022-04-16 11:27:18 +0800 |
---|---|---|
committer | Jun Zhang <jun@junz.org> | 2022-04-16 11:31:40 +0800 |
commit | 7fde4e221300dbdefe9cdd70ff59f22f1dc9aee9 (patch) | |
tree | ab9acfc45dd646535ba945d2ecba0bef56f5f281 /clang/lib/Parse/ParseDecl.cpp | |
parent | 9f5f2eb2a1085d49afbf9e6912086c6a3b5e6a95 (diff) | |
download | llvm-7fde4e221300dbdefe9cdd70ff59f22f1dc9aee9.zip llvm-7fde4e221300dbdefe9cdd70ff59f22f1dc9aee9.tar.gz llvm-7fde4e221300dbdefe9cdd70ff59f22f1dc9aee9.tar.bz2 |
Add some helpers to better check Scope's kind. NFC
Signed-off-by: Jun Zhang <jun@junz.org>
Diffstat (limited to 'clang/lib/Parse/ParseDecl.cpp')
-rw-r--r-- | clang/lib/Parse/ParseDecl.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp index ca55fa9..233f092 100644 --- a/clang/lib/Parse/ParseDecl.cpp +++ b/clang/lib/Parse/ParseDecl.cpp @@ -4624,8 +4624,8 @@ void Parser::ParseEnumSpecifier(SourceLocation StartLoc, DeclSpec &DS, TypeResult BaseType; SourceRange BaseRange; - bool CanBeBitfield = (getCurScope()->getFlags() & Scope::ClassScope) && - ScopedEnumKWLoc.isInvalid() && Name; + bool CanBeBitfield = + getCurScope()->isClassScope() && ScopedEnumKWLoc.isInvalid() && Name; // Parse the fixed underlying type. if (Tok.is(tok::colon)) { @@ -5021,7 +5021,7 @@ void Parser::ParseEnumBody(SourceLocation StartLoc, Decl *EnumDecl) { // The next token must be valid after an enum definition. If not, a ';' // was probably forgotten. - bool CanBeBitfield = getCurScope()->getFlags() & Scope::ClassScope; + bool CanBeBitfield = getCurScope()->isClassScope(); if (!isValidAfterTypeSpecifier(CanBeBitfield)) { ExpectAndConsume(tok::semi, diag::err_expected_after, "enum"); // Push this token back into the preprocessor and change our current token @@ -6753,8 +6753,7 @@ void Parser::ParseFunctionDeclarator(Declarator &D, // this in C and not C++, where the decls will continue to live in the // surrounding context. SmallVector<NamedDecl *, 0> DeclsInPrototype; - if (getCurScope()->getFlags() & Scope::FunctionDeclarationScope && - !getLangOpts().CPlusPlus) { + if (getCurScope()->isFunctionDeclarationScope() && !getLangOpts().CPlusPlus) { for (Decl *D : getCurScope()->decls()) { NamedDecl *ND = dyn_cast<NamedDecl>(D); if (!ND || isa<ParmVarDecl>(ND)) |