diff options
author | David Blaikie <dblaikie@gmail.com> | 2012-03-11 07:00:24 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2012-03-11 07:00:24 +0000 |
commit | 4e4d08403ca5cfd4d558fa2936215d3a4e5a528d (patch) | |
tree | bc9bf6ce1639dc8a7ba02d0e3046ab14b5329d8c /lib/Parse | |
parent | 7c02cfeb0861278c09ba05d1b92bd2a996bbe2e0 (diff) |
Unify naming of LangOptions variable/get function across the Clang stack (Lex to AST).
The member variable is always "LangOpts" and the member function is always "getLangOpts".
Reviewed by Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152536 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse')
-rw-r--r-- | lib/Parse/ParseCXXInlineMethods.cpp | 8 | ||||
-rw-r--r-- | lib/Parse/ParseDecl.cpp | 146 | ||||
-rw-r--r-- | lib/Parse/ParseDeclCXX.cpp | 44 | ||||
-rw-r--r-- | lib/Parse/ParseExpr.cpp | 64 | ||||
-rw-r--r-- | lib/Parse/ParseExprCXX.cpp | 30 | ||||
-rw-r--r-- | lib/Parse/ParseInit.cpp | 12 | ||||
-rw-r--r-- | lib/Parse/ParseObjc.cpp | 26 | ||||
-rw-r--r-- | lib/Parse/ParsePragma.cpp | 4 | ||||
-rw-r--r-- | lib/Parse/ParseStmt.cpp | 38 | ||||
-rw-r--r-- | lib/Parse/ParseTemplate.cpp | 8 | ||||
-rw-r--r-- | lib/Parse/ParseTentative.cpp | 22 | ||||
-rw-r--r-- | lib/Parse/Parser.cpp | 60 |
12 files changed, 231 insertions, 231 deletions
diff --git a/lib/Parse/ParseCXXInlineMethods.cpp b/lib/Parse/ParseCXXInlineMethods.cpp index 6fe33f4860..7ee74ecc76 100644 --- a/lib/Parse/ParseCXXInlineMethods.cpp +++ b/lib/Parse/ParseCXXInlineMethods.cpp @@ -74,7 +74,7 @@ Decl *Parser::ParseCXXInlineMethodDef(AccessSpecifier AS, bool Delete = false; SourceLocation KWLoc; if (Tok.is(tok::kw_delete)) { - Diag(Tok, getLang().CPlusPlus0x ? + Diag(Tok, getLangOpts().CPlusPlus0x ? diag::warn_cxx98_compat_deleted_function : diag::ext_deleted_function); @@ -82,7 +82,7 @@ Decl *Parser::ParseCXXInlineMethodDef(AccessSpecifier AS, Actions.SetDeclDeleted(FnD, KWLoc); Delete = true; } else if (Tok.is(tok::kw_default)) { - Diag(Tok, getLang().CPlusPlus0x ? + Diag(Tok, getLangOpts().CPlusPlus0x ? diag::warn_cxx98_compat_defaulted_function : diag::ext_defaulted_function); @@ -107,7 +107,7 @@ Decl *Parser::ParseCXXInlineMethodDef(AccessSpecifier AS, // In delayed template parsing mode, if we are within a class template // or if we are about to parse function member template then consume // the tokens and store them for parsing at the end of the translation unit. - if (getLang().DelayedTemplateParsing && + if (getLangOpts().DelayedTemplateParsing && ((Actions.CurContext->isDependentContext() || TemplateInfo.Kind != ParsedTemplateInfo::NonTemplate) && !Actions.IsInsideALocalClassWithinATemplateFunction())) { @@ -632,7 +632,7 @@ bool Parser::ConsumeAndStoreFunctionPrologue(CachedTokens &Toks) { ConsumeBrace(); // In C++03, this has to be the start of the function body, which // means the initializer is malformed; we'll diagnose it later. - if (!getLang().CPlusPlus0x) + if (!getLangOpts().CPlusPlus0x) return false; } diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp index 2eb66d50d8..12866b9127 100644 --- a/lib/Parse/ParseDecl.cpp +++ b/lib/Parse/ParseDecl.cpp @@ -934,7 +934,7 @@ Parser::DeclGroupPtrTy Parser::ParseDeclaration(StmtVector &Stmts, break; case tok::kw_inline: // Could be the start of an inline namespace. Allowed as an ext in C++03. - if (getLang().CPlusPlus && NextToken().is(tok::kw_namespace)) { + if (getLangOpts().CPlusPlus && NextToken().is(tok::kw_namespace)) { ProhibitAttributes(attrs); SourceLocation InlineLoc = ConsumeToken(); SingleDecl = ParseNamespace(Context, DeclEnd, InlineLoc); @@ -1023,14 +1023,14 @@ bool Parser::MightBeDeclarator(unsigned Context) { case tok::amp: case tok::ampamp: - return getLang().CPlusPlus; + return getLangOpts().CPlusPlus; case tok::l_square: // Might be an attribute on an unnamed bit-field. - return Context == Declarator::MemberContext && getLang().CPlusPlus0x && + return Context == Declarator::MemberContext && getLangOpts().CPlusPlus0x && NextToken().is(tok::l_square); case tok::colon: // Might be a typo for '::' or an unnamed bit-field. - return Context == Declarator::MemberContext || getLang().CPlusPlus; + return Context == Declarator::MemberContext || getLangOpts().CPlusPlus; case tok::identifier: switch (NextToken().getKind()) { @@ -1057,10 +1057,10 @@ bool Parser::MightBeDeclarator(unsigned Context) { // and in block scope it's probably a label. Inside a class definition, // this is a bit-field. return Context == Declarator::MemberContext || - (getLang().CPlusPlus && Context == Declarator::FileContext); + (getLangOpts().CPlusPlus && Context == Declarator::FileContext); case tok::identifier: // Possible virt-specifier. - return getLang().CPlusPlus0x && isCXX0XVirtSpecifier(NextToken()); + return getLangOpts().CPlusPlus0x && isCXX0XVirtSpecifier(NextToken()); default: return false; @@ -1324,7 +1324,7 @@ Decl *Parser::ParseDeclarationAfterDeclaratorAndAttributes(Declarator &D, else Diag(ConsumeToken(), diag::err_default_special_members); } else { - if (getLang().CPlusPlus && D.getCXXScopeSpec().isSet()) { + if (getLangOpts().CPlusPlus && D.getCXXScopeSpec().isSet()) { EnterScope(0); Actions.ActOnCXXEnterDeclInitializer(getCurScope(), ThisDecl); } @@ -1337,7 +1337,7 @@ Decl *Parser::ParseDeclarationAfterDeclaratorAndAttributes(Declarator &D, ExprResult Init(ParseInitializer()); - if (getLang().CPlusPlus && D.getCXXScopeSpec().isSet()) { + if (getLangOpts().CPlusPlus && D.getCXXScopeSpec().isSet()) { Actions.ActOnCXXExitDeclInitializer(getCurScope(), ThisDecl); ExitScope(); } @@ -1357,7 +1357,7 @@ Decl *Parser::ParseDeclarationAfterDeclaratorAndAttributes(Declarator &D, ExprVector Exprs(Actions); CommaLocsTy CommaLocs; - if (getLang().CPlusPlus && D.getCXXScopeSpec().isSet()) { + if (getLangOpts().CPlusPlus && D.getCXXScopeSpec().isSet()) { EnterScope(0); Actions.ActOnCXXEnterDeclInitializer(getCurScope(), ThisDecl); } @@ -1365,7 +1365,7 @@ Decl *Parser::ParseDeclarationAfterDeclaratorAndAttributes(Declarator &D, if (ParseExpressionList(Exprs, CommaLocs)) { SkipUntil(tok::r_paren); - if (getLang().CPlusPlus && D.getCXXScopeSpec().isSet()) { + if (getLangOpts().CPlusPlus && D.getCXXScopeSpec().isSet()) { Actions.ActOnCXXExitDeclInitializer(getCurScope(), ThisDecl); ExitScope(); } @@ -1376,7 +1376,7 @@ Decl *Parser::ParseDeclarationAfterDeclaratorAndAttributes(Declarator &D, assert(!Exprs.empty() && Exprs.size()-1 == CommaLocs.size() && "Unexpected number of commas!"); - if (getLang().CPlusPlus && D.getCXXScopeSpec().isSet()) { + if (getLangOpts().CPlusPlus && D.getCXXScopeSpec().isSet()) { Actions.ActOnCXXExitDeclInitializer(getCurScope(), ThisDecl); ExitScope(); } @@ -1387,7 +1387,7 @@ Decl *Parser::ParseDeclarationAfterDeclaratorAndAttributes(Declarator &D, Actions.AddInitializerToDecl(ThisDecl, Initializer.take(), /*DirectInit=*/true, TypeContainsAuto); } - } else if (getLang().CPlusPlus0x && Tok.is(tok::l_brace)) { + } else if (getLangOpts().CPlusPlus0x && Tok.is(tok::l_brace)) { // Parse C++0x braced-init-list. Diag(Tok, diag::warn_cxx98_compat_generalized_initializer_lists); @@ -1544,7 +1544,7 @@ bool Parser::ParseImplicitInt(DeclSpec &DS, CXXScopeSpec *SS, if (TagName) { Diag(Loc, diag::err_use_of_tag_name_without_tag) - << Tok.getIdentifierInfo() << TagName << getLang().CPlusPlus + << Tok.getIdentifierInfo() << TagName << getLangOpts().CPlusPlus << FixItHint::CreateInsertion(Tok.getLocation(),FixitTagName); // Parse this as a tag as if the missing tag were present. @@ -1632,7 +1632,7 @@ ExprResult Parser::ParseAlignArgument(SourceLocation Start, } else ER = ParseConstantExpression(); - if (getLang().CPlusPlus0x && Tok.is(tok::ellipsis)) + if (getLangOpts().CPlusPlus0x && Tok.is(tok::ellipsis)) EllipsisLoc = ConsumeToken(); return ER; @@ -1930,7 +1930,7 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS, // Objective-C supports syntax of the form 'id<proto1,proto2>' where 'id' // is a specific typedef and 'itf<proto1,proto2>' where 'itf' is an // Objective-C interface. - if (Tok.is(tok::less) && getLang().ObjC1) + if (Tok.is(tok::less) && getLangOpts().ObjC1) ParseObjCProtocolQualifiers(DS); continue; @@ -1959,7 +1959,7 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS, case tok::identifier: { // In C++, check to see if this is a scope specifier like foo::bar::, if // so handle it as such. This is important for ctor parsing. - if (getLang().CPlusPlus) { + if (getLangOpts().CPlusPlus) { if (TryAnnotateCXXScopeToken(true)) { if (!DS.hasTypeSpecifier()) DS.SetTypeSpecError(); @@ -1993,7 +1993,7 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS, // If we're in a context where the identifier could be a class name, // check whether this is a constructor declaration. - if (getLang().CPlusPlus && DSContext == DSC_class && + if (getLangOpts().CPlusPlus && DSContext == DSC_class && Actions.isCurrentClassName(*Tok.getIdentifierInfo(), getCurScope()) && isConstructorDeclarator()) goto DoneWithDeclSpec; @@ -2009,7 +2009,7 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS, // Objective-C supports syntax of the form 'id<proto1,proto2>' where 'id' // is a specific typedef and 'itf<proto1,proto2>' where 'itf' is an // Objective-C interface. - if (Tok.is(tok::less) && getLang().ObjC1) + if (Tok.is(tok::less) && getLangOpts().ObjC1) ParseObjCProtocolQualifiers(DS); // Need to support trailing type qualifiers (e.g. "id<p> const"). @@ -2029,7 +2029,7 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS, // If we're in a context where the template-id could be a // constructor name or specialization, check whether this is a // constructor declaration. - if (getLang().CPlusPlus && DSContext == DSC_class && + if (getLangOpts().CPlusPlus && DSContext == DSC_class && Actions.isCurrentClassName(*TemplateId->Name, getCurScope()) && isConstructorDeclarator()) goto DoneWithDeclSpec; @@ -2098,7 +2098,7 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS, PrevSpec, DiagID); break; case tok::kw_auto: - if (getLang().CPlusPlus0x) { + if (getLangOpts().CPlusPlus0x) { if (isKnownToBeTypeSpecifier(GetLookAheadToken(1))) { isInvalid = DS.SetStorageClassSpec(Actions, DeclSpec::SCS_auto, Loc, PrevSpec, DiagID); @@ -2137,7 +2137,7 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS, // alignment-specifier case tok::kw__Alignas: - if (!getLang().C11) + if (!getLangOpts().C11) Diag(Tok, diag::ext_c11_alignas); ParseAlignmentSpecifier(DS.getAttributes()); continue; @@ -2289,15 +2289,15 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS, // cv-qualifier: case tok::kw_const: isInvalid = DS.SetTypeQual(DeclSpec::TQ_const, Loc, PrevSpec, DiagID, - getLang()); + getLangOpts()); break; case tok::kw_volatile: isInvalid = DS.SetTypeQual(DeclSpec::TQ_volatile, Loc, PrevSpec, DiagID, - getLang()); + getLangOpts()); break; case tok::kw_restrict: isInvalid = DS.SetTypeQual(DeclSpec::TQ_restrict, Loc, PrevSpec, DiagID, - getLang()); + getLangOpts()); break; // C++ typename-specifier: @@ -2329,7 +2329,7 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS, // OpenCL qualifiers: case tok::kw_private: - if (!getLang().OpenCL) + if (!getLangOpts().OpenCL) goto DoneWithDeclSpec; case tok::kw___private: case tok::kw___global: @@ -2345,7 +2345,7 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS, // GCC ObjC supports types like "<SomeProtocol>" as a synonym for // "id<SomeProtocol>". This is hopelessly old fashioned and dangerous, // but we support it. - if (DS.hasTypeSpecifier() || !getLang().ObjC1) + if (DS.hasTypeSpecifier() || !getLangOpts().ObjC1) goto DoneWithDeclSpec; if (!ParseObjCProtocolQualifiers(DS)) @@ -2476,7 +2476,7 @@ bool Parser::ParseOptionalTypeSpecifier(DeclSpec &DS, bool& isInvalid, // is a specific typedef and 'itf<proto1,proto2>' where 'itf' is an // Objective-C interface. If we don't have Objective-C or a '<', this is // just a normal reference to a typedef name. - if (Tok.is(tok::less) && getLang().ObjC1) + if (Tok.is(tok::less) && getLangOpts().ObjC1) ParseObjCProtocolQualifiers(DS); return true; @@ -2583,15 +2583,15 @@ bool Parser::ParseOptionalTypeSpecifier(DeclSpec &DS, bool& isInvalid, // cv-qualifier: case tok::kw_const: isInvalid = DS.SetTypeQual(DeclSpec::TQ_const , Loc, PrevSpec, - DiagID, getLang()); + DiagID, getLangOpts()); break; case tok::kw_volatile: isInvalid = DS.SetTypeQual(DeclSpec::TQ_volatile, Loc, PrevSpec, - DiagID, getLang()); + DiagID, getLangOpts()); break; case tok::kw_restrict: isInvalid = DS.SetTypeQual(DeclSpec::TQ_restrict, Loc, PrevSpec, - DiagID, getLang()); + DiagID, getLangOpts()); break; // GNU typeof support. @@ -2615,7 +2615,7 @@ bool Parser::ParseOptionalTypeSpecifier(DeclSpec &DS, bool& isInvalid, // OpenCL qualifiers: case tok::kw_private: - if (!getLang().OpenCL) + if (!getLangOpts().OpenCL) return false; case tok::kw___private: case tok::kw___global: @@ -2633,7 +2633,7 @@ bool Parser::ParseOptionalTypeSpecifier(DeclSpec &DS, bool& isInvalid, // illegal, so we can assume an auto type specifier was intended even in // C++98. In C++98 mode, DeclSpec::Finish will produce an appropriate // extension diagnostic. - if (!getLang().CPlusPlus) + if (!getLangOpts().CPlusPlus) return false; isInvalid = DS.SetTypeSpecType(DeclSpec::TST_auto, Loc, PrevSpec, DiagID); @@ -2779,7 +2779,7 @@ void Parser::ParseStructUnionBody(SourceLocation RecordLoc, // Empty structs are an extension in C (C99 6.7.2.1p7), but are allowed in // C++. - if (Tok.is(tok::r_brace) && !getLang().CPlusPlus) { + if (Tok.is(tok::r_brace) && !getLangOpts().CPlusPlus) { Diag(Tok, diag::ext_empty_struct_union) << (TagType == TST_union); Diag(Tok, diag::warn_empty_struct_union_compat) << (TagType == TST_union); } @@ -2916,7 +2916,7 @@ void Parser::ParseEnumSpecifier(SourceLocation StartLoc, DeclSpec &DS, SourceLocation ScopedEnumKWLoc; bool IsScopedUsingClassTag = false; - if (getLang().CPlusPlus0x && + if (getLangOpts().CPlusPlus0x && (Tok.is(tok::kw_class) || Tok.is(tok::kw_struct))) { Diag(Tok, diag::warn_cxx98_compat_scoped_enum); IsScopedUsingClassTag = Tok.is(tok::kw_class); @@ -2932,10 +2932,10 @@ void Parser::ParseEnumSpecifier(SourceLocation StartLoc, DeclSpec &DS, ParseMicrosoftDeclSpec(attrs); bool AllowFixedUnderlyingType - = getLang().CPlusPlus0x || getLang().MicrosoftExt || getLang().ObjC2; + = getLangOpts().CPlusPlus0x || getLangOpts().MicrosoftExt || getLangOpts().ObjC2; CXXScopeSpec &SS = DS.getTypeSpecScope(); - if (getLang().CPlusPlus) { + if (getLangOpts().CPlusPlus) { // "enum foo : bar;" is not a potential typo for "enum foo::bar;" // if a fixed underlying type is allowed. ColonProtectionRAIIObject X(*this, AllowFixedUnderlyingType); @@ -3022,9 +3022,9 @@ void Parser::ParseEnumSpecifier(SourceLocation StartLoc, DeclSpec &DS, // underlying type. // FIXME: The standard is not entirely clear on how to disambiguate in // this case. - if ((getLang().CPlusPlus && + if ((getLangOpts().CPlusPlus && isCXXDeclarationSpecifier(TPResult::True()) != TPResult::True()) || - (!getLang().CPlusPlus && !isDeclarationSpecifier(true))) { + (!getLangOpts().CPlusPlus && !isDeclarationSpecifier(true))) { // We'll parse this as a bitfield later. PossibleBitfield = true; TPA.Revert(); @@ -3042,10 +3042,10 @@ void Parser::ParseEnumSpecifier(SourceLocation StartLoc, DeclSpec &DS, SourceRange Range; BaseType = ParseTypeName(&Range); - if (!getLang().CPlusPlus0x && !getLang().ObjC2) + if (!getLangOpts().CPlusPlus0x && !getLangOpts().ObjC2) Diag(StartLoc, diag::ext_ms_enum_fixed_underlying_type) << Range; - if (getLang().CPlusPlus0x) + if (getLangOpts().CPlusPlus0x) Diag(StartLoc, diag::warn_cxx98_compat_enum_fixed_underlying_type); } } @@ -3169,7 +3169,7 @@ void Parser::ParseEnumBody(SourceLocation StartLoc, Decl *EnumDecl) { T.consumeOpen(); // C does not allow an empty enumerator-list, C++ does [dcl.enum]. - if (Tok.is(tok::r_brace) && !getLang().CPlusPlus) + if (Tok.is(tok::r_brace) && !getLangOpts().CPlusPlus) Diag(Tok, diag::error_empty_enum); SmallVector<Decl *, 32> EnumConstantDecls; @@ -3220,11 +3220,11 @@ void Parser::ParseEnumBody(SourceLocation StartLoc, Decl *EnumDecl) { SourceLocation CommaLoc = ConsumeToken(); if (Tok.isNot(tok::identifier)) { - if (!getLang().C99 && !getLang().CPlusPlus0x) + if (!getLangOpts().C99 && !getLangOpts().CPlusPlus0x) Diag(CommaLoc, diag::ext_enumerator_list_comma) - << getLang().CPlusPlus + << getLangOpts().CPlusPlus << FixItHint::CreateRemoval(CommaLoc); - else if (getLang().CPlusPlus0x) + else if (getLangOpts().CPlusPlus0x) Diag(CommaLoc, diag::warn_cxx98_compat_enumerator_list_comma) << FixItHint::CreateRemoval(CommaLoc); } @@ -3255,7 +3255,7 @@ bool Parser::isTypeQualifier() const { // type-qualifier only in OpenCL case tok::kw_private: - return getLang().OpenCL; + return getLangOpts().OpenCL; // type-qualifier case tok::kw_const: @@ -3390,7 +3390,7 @@ bool Parser::isTypeSpecifierQualifier() { // GNU ObjC bizarre protocol extension: <proto1,proto2> with implicit 'id'. case tok::less: - return getLang().ObjC1; + return getLangOpts().ObjC1; case tok::kw___cdecl: case tok::kw___stdcall: @@ -3413,7 +3413,7 @@ bool Parser::isTypeSpecifierQualifier() { return true; case tok::kw_private: - return getLang().OpenCL; + return getLangOpts().OpenCL; // C11 _Atomic() case tok::kw__Atomic: @@ -3431,11 +3431,11 @@ bool Parser::isDeclarationSpecifier(bool DisambiguatingWithExpression) { default: return false; case tok::kw_private: - return getLang().OpenCL; + return getLangOpts().OpenCL; case tok::identifier: // foo::bar // Unfortunate hack to support "Class.factoryMethod" notation. - if (getLang().ObjC1 && NextToken().is(tok::period)) + if (getLangOpts().ObjC1 && NextToken().is(tok::period)) return false; if (TryAltiVecVectorToken()) return true; @@ -3545,7 +3545,7 @@ bool Parser::isDeclarationSpecifier(bool DisambiguatingWithExpression) { // GNU ObjC bizarre protocol extension: <proto1,proto2> with implicit 'id'. case tok::less: - return getLang().ObjC1; + return getLangOpts().ObjC1; // typedef-name case tok::annot_typename: @@ -3642,7 +3642,7 @@ bool Parser::isConstructorDeclarator() { void Parser::ParseTypeQualifierListOpt(DeclSpec &DS, bool VendorAttributesAllowed, bool CXX0XAttributesAllowed) { - if (getLang().CPlusPlus0x && isCXX0XAttributeSpecifier()) { + if (getLangOpts().CPlusPlus0x && isCXX0XAttributeSpecifier()) { SourceLocation Loc = Tok.getLocation(); ParsedAttributesWithRange attrs(AttrFactory); ParseCXX0XAttributes(attrs); @@ -3667,20 +3667,20 @@ void Parser::ParseTypeQualifierListOpt(DeclSpec &DS, case tok::kw_const: isInvalid = DS.SetTypeQual(DeclSpec::TQ_const , Loc, PrevSpec, DiagID, - getLang()); + getLangOpts()); break; case tok::kw_volatile: isInvalid = DS.SetTypeQual(DeclSpec::TQ_volatile, Loc, PrevSpec, DiagID, - getLang()); + getLangOpts()); break; case tok::kw_restrict: isInvalid = DS.SetTypeQual(DeclSpec::TQ_restrict, Loc, PrevSpec, DiagID, - getLang()); + getLangOpts()); break; // OpenCL qualifiers: case tok::kw_private: - if (!getLang().OpenCL) + if (!getLangOpts().OpenCL) goto DoneWithTypeQuals; case tok::kw___private: case tok::kw___global: @@ -3777,7 +3777,7 @@ void Parser::ParseDeclaratorInternal(Declarator &D, // C++ member pointers start with a '::' or a nested-name. // Member pointers get special handling, since there's no place for the // scope spec in the generic path below. - if (getLang().CPlusPlus && + if (getLangOpts().CPlusPlus && (Tok.is(tok::coloncolon) || Tok.is(tok::identifier) || Tok.is(tok::annot_cxxscope))) { bool EnteringContext = D.getContext() == Declarator::FileContext || @@ -3816,9 +3816,9 @@ void Parser::ParseDeclaratorInternal(Declarator &D, tok::TokenKind Kind = Tok.getKind(); // Not a pointer, C++ reference, or block. if (Kind != tok::star && Kind != tok::caret && - (Kind != tok::amp || !getLang().CPlusPlus) && + (Kind != tok::amp || !getLangOpts().CPlusPlus) && // We parse rvalue refs in C++03, because otherwise the errors are scary. - (Kind != tok::ampamp || !getLang().CPlusPlus)) { + (Kind != tok::ampamp || !getLangOpts().CPlusPlus)) { if (DirectDeclParser) (this->*DirectDeclParser)(D); return; @@ -3859,7 +3859,7 @@ void Parser::ParseDeclaratorInternal(Declarator &D, // Complain about rvalue references in C++03, but then go on and build // the declarator. if (Kind == tok::ampamp) - Diag(Loc, getLang().CPlusPlus0x ? + Diag(Loc, getLangOpts().CPlusPlus0x ? diag::warn_cxx98_compat_rvalue_reference : diag::ext_rvalue_reference); @@ -3946,7 +3946,7 @@ void Parser::ParseDeclaratorInternal(Declarator &D, void Parser::ParseDirectDeclarator(Declarator &D) { DeclaratorScopeObj DeclScopeObj(*this, D.getCXXScopeSpec()); - if (getLang().CPlusPlus && D.mayHaveIdentifier()) { + if (getLangOpts().CPlusPlus && D.mayHaveIdentifier()) { // ParseDeclaratorInternal might already have parsed the scope. if (D.getCXXScopeSpec().isEmpty()) { bool EnteringContext = D.getContext() == Declarator::FileContext || @@ -4013,7 +4013,7 @@ void Parser::ParseDirectDeclarator(Declarator &D) { goto PastIdentifier; } } else if (Tok.is(tok::identifier) && D.mayHaveIdentifier()) { - assert(!getLang().CPlusPlus && + assert(!getLangOpts().CPlusPlus && "There's a C++-specific check for tok::identifier above"); assert(Tok.getIdentifierInfo() && "Not an identifier?"); D.SetIdentifier(Tok.getIdentifierInfo(), Tok.getLocation()); @@ -4047,8 +4047,8 @@ void Parser::ParseDirectDeclarator(Declarator &D) { if (D.getContext() == Declarator::MemberContext) Diag(Tok, diag::err_expected_member_name_or_semi) << D.getDeclSpec().getSourceRange(); - else if (getLang().CPlusPlus) - Diag(Tok, diag::err_expected_unqualified_id) << getLang().CPlusPlus; + else if (getLangOpts().CPlusPlus) + Diag(Tok, diag::err_expected_unqualified_id) << getLangOpts().CPlusPlus; else Diag(Tok, diag::err_expected_ident_lparen); D.SetIdentifier(0, Tok.getLocation()); @@ -4072,7 +4072,7 @@ void Parser::ParseDirectDeclarator(Declarator &D) { // The paren may be part of a C++ direct initializer, eg. "int x(1);". // In such a case, check if we actually have a function declarator; if it // is not, the declarator has been fully parsed. - if (getLang().CPlusPlus && D.mayBeFollowedByCXXDirectInit()) { + if (getLangOpts().CPlusPlus && D.mayBeFollowedByCXXDirectInit()) { // When not in file scope, warn for ambiguous function declarators, just // in case the author intended it as a variable definition. bool warnIfAmbiguous = D.getContext() != Declarator::FileContext; @@ -4152,7 +4152,7 @@ void Parser::ParseParenDeclarator(Declarator &D) { // paren, because we haven't seen the identifier yet. isGrouping = true; } else if (Tok.is(tok::r_paren) || // 'int()' is a function. - (getLang().CPlusPlus && Tok.is(tok::ellipsis)) || // C++ int(...) + (getLangOpts().CPlusPlus && Tok.is(tok::ellipsis)) || // C++ int(...) isDeclarationSpecifier()) { // 'int(int)' is a function. // This handles C99 6.7.5.3p11: in "typedef int X; void foo(X)", X is // considered to be a type, not a K&R identifier-list. @@ -4258,13 +4258,13 @@ void Parser::ParseFunctionDeclarator(Declarator &D, else if (RequiresArg) Diag(Tok, diag::err_argument_required_after_attribute); - HasProto = ParamInfo.size() || getLang().CPlusPlus; + HasProto = ParamInfo.size() || getLangOpts().CPlusPlus; // If we have the closing ')', eat it. Tracker.consumeClose(); EndLoc = Tracker.getCloseLocation(); - if (getLang().CPlusPlus) { + if (getLangOpts().CPlusPlus) { MaybeParseCXX0XAttributes(attrs); // Parse cv-qualifier-seq[opt]. @@ -4277,7 +4277,7 @@ void Parser::ParseFunctionDeclarator(Declarator &D, // Parse ref-qualifier[opt]. if (Tok.is(tok::amp) || Tok.is(tok::ampamp)) { - Diag(Tok, getLang().CPlusPlus0x ? + Diag(Tok, getLangOpts().CPlusPlus0x ? diag::warn_cxx98_compat_ref_qualifier : diag::ext_ref_qualifier); @@ -4295,7 +4295,7 @@ void Parser::ParseFunctionDeclarator(Declarator &D, EndLoc = ESpecRange.getEnd(); // Parse trailing-return-type[opt]. - if (getLang().CPlusPlus0x && Tok.is(tok::arrow)) { + if (getLangOpts().CPlusPlus0x && Tok.is(tok::arrow)) { Diag(Tok, diag::warn_cxx98_compat_trailing_return_type); SourceRange Range; TrailingReturnType = ParseTrailingReturnType(Range).get(); @@ -4335,7 +4335,7 @@ void Parser::ParseFunctionDeclarator(Declarator &D, /// Note that identifier-lists are only allowed for normal declarators, not for /// abstract-declarators. bool Parser::isFunctionDeclaratorIdentifierList() { - return !getLang().CPlusPlus + return !getLangOpts().CPlusPlus && Tok.is(tok::identifier) && !TryAltiVecVectorToken() // K&R identifier lists can't have typedefs as identifiers, per C99 @@ -4460,7 +4460,7 @@ void Parser::ParseParameterDeclarationClause( DeclSpec DS(AttrFactory); // Skip any Microsoft attributes before a param. - if (getLang().MicrosoftExt && Tok.is(tok::l_square)) + if (getLangOpts().MicrosoftExt && Tok.is(tok::l_square)) ParseMicrosoftAttributes(DS.getAttributes()); SourceLocation DSStart = Tok.getLocation(); @@ -4570,7 +4570,7 @@ void Parser::ParseParameterDeclarationClause( if (Tok.is(tok::ellipsis)) { EllipsisLoc = ConsumeToken(); // Consume the ellipsis. - if (!getLang().CPlusPlus) { + if (!getLangOpts().CPlusPlus) { // We have ellipsis without a preceding ',', which is ill-formed // in C. Complain and provide the fix. Diag(EllipsisLoc, diag::err_missing_comma_before_ellipsis) @@ -4668,7 +4668,7 @@ void Parser::ParseBracketDeclarator(Declarator &D) { // Parse the constant-expression or assignment-expression now (depending // on dialect). - if (getLang().CPlusPlus) { + if (getLangOpts().CPlusPlus) { NumElements = ParseConstantExpression(); } else { EnterExpressionEvaluationContext Unevaluated(Actions, diff --git a/lib/Parse/ParseDeclCXX.cpp b/lib/Parse/ParseDeclCXX.cpp index 89f024637e..5b68c7a784 100644 --- a/lib/Parse/ParseDeclCXX.cpp +++ b/lib/Parse/ParseDeclCXX.cpp @@ -150,7 +150,7 @@ Decl *Parser::ParseNamespace(unsigned Context, // If we're still good, complain about inline namespaces in non-C++0x now. if (InlineLoc.isValid()) - Diag(InlineLoc, getLang().CPlusPlus0x ? + Diag(InlineLoc, getLangOpts().CPlusPlus0x ? diag::warn_cxx98_compat_inline_namespace : diag::ext_inline_namespace); // Enter a scope for the namespace. @@ -490,7 +490,7 @@ Decl *Parser::ParseUsingDeclaration(unsigned Context, // Where can GNU attributes appear? ConsumeToken(); - Diag(Tok.getLocation(), getLang().CPlusPlus0x ? + Diag(Tok.getLocation(), getLangOpts().CPlusPlus0x ? diag::warn_cxx98_compat_alias_declaration : diag::ext_alias_declaration); @@ -593,7 +593,7 @@ Decl *Parser::ParseStaticAssertDeclaration(SourceLocation &DeclEnd){ assert((Tok.is(tok::kw_static_assert) || Tok.is(tok::kw__Static_assert)) && "Not a static_assert declaration"); - if (Tok.is(tok::kw__Static_assert) && !getLang().C11) + if (Tok.is(tok::kw__Static_assert) && !getLangOpts().C11) Diag(Tok, diag::ext_c11_static_assert); if (Tok.is(tok::kw_static_assert)) Diag(Tok, diag::warn_cxx98_compat_static_assert); @@ -1020,7 +1020,7 @@ void Parser::ParseClassSpecifier(tok::TokenKind TagTokKind, // Parse the (optional) nested-name-specifier. CXXScopeSpec &SS = DS.getTypeSpecScope(); - if (getLang().CPlusPlus) { + if (getLangOpts().CPlusPlus) { // "FOO : BAR" is not a potential typo for "FOO::BAR". ColonProtectionRAIIObject X(*this); @@ -1041,7 +1041,7 @@ void Parser::ParseClassSpecifier(tok::TokenKind TagTokKind, Name = Tok.getIdentifierInfo(); NameLoc = ConsumeToken(); - if (Tok.is(tok::less) && getLang().CPlusPlus) { + if (Tok.is(tok::less) && getLangOpts().CPlusPlus) { // The name was supposed to refer to a template, but didn't. // Eat the template argument list and try to continue parsing this as // a class (or template thereof). @@ -1130,7 +1130,7 @@ void Parser::ParseClassSpecifier(tok::TokenKind TagTokKind, if (SuppressDeclarations) TUK = Sema::TUK_Reference; else if (Tok.is(tok::l_brace) || - (getLang().CPlusPlus && Tok.is(tok::colon)) || + (getLangOpts().CPlusPlus && Tok.is(tok::colon)) || isCXX0XFinalKeyword()) { if (DS.isFriendSpecified()) { // C++ [class.friend]p2: @@ -1313,9 +1313,9 @@ void Parser::ParseClassSpecifier(tok::TokenKind TagTokKind, // If there is a body, parse it and inform the actions module. if (TUK == Sema::TUK_Definition) { assert(Tok.is(tok::l_brace) || - (getLang().CPlusPlus && Tok.is(tok::colon)) || + (getLangOpts().CPlusPlus && Tok.is(tok::colon)) || isCXX0XFinalKeyword()); - if (getLang().CPlusPlus) + if (getLangOpts().CPlusPlus) ParseCXXMemberSpecification(StartLoc, TagType, TagOrTempResult.get()); else ParseStructUnionBody(StartLoc, TagType, TagOrTempResult.get()); @@ -1397,7 +1397,7 @@ void Parser::ParseClassSpecifier(tok::TokenKind TagTokKind, case tok::r_brace: // struct bar { struct foo {...} } // Missing ';' at end of struct is accepted as an extension in C mode. - if (!getLang().CPlusPlus) + if (!getLangOpts().CPlusPlus) ExpectedSemi = false; break; } @@ -1576,7 +1576,7 @@ void Parser::HandleMemberFunctionDefaultArgs(Declarator& DeclaratorInfo, /// override /// final VirtSpecifiers::Specifier Parser::isCXX0XVirtSpecifier(const Token &Tok) const { - if (!getLang().CPlusPlus) + if (!getLangOpts().CPlusPlus) return VirtSpecifiers::VS_None; if (Tok.is(tok::identifier)) { @@ -1617,7 +1617,7 @@ void Parser::ParseOptionalCXX0XVirtSpecifierSeq(VirtSpecifiers &VS) { << PrevSpec << FixItHint::CreateRemoval(Tok.getLocation()); - Diag(Tok.getLocation(), getLang().CPlusPlus0x ? + Diag(Tok.getLocation(), getLangOpts().CPlusPlus0x ? diag::warn_cxx98_compat_override_control_keyword : diag::ext_override_control_keyword) << VirtSpecifiers::getSpecifierName(Specifier); @@ -1628,7 +1628,7 @@ void Parser::ParseOptionalCXX0XVirtSpecifierSeq(VirtSpecifiers &VS) { /// isCXX0XFinalKeyword - Determine whether the next token is a C++0x /// contextual 'final' keyword. bool Parser::isCXX0XFinalKeyword() const { - if (!getLang().CPlusPlus) + if (!getLangOpts().CPlusPlus) return false; if (!Tok.is(tok::identifier)) @@ -1683,7 +1683,7 @@ void Parser::ParseCXXClassMemberDeclaration(AccessSpecifier AS, const ParsedTemplateInfo &TemplateInfo, ParsingDeclRAIIObject *TemplateDiags) { if (Tok.is(tok::at)) { - if (getLang().ObjC1 && NextToken().isObjCAtKeyword(tok::objc_defs)) + if (getLangOpts().ObjC1 && NextToken().isObjCAtKeyword(tok::objc_defs)) Diag(Tok, diag::err_at_defs_cxx); else Diag(Tok, diag::err_at_in_class); @@ -1842,7 +1842,7 @@ void Parser::ParseCXXClassMemberDeclaration(AccessSpecifier AS, // MSVC permits pure specifier on inline functions declared at class scope. // Hence check for =0 before checking for function definition. - if (getLang().MicrosoftExt && Tok.is(tok::equal) && + if (getLangOpts().MicrosoftExt && Tok.is(tok::equal) && DeclaratorInfo.isFunctionDeclarator() && NextToken().is(tok::numeric_constant)) { EqualLoc = ConsumeToken(); @@ -1859,7 +1859,7 @@ void Parser::ParseCXXClassMemberDeclaration(AccessSpecifier AS, // In C++11, a non-function declarator followed by an open brace is a // braced-init-list for an in-class member initialization, not an // erroneous function definition. - if (Tok.is(tok::l_brace) && !getLang().CPlusPlus0x) { + if (Tok.is(tok::l_brace) && !getLangOpts().CPlusPlus0x) { DefinitionKind = FDK_Definition; } else if (DeclaratorInfo.isFunctionDeclarator()) { if (Tok.is(tok::l_brace) || Tok.is(tok::colon) || Tok.is(tok::kw_try)) { @@ -2006,7 +2006,7 @@ void Parser::ParseCXXClassMemberDeclaration(AccessSpecifier AS, // Handle the initializer. if (HasDeferredInitializer) { // The initializer was deferred; parse it and cache the tokens. - Diag(Tok, getLang().CPlusPlus0x ? + Diag(Tok, getLangOpts().CPlusPlus0x ? diag::warn_cxx98_compat_nonstatic_member_init : diag::ext_nonstatic_member_init); @@ -2212,11 +2212,11 @@ void Parser::ParseCXXMemberSpecification(SourceLocation RecordLoc, SourceLocation FinalLoc; // Parse the optional 'final' keyword. - if (getLang().CPlusPlus && Tok.is(tok::identifier)) { + if (getLangOpts().CPlusPlus && Tok.is(tok::identifier)) { assert(isCXX0XFinalKeyword() && "not a class definition"); FinalLoc = ConsumeToken(); - Diag(FinalLoc, getLang().CPlusPlus0x ? + Diag(FinalLoc, getLangOpts().CPlusPlus0x ? diag::warn_cxx98_compat_override_control_keyword : diag::ext_override_control_keyword) << "final"; } @@ -2256,7 +2256,7 @@ void Parser::ParseCXXMemberSpecification(SourceLocation RecordLoc, while (Tok.isNot(tok::r_brace) && Tok.isNot(tok::eof)) { // Each iteration of this loop reads one member-declaration. - if (getLang().MicrosoftExt && (Tok.is(tok::kw___if_exists) || + if (getLangOpts().MicrosoftExt && (Tok.is(tok::kw___if_exists) || Tok.is(tok::kw___if_not_exists))) { ParseMicrosoftIfExistsClassDeclaration((DeclSpec::TST)TagType, CurAS); continue; @@ -2483,7 +2483,7 @@ Parser::MemInitResult Parser::ParseMemInitializer(Decl *ConstructorDecl) { // Parse the '('. - if (getLang().CPlusPlus0x && Tok.is(tok::l_brace)) { + if (getLangOpts().CPlusPlus0x && Tok.is(tok::l_brace)) { Diag(Tok, diag::warn_cxx98_compat_generalized_initializer_lists); ExprResult InitList = ParseBraceInitializer(); @@ -2522,7 +2522,7 @@ Parser::MemInitResult Parser::ParseMemInitializer(Decl *ConstructorDecl) { EllipsisLoc); } - Diag(Tok, getLang().CPlusPlus0x ? diag::err_expected_lparen_or_lbrace + Diag(Tok, getLangOpts().CPlusPlus0x ? diag::err_expected_lparen_or_lbrace : diag::err_expected_lparen); return true; } @@ -2630,7 +2630,7 @@ ExceptionSpecificationType Parser::ParseDynamicExceptionSpecification( // can throw anything". if (Tok.is(tok::ellipsis)) { SourceLocation EllipsisLoc = ConsumeToken(); - if (!getLang().MicrosoftExt) + if (!getLangOpts().MicrosoftExt) Diag(EllipsisLoc, diag::ext_ellipsis_exception_spec); T.consumeClose(); SpecificationRange.setEnd(T.getCloseLocation()); diff --git a/lib/Parse/ParseExpr.cpp b/lib/Parse/ParseExpr.cpp index c4627f1bba..888e84f253 100644 --- a/lib/Parse/ParseExpr.cpp +++ b/lib/Parse/ParseExpr.cpp @@ -268,7 +268,7 @@ ExprResult Parser::ParseRHSOfBinaryExpression(ExprResult LHS, prec::Level MinPrec) { prec::Level NextTokPrec = getBinOpPrecedence(Tok.getKind(), GreaterThanIsOperator, - getLang().CPlusPlus0x); + getLangOpts().CPlusPlus0x); SourceLocation ColonLoc; while (1) { @@ -358,10 +358,10 @@ Parser::ParseRHSOfBinaryExpression(ExprResult LHS, prec::Level MinPrec) { // they only appear on the RHS of assignments later. ExprResult RHS; bool RHSIsInitList = false; - if (getLang().CPlusPlus0x && Tok.is(tok::l_brace)) { + if (getLangOpts().CPlusPlus0x && Tok.is(tok::l_brace)) { RHS = ParseBraceInitializer(); RHSIsInitList = true; - } else if (getLang().CPlusPlus && NextTokPrec <= prec::Conditional) + } else if (getLangOpts().CPlusPlus && NextTokPrec <= prec::Conditional) RHS = ParseAssignmentExpression(); else RHS = ParseCastExpression(false); @@ -373,7 +373,7 @@ Parser::ParseRHSOfBinaryExpression(ExprResult LHS, prec::Level MinPrec) { // operator immediately to the right of the RHS. prec::Level ThisPrec = NextTokPrec; NextTokPrec = getBinOpPrecedence(Tok.getKind(), GreaterThanIsOperator, - getLang().CPlusPlus0x); + getLangOpts().CPlusPlus0x); // Assignment and conditional expressions are right-associative. bool isRightAssoc = ThisPrec == prec::Conditional || @@ -401,7 +401,7 @@ Parser::ParseRHSOfBinaryExpression(ExprResult LHS, prec::Level MinPrec) { LHS = ExprError(); NextTokPrec = getBinOpPrecedence(Tok.getKind(), GreaterThanIsOperator, - getLang().CPlusPlus0x); + getLangOpts().CPlusPlus0x); } assert(NextTokPrec <= ThisPrec && "Recursion didn't work!"); @@ -666,7 +666,7 @@ ExprResult Parser::ParseCastExpression(bool isUnaryExpression, // If this expression is limited to being a unary-expression, the parent can // not start a cast expression. ParenParseOption ParenExprType = - (isUnaryExpression && !getLang().CPlusPlus)? CompoundLiteral : CastExpr; + (isUnaryExpression && !getLangOpts().CPlusPlus)? CompoundLiteral : CastExpr; ParsedType CastTy; SourceLocation RParenLoc; @@ -728,7 +728,7 @@ ExprResult Parser::ParseCastExpression(bool isUnaryExpression, // constant: enumeration-constant // Turn a potentially qualified name into a annot_typename or // annot_cxxscope if it would be valid. This handles things like x::y, etc. - if (getLang().CPlusPlus) { + if (getLangOpts().CPlusPlus) { // Avoid the unnecessary parse-time lookup in the common case // where the syntax forbids a type. const Token &Next = NextToken(); @@ -751,7 +751,7 @@ ExprResult Parser::ParseCastExpression(bool isUnaryExpression, SourceLocation ILoc = ConsumeToken(); // Support 'Class.property' and 'super.property' notation. - if (getLang().ObjC1 && Tok.is(tok::period) && + if (getLangOpts().ObjC1 && Tok.is(tok::period) && (Actions.getTypeName(II, ILoc, getCurScope()) || // Allow the base to be 'super' if in an objc-method. (&II == Ident_super && getCurScope()->isInObjcMethodScope()))) { @@ -759,7 +759,7 @@ ExprResult Parser::ParseCastExpression(bool isUnaryExpression, // Allow either an identifier or the keyword 'class' (in C++). if (Tok.isNot(tok::identifier) && - !(getLang().CPlusPlus && Tok.is(tok::kw_class))) { + !(getLangOpts().CPlusPlus && Tok.is(tok::kw_class))) { Diag(Tok, diag::err_expected_property_name); return ExprError(); } @@ -775,7 +775,7 @@ ExprResult Parser::ParseCastExpression(bool isUnaryExpression, // the token sequence is ill-formed. However, if there's a ':' or ']' after // that identifier, this is probably a message send with a missing open // bracket. Treat it as such. - if (getLang().ObjC1 && &II == Ident_super && !InMessageExpression && + if (getLangOpts().ObjC1 && &II == Ident_super && !InMessageExpression && getCurScope()->isInObjcMethodScope() && ((Tok.is(tok::identifier) && (NextToken().is(tok::colon) || NextToken().is(tok::r_square))) || @@ -790,7 +790,7 @@ ExprResult Parser::ParseCastExpression(bool isUnaryExpression, // send that's missing the opening '['. Recovery // appropriately. Also take this path if we're performing code // completion after an Objective-C class name. - if (getLang().ObjC1 && + if (getLangOpts().ObjC1 && ((Tok.is(tok::identifier) && !InMessageExpression) || Tok.is(tok::code_completion))) { const Token& Next = NextToken(); @@ -875,7 +875,7 @@ ExprResult Parser::ParseCastExpression(bool isUnaryExpression, // ++ cast-expression // -- cast-expression SourceLocation SavedLoc = ConsumeToken(); - Res = ParseCastExpression(!getLang().CPlusPlus); + Res = ParseCastExpression(!getLangOpts().CPlusPlus); if (!Res.isInvalid()) Res = Actions.ActOnUnaryOp(getCurScope(), SavedLoc, SavedKind, Res.get()); return move(Res); @@ -996,7 +996,7 @@ ExprResult Parser::ParseCastExpression(bool isUnaryExpression, case tok::kw_typename: case tok::kw_typeof: case tok::kw___vector: { - if (!getLang().CPlusPlus) { + if (!getLangOpts().CPlusPlus) { Diag(Tok, diag::err_expected_expression); return ExprError(); } @@ -1014,7 +1014,7 @@ ExprResult Parser::ParseCastExpression(bool isUnaryExpression, DeclSpec DS(AttrFactory); ParseCXXSimpleTypeSpecifier(DS); if (Tok.isNot(tok::l_paren) && - (!getLang().CPlusPlus0x || Tok.isNot(tok::l_brace))) + (!getLangOpts().CPlusPlus0x || Tok.isNot(tok::l_brace))) return ExprError(Diag(Tok, diag::err_expected_lparen_after_type) << DS.getSourceRange()); @@ -1198,8 +1198,8 @@ ExprResult Parser::ParseCastExpression(bool isUnaryExpression, return ExprError(); } case tok::l_square: - if (getLang().CPlusPlus0x) { - if (getLang().ObjC1) { + if (getLangOpts().CPlusPlus0x) { + if (getLangOpts().ObjC1) { // C++11 lambda expressions and Objective-C message sends both start with a // square bracket. There are three possibilities here: // we have a valid lambda expression, we have an invalid lambda @@ -1213,7 +1213,7 @@ ExprResult Parser::ParseCastExpression(bool isUnaryExpression, Res = ParseLambdaExpression(); break; } - if (getLang().ObjC1) { + if (getLangOpts().ObjC1) { Res = ParseObjCMessageExpression(); break; } @@ -1265,7 +1265,7 @@ Parser::ParsePostfixExpressionSuffix(ExprResult LHS) { // If we see identifier: after an expression, and we're not already in a // message send, then this is probably a message send with a missing // opening bracket '['. - if (getLang().ObjC1 && !InMessageExpression && + if (getLangOpts().ObjC1 && !InMessageExpression && (NextToken().is(tok::colon) || NextToken().is(tok::r_square))) { LHS = ParseObjCMessageExpressionBody(SourceLocation(), SourceLocation(), ParsedType(), LHS.get()); @@ -1283,7 +1283,7 @@ Parser::ParsePostfixExpressionSuffix(ExprResult LHS) { // actually another message send. In this case, do some look-ahead to see // if the contents of the square brackets are obviously not a valid // expression and recover by pretending there is no suffix. - if (getLang().ObjC1 && Tok.isAtStartOfLine() && + if (getLangOpts().ObjC1 && Tok.isAtStartOfLine() && isSimpleObjCMessageExpression()) return move(LHS); @@ -1291,7 +1291,7 @@ Parser::ParsePostfixExpressionSuffix(ExprResult LHS) { T.consumeOpen(); Loc = T.getOpenLocation(); ExprResult Idx; - if (getLang().CPlusPlus0x && Tok.is(tok::l_brace)) { + if (getLangOpts().CPlusPlus0x && Tok.is(tok::l_brace)) { Diag(Tok, diag::warn_cxx98_compat_generalized_initializer_lists); Idx = ParseBraceInitializer(); } else @@ -1411,7 +1411,7 @@ Parser::ParsePostfixExpressionSuffix(ExprResult LHS) { CXXScopeSpec SS; ParsedType ObjectType; bool MayBePseudoDestructor = false; - if (getLang().CPlusPlus && !LHS.isInvalid()) { + if (getLangOpts().CPlusPlus && !LHS.isInvalid()) { LHS = Actions.ActOnStartCXXMemberReference(getCurScope(), LHS.take(), OpLoc, OpKind, ObjectType, MayBePseudoDestructor); @@ -1449,7 +1449,7 @@ Parser::ParsePostfixExpressionSuffix(ExprResult LHS) { // FIXME: Add support for explicit call of template constructor. SourceLocation TemplateKWLoc; UnqualifiedId Name; - if (getLang().ObjC2 && OpKind == tok::period && Tok.is(tok::kw_class)) { + if (getLangOpts().ObjC2 && OpKind == tok::period && Tok.is(tok::kw_class)) { // Objective-C++: // After a '.' in a member access expression, treat the keyword // 'class' as if it were an identifier. @@ -1464,7 +1464,7 @@ Parser::ParsePostfixExpressionSuffix(ExprResult LHS) { /*EnteringContext=*/false, /*AllowDestructorName=*/true, /*AllowConstructorName=*/ - getLang().MicrosoftExt, + getLangOpts().MicrosoftExt, ObjectType, TemplateKWLoc, Name)) LHS = ExprError(); @@ -1524,7 +1524,7 @@ Parser::ParseExprAfterUnaryExprOrTypeTrait(const Token &OpTok, // If the operand doesn't start with an '(', it must be an expression. if (Tok.isNot(tok::l_paren)) { isCastExpr = false; - if (OpTok.is(tok::kw_typeof) && !getLang().CPlusPlus) { + if (OpTok.is(tok::kw_typeof) && !getLangOpts().CPlusPlus) { Diag(Tok,diag::err_expected_lparen_after_id) << OpTok.getIdentifierInfo(); return ExprError(); } @@ -1549,7 +1549,7 @@ Parser::ParseExprAfterUnaryExprOrTypeTrait(const Token &OpTok, return ExprEmpty(); } - if (getLang().CPlusPlus || OpTok.isNot(tok::kw_typeof)) { + if (getLangOpts().CPlusPlus || OpTok.isNot(tok::kw_typeof)) { // GNU typeof in C requires the expression to be parenthesized. Not so for // sizeof/alignof or in C++. Therefore, the parenthesized expression is // the start of a unary-expression, but doesn't include any postfix @@ -1898,12 +1898,12 @@ Parser::ParseParenExpression(ParenParseOption &ExprType, bool stopIfCastExpr, } // Diagnose use of bridge casts in non-arc mode. - bool BridgeCast = (getLang().ObjC2 && + bool BridgeCast = (getLangOpts().ObjC2 && (Tok.is(tok::kw___bridge) || Tok.is(tok::kw___bridge_transfer) || Tok.is(tok::kw___bridge_retained) || Tok.is(tok::kw___bridge_retain))); - if (BridgeCast && !getLang().ObjCAutoRefCount) { + if (BridgeCast && !getLangOpts().ObjCAutoRefCount) { StringRef BridgeCastName = Tok.getName(); SourceLocation BridgeKeywordLoc = ConsumeToken(); if (!PP.getSourceManager().isInSystemHeader(BridgeKeywordLoc)) @@ -1984,7 +1984,7 @@ Parser::ParseParenExpression(ParenParseOption &ExprType, bool stopIfCastExpr, // this is probably an Objective-C message send where the leading '[' is // missing. Recover as if that were the case. if (!DeclaratorInfo.isInvalidType() && Tok.is(tok::identifier) && - !InMessageExpression && getLang().ObjC1 && + !InMessageExpression && getLangOpts().ObjC1 && (NextToken().is(tok::colon) || NextToken().is(tok::r_square))) { TypeResult Ty; { @@ -2027,7 +2027,7 @@ Parser::ParseParenExpression(ParenParseOption &ExprType, bool stopIfCastExpr, } // Reject the cast of super idiom in ObjC. - if (Tok.is(tok::identifier) && getLang().ObjC1 && + if (Tok.is(tok::identifier) && getLangOpts().ObjC1 && Tok.getIdentifierInfo() == Ident_super && getCurScope()->isInObjcMethodScope() && GetLookAheadToken(1).isNot(tok::period)) { @@ -2098,7 +2098,7 @@ Parser::ParseCompoundLiteralExpression(ParsedType Ty, SourceLocation LParenLoc, SourceLocation RParenLoc) { assert(Tok.is(tok::l_brace) && "Not a compound literal!"); - if (!getLang().C99) // Compound literals don't exist in C90. + if (!getLangOpts().C99) // Compound literals don't exist in C90. Diag(LParenLoc, diag::ext_c99_compound_literal); ExprResult Result = ParseInitializer(); if (!Result.isInvalid() && Ty) @@ -2144,7 +2144,7 @@ ExprResult Parser::ParseGenericSelectionExpression() { assert(Tok.is(tok::kw__Generic) && "_Generic keyword expected"); SourceLocation KeyLoc = ConsumeToken(); - if (!getLang().C11) + if (!getLangOpts().C11) Diag(KeyLoc, diag::ext_c11_generic_selection); BalancedDelimiterTracker T(*this, tok::l_paren); @@ -2262,7 +2262,7 @@ bool Parser::ParseExpressionList(SmallVectorImpl<Expr*> &Exprs, } ExprResult Expr; - if (getLang().CPlusPlus0x && Tok.is(tok::l_brace)) { + if (getLangOpts().CPlusPlus0x && Tok.is(tok::l_brace)) { Diag(Tok, diag::warn_cxx98_compat_generalized_initializer_lists); Expr = ParseBraceInitializer(); } else diff --git a/lib/Parse/ParseExprCXX.cpp b/lib/Parse/ParseExprCXX.cpp index 847b3964fb..325c398f34 100644 --- a/lib/Parse/ParseExprCXX.cpp +++ b/lib/Parse/ParseExprCXX.cpp @@ -138,7 +138,7 @@ bool Parser::ParseOptionalCXXScopeSpecifier(CXXScopeSpec &SS, bool EnteringContext, bool *MayBePseudoDestructor, bool IsTypename) { - assert(getLang().CPlusPlus && + assert(getLangOpts().CPlusPlus && "Call sites of this function should be guarded by checking for C++"); if (Tok.is(tok::annot_cxxscope)) { @@ -416,7 +416,7 @@ bool Parser::ParseOptionalCXXScopeSpecifier(CXXScopeSpec &SS, // parse correctly as a template, so suggest the keyword 'template' // before 'getAs' and treat this as a dependent template name. unsigned DiagID = diag::err_missing_dependent_template_keyword; - if (getLang().MicrosoftExt) + if (getLangOpts().MicrosoftExt) DiagID = diag::warn_missing_dependent_template_keyword; Diag(Tok.getLocation(), DiagID) @@ -578,7 +578,7 @@ ExprResult Parser::ParseLambdaExpression() { /// /// If we are not looking at a lambda expression, returns ExprError(). ExprResult Parser::TryParseLambdaExpression() { - assert(getLang().CPlusPlus0x + assert(getLangOpts().CPlusPlus0x && Tok.is(tok::l_square) && "Not at the start of a possible lambda expression."); @@ -657,7 +657,7 @@ llvm::Optional<unsigned> Parser::ParseLambdaIntroducer(LambdaIntroducer &Intro){ if (Tok.is(tok::code_completion)) { // If we're in Objective-C++ and we have a bare '[', then this is more // likely to be a message receiver. - if (getLang().ObjC1 && first) + if (getLangOpts().ObjC1 && first) Actions.CodeCompleteObjCMessageReceiver(getCurScope()); else Actions.CodeCompleteLambdaIntroducer(getCurScope(), Intro, @@ -1225,7 +1225,7 @@ Parser::ParseCXXTypeConstructExpression(const DeclSpec &DS) { ParsedType TypeRep = Actions.ActOnTypeName(getCurScope(), DeclaratorInfo).get(); assert((Tok.is(tok::l_paren) || - (getLang().CPlusPlus0x && Tok.is(tok::l_brace))) + (getLangOpts().CPlusPlus0x && Tok.is(tok::l_brace))) && "Expected '(' or '{'!"); if (Tok.is(tok::l_brace)) { @@ -1350,7 +1350,7 @@ bool Parser::ParseCXXCondition(ExprResult &ExprOut, ConsumeToken(); ExprResult InitExpr = ExprError(); - if (getLang().CPlusPlus0x && Tok.is(tok::l_brace)) { + if (getLangOpts().CPlusPlus0x && Tok.is(tok::l_brace)) { Diag(Tok.getLocation(), diag::warn_cxx98_compat_generalized_initializer_lists); InitExpr = ParseBraceInitializer(); @@ -1467,7 +1467,7 @@ void Parser::ParseCXXSimpleTypeSpecifier(DeclSpec &DS) { // is a specific typedef and 'itf<proto1,proto2>' where 'itf' is an // Objective-C interface. If we don't have Objective-C or a '<', this is // just a normal reference to a typedef name. - if (Tok.is(tok::less) && getLang().ObjC1) + if (Tok.is(tok::less) && getLangOpts().ObjC1) ParseObjCProtocolQualifiers(DS); DS.Finish(Diags, PP); @@ -1904,7 +1904,7 @@ bool Parser::ParseUnqualifiedIdOperator(CXXScopeSpec &SS, bool EnteringContext, // literal-operator-id: [C++0x 13.5.8] // operator "" identifier - if (getLang().CPlusPlus0x && isTokenStringLiteral()) { + if (getLangOpts().CPlusPlus0x && isTokenStringLiteral()) { Diag(Tok.getLocation(), diag::warn_cxx98_compat_literal_operator); SourceLocation DiagLoc; @@ -1936,7 +1936,7 @@ bool Parser::ParseUnqualifiedIdOperator(CXXScopeSpec &SS, bool EnteringContext, SuffixLoc = Lexer::AdvanceToTokenCharacter(TokLocs[Literal.getUDSuffixToken()], Literal.getUDSuffixOffset(), - PP.getSourceManager(), getLang()); + PP.getSourceManager(), getLangOpts()); // This form is not permitted by the standard (yet). DiagLoc = SuffixLoc; DiagId = diag::err_literal_operator_missing_space; @@ -2041,7 +2041,7 @@ bool Parser::ParseUnqualifiedId(CXXScopeSpec &SS, bool EnteringContext, // Handle 'A::template B'. This is for template-ids which have not // already been annotated by ParseOptionalCXXScopeSpecifier(). bool TemplateSpecified = false; - if (getLang().CPlusPlus && Tok.is(tok::kw_template) && + if (getLangOpts().CPlusPlus && Tok.is(tok::kw_template) && (ObjectType || SS.isSet())) { TemplateSpecified = true; TemplateKWLoc = ConsumeToken(); @@ -2055,7 +2055,7 @@ bool Parser::ParseUnqualifiedId(CXXScopeSpec &SS, bool EnteringContext, IdentifierInfo *Id = Tok.getIdentifierInfo(); SourceLocation IdLoc = ConsumeToken(); - if (!getLang().CPlusPlus) { + if (!getLangOpts().CPlusPlus) { // If we're not in C++, only identifiers matter. Record the // identifier and return. Result.setIdentifier(Id, IdLoc); @@ -2152,7 +2152,7 @@ bool Parser::ParseUnqualifiedId(CXXScopeSpec &SS, bool EnteringContext, return false; } - if (getLang().CPlusPlus && + if (getLangOpts().CPlusPlus && (AllowDestructorName || SS.isSet()) && Tok.is(tok::tilde)) { // C++ [expr.unary.op]p10: // There is an ambiguity in the unary-expression ~X(), where X is a @@ -2203,7 +2203,7 @@ bool Parser::ParseUnqualifiedId(CXXScopeSpec &SS, bool EnteringContext, } Diag(Tok, diag::err_expected_unqualified_id) - << getLang().CPlusPlus; + << getLangOpts().CPlusPlus; return true; } @@ -2333,7 +2333,7 @@ Parser::ParseCXXNewExpression(bool UseGlobal, SourceLocation Start) { Initializer = Actions.ActOnParenListExpr(ConstructorLParen, ConstructorRParen, move_arg(ConstructorArgs)); - } else if (Tok.is(tok::l_brace) && getLang().CPlusPlus0x) { + } else if (Tok.is(tok::l_brace) && getLangOpts().CPlusPlus0x) { Diag(Tok.getLocation(), diag::warn_cxx98_compat_generalized_initializer_lists); Initializer = ParseBraceInitializer(); @@ -2724,7 +2724,7 @@ ExprResult Parser::ParseCXXAmbiguousParenExpression(ParenParseOption &ExprType, ParsedType &CastTy, BalancedDelimiterTracker &Tracker) { - assert(getLang().CPlusPlus && "Should only be called for C++!"); + assert(getLangOpts().CPlusPlus && "Should only be called for C++!"); assert(ExprType == CastExpr && "Compound literals are not ambiguous!"); assert(isTypeIdInParens() && "Not a type-id!"); diff --git a/lib/Parse/ParseInit.cpp b/lib/Parse/ParseInit.cpp index d5e06f7fd8..d4fc9056e4 100644 --- a/lib/Parse/ParseInit.cpp +++ b/lib/Parse/ParseInit.cpp @@ -33,7 +33,7 @@ bool Parser::MayBeDesignationStart() { return true; case tok::l_square: { // designator: array-designator - if (!PP.getLangOptions().CPlusPlus0x) + if (!PP.getLangOpts().CPlusPlus0x) return true; // C++11 lambda expressions and C99 designators can be ambiguous all the @@ -223,7 +223,7 @@ ExprResult Parser::ParseInitializerWithPotentialDesignator() { // send) or send to 'super', parse this as a message send // expression. We handle C++ and C separately, since C++ requires // much more complicated parsing. - if (getLang().ObjC1 && getLang().CPlusPlus) { + if (getLangOpts().ObjC1 && getLangOpts().CPlusPlus) { // Send to 'super'. if (Tok.is(tok::identifier) && Tok.getIdentifierInfo() == Ident_super && NextToken().isNot(tok::period) && @@ -258,7 +258,7 @@ ExprResult Parser::ParseInitializerWithPotentialDesignator() { // adopt the expression for further analysis below. // FIXME: potentially-potentially evaluated expression above? Idx = ExprResult(static_cast<Expr*>(TypeOrExpr)); - } else if (getLang().ObjC1 && Tok.is(tok::identifier)) { + } else if (getLangOpts().ObjC1 && Tok.is(tok::identifier)) { IdentifierInfo *II = Tok.getIdentifierInfo(); SourceLocation IILoc = Tok.getLocation(); ParsedType ReceiverType; @@ -316,7 +316,7 @@ ExprResult Parser::ParseInitializerWithPotentialDesignator() { // tokens are '...' or ']' or an objc message send. If this is an objc // message send, handle it now. An objc-message send is the start of // an assignment-expression production. - if (getLang().ObjC1 && Tok.isNot(tok::ellipsis) && + if (getLangOpts().ObjC1 && Tok.isNot(tok::ellipsis) && Tok.isNot(tok::r_square)) { CheckArrayDesignatorSyntax(*this, Tok.getLocation(), Desig); return ParseAssignmentExprWithObjCMessageExprStart(StartLoc, @@ -404,7 +404,7 @@ ExprResult Parser::ParseBraceInitializer() { if (Tok.is(tok::r_brace)) { // Empty initializers are a C++ feature and a GNU extension to C. - if (!getLang().CPlusPlus) + if (!getLangOpts().CPlusPlus) Diag(LBraceLoc, diag::ext_gnu_empty_initializer); // Match the '}'. return Actions.ActOnInitList(LBraceLoc, MultiExprArg(Actions), @@ -415,7 +415,7 @@ ExprResult Parser::ParseBraceInitializer() { while (1) { // Handle Microsoft __if_exists/if_not_exists if necessary. - if (getLang().MicrosoftExt && (Tok.is(tok::kw___if_exists) || + if (getLangOpts().MicrosoftExt && (Tok.is(tok::kw___if_exists) || Tok.is(tok::kw___if_not_exists))) { if (ParseMicrosoftIfExistsBraceInitializer(InitExprs, InitExprsOk)) { if (Tok.isNot(tok::comma)) break; diff --git a/lib/Parse/ParseObjc.cpp b/lib/Parse/ParseObjc.cpp index cc2efd843f..c664c64b67 100644 --- a/lib/Parse/ParseObjc.cpp +++ b/lib/Parse/ParseObjc.cpp @@ -65,7 +65,7 @@ Parser::DeclGroupPtrTy Parser::ParseObjCAtDirectives() { SingleDecl = ParseObjCPropertyDynamic(AtLoc); break; case tok::objc___experimental_modules_import: - if (getLang().Modules) + if (getLangOpts().Modules) return ParseModuleImport(AtLoc); // Fall through @@ -203,7 +203,7 @@ Decl *Parser::ParseObjCAtInterfaceDeclaration(SourceLocation AtLoc, categoryId = Tok.getIdentifierInfo(); categoryLoc = ConsumeToken(); } - else if (!getLang().ObjC2) { + else if (!getLangOpts().ObjC2) { Diag(Tok, diag::err_expected_ident); // missing category name. return 0; } @@ -477,7 +477,7 @@ void Parser::ParseObjCInterfaceDeclList(tok::ObjCKeywordKind contextKey, break; case tok::objc_property: - if (!getLang().ObjC2) + if (!getLangOpts().ObjC2) Diag(AtLoc, diag::err_objc_properties_require_objc2); ObjCDeclSpec OCDS; @@ -778,7 +778,7 @@ bool Parser::isTokIdentifier_in() const { // FIXME: May have to do additional look-ahead to only allow for // valid tokens following an 'in'; such as an identifier, unary operators, // '[' etc. - return (getLang().ObjC2 && Tok.is(tok::identifier) && + return (getLangOpts().ObjC2 && Tok.is(tok::identifier) && Tok.getIdentifierInfo() == ObjCTypeQuals[objc_in]); } @@ -981,7 +981,7 @@ Decl *Parser::ParseObjCMethodDecl(SourceLocation mLoc, // If attributes exist before the method, parse them. ParsedAttributes methodAttrs(AttrFactory); - if (getLang().ObjC2) + if (getLangOpts().ObjC2) MaybeParseGNUAttributes(methodAttrs); if (Tok.is(tok::code_completion)) { @@ -1007,7 +1007,7 @@ Decl *Parser::ParseObjCMethodDecl(SourceLocation mLoc, SmallVector<DeclaratorChunk::ParamInfo, 8> CParamInfo; if (Tok.isNot(tok::colon)) { // If attributes exist after the method, parse them. - if (getLang().ObjC2) + if (getLangOpts().ObjC2) MaybeParseGNUAttributes(methodAttrs); Selector Sel = PP.getSelectorTable().getNullarySelector(SelIdent); @@ -1050,7 +1050,7 @@ Decl *Parser::ParseObjCMethodDecl(SourceLocation mLoc, // If attributes exist before the argument name, parse them. // Regardless, collect all the attributes we've parsed so far. ArgInfo.ArgAttrs = 0; - if (getLang().ObjC2) { + if (getLangOpts().ObjC2) { MaybeParseGNUAttributes(paramAttrs); ArgInfo.ArgAttrs = paramAttrs.getList(); } @@ -1129,7 +1129,7 @@ Decl *Parser::ParseObjCMethodDecl(SourceLocation mLoc, // FIXME: Add support for optional parameter list... // If attributes exist after the method, parse them. - if (getLang().ObjC2) + if (getLangOpts().ObjC2) MaybeParseGNUAttributes(methodAttrs); if (KeyIdents.size() == 0) @@ -1205,7 +1205,7 @@ ParseObjCProtocolReferences(SmallVectorImpl<Decl *> &Protocols, /// in a decl-specifier-seq, starting at the '<'. bool Parser::ParseObjCProtocolQualifiers(DeclSpec &DS) { assert(Tok.is(tok::less) && "Protocol qualifiers start with '<'"); - assert(getLang().ObjC1 && "Protocol qualifiers only exist in Objective-C"); + assert(getLangOpts().ObjC1 && "Protocol qualifiers only exist in Objective-C"); SourceLocation LAngleLoc, EndProtoLoc; SmallVector<Decl *, 8> ProtocolDecl; SmallVector<SourceLocation, 8> ProtocolLocs; @@ -2175,14 +2175,14 @@ bool Parser::ParseObjCXXMessageReceiver(bool &IsExpr, void *&TypeOrExpr) { /// This routine will only return true for a subset of valid message-send /// expressions. bool Parser::isSimpleObjCMessageExpression() { - assert(Tok.is(tok::l_square) && getLang().ObjC1 && + assert(Tok.is(tok::l_square) && getLangOpts().ObjC1 && "Incorrect start for isSimpleObjCMessageExpression"); return GetLookAheadToken(1).is(tok::identifier) && GetLookAheadToken(2).is(tok::identifier); } bool Parser::isStartOfObjCClassMessageMissingOpenBracket() { - if (!getLang().ObjC1 || !NextToken().is(tok::identifier) || + if (!getLangOpts().ObjC1 || !NextToken().is(tok::identifier) || InMessageExpression) return false; @@ -2231,7 +2231,7 @@ ExprResult Parser::ParseObjCMessageExpression() { InMessageExpressionRAIIObject InMessage(*this, true); - if (getLang().CPlusPlus) { + if (getLangOpts().CPlusPlus) { // We completely separate the C and C++ cases because C++ requires // more complicated (read: slower) parsing. @@ -2647,7 +2647,7 @@ ExprResult Parser::ParseObjCDictionaryLiteral(SourceLocation AtLoc) { // Parse the ellipsis that designates this as a pack expansion. SourceLocation EllipsisLoc; - if (Tok.is(tok::ellipsis) && getLang().CPlusPlus) + if (Tok.is(tok::ellipsis) && getLangOpts().CPlusPlus) EllipsisLoc = ConsumeToken(); // We have a valid expression. Collect it in a vector so we can diff --git a/lib/Parse/ParsePragma.cpp b/lib/Parse/ParsePragma.cpp index fef3af249c..eb13e0d357 100644 --- a/lib/Parse/ParsePragma.cpp +++ b/lib/Parse/ParsePragma.cpp @@ -143,7 +143,7 @@ void PragmaPackHandler::HandlePragma(Preprocessor &PP, // In MSVC/gcc, #pragma pack(4) sets the alignment without affecting // the push/pop stack. // In Apple gcc, #pragma pack(4) is equivalent to #pragma pack(push, 4) - if (PP.getLangOptions().ApplePragmaPack) + if (PP.getLangOpts().ApplePragmaPack) Kind = Sema::PPK_Push; } else if (Tok.is(tok::identifier)) { const IdentifierInfo *II = Tok.getIdentifierInfo(); @@ -194,7 +194,7 @@ void PragmaPackHandler::HandlePragma(Preprocessor &PP, } } } - } else if (PP.getLangOptions().ApplePragmaPack) { + } else if (PP.getLangOpts().ApplePragmaPack) { // In MSVC/gcc, #pragma pack() resets the alignment without affecting // the push/pop stack. // In Apple gcc #pragma pack() is equivalent to #pragma pack(pop). diff --git a/lib/Parse/ParseStmt.cpp b/lib/Parse/ParseStmt.cpp index cd80c4c969..5fe5e6a2b6 100644 --- a/lib/Parse/ParseStmt.cpp +++ b/lib/Parse/ParseStmt.cpp @@ -116,7 +116,7 @@ Retry: IdentifierInfo *Name = Tok.getIdentifierInfo(); SourceLocation NameLoc = Tok.getLocation(); - if (getLang().CPlusPlus) + if (getLangOpts().CPlusPlus) CheckForTemplateAndDigraph(Next, ParsedType(), /*EnteringContext=*/false, *Name, SS); @@ -207,7 +207,7 @@ Retry: } default: { - if ((getLang().CPlusPlus || !OnlyStatement) && isDeclarationStatement()) { + if ((getLangOpts().CPlusPlus || !OnlyStatement) && isDeclarationStatement()) { SourceLocation DeclStart = Tok.getLocation(), DeclEnd; DeclGroupPtrTy Decl = ParseDeclaration(Stmts, Declarator::BlockContext, DeclEnd, attrs); @@ -399,14 +399,14 @@ StmtResult Parser::ParseSEHExceptBlock(SourceLocation ExceptLoc) { ParseScope ExpectScope(this, Scope::DeclScope | Scope::ControlScope); - if (getLang().Borland) { + if (getLangOpts().Borland) { Ident__exception_info->setIsPoisoned(false); Ident___exception_info->setIsPoisoned(false); Ident_GetExceptionInfo->setIsPoisoned(false); } ExprResult FilterExpr(ParseExpression()); - if (getLang().Borland) { + if (getLangOpts().Borland) { Ident__exception_info->setIsPoisoned(true); Ident___exception_info->setIsPoisoned(true); Ident_GetExceptionInfo->setIsPoisoned(true); @@ -770,7 +770,7 @@ StmtResult Parser::ParseCompoundStatementBody(bool isStmtExpr) { continue; } - if (getLang().MicrosoftExt && (Tok.is(tok::kw___if_exists) || + if (getLangOpts().MicrosoftExt && (Tok.is(tok::kw___if_exists) || Tok.is(tok::kw___if_not_exists))) { ParseMicrosoftIfExistsStatement(Stmts); continue; @@ -855,7 +855,7 @@ bool Parser::ParseParenExprOrCondition(ExprResult &ExprResult, BalancedDelimiterTracker T(*this, tok::l_paren); T.consumeOpen(); - if (getLang().CPlusPlus) + if (getLangOpts().CPlusPlus) ParseCXXCondition(ExprResult, DeclResult, Loc, ConvertToBoolean); else { ExprResult = ParseExpression(); @@ -904,7 +904,7 @@ StmtResult Parser::ParseIfStatement(ParsedAttributes &attrs, return StmtError(); } - bool C99orCXX = getLang().C99 || getLang().CPlusPlus; + bool C99orCXX = getLangOpts().C99 || getLangOpts().CPlusPlus; // C99 6.8.4p3 - In C99, the if statement is a block. This is not // the case for C90. @@ -1038,7 +1038,7 @@ StmtResult Parser::ParseSwitchStatement(ParsedAttributes &attrs, return StmtError(); } - bool C99orCXX = getLang().C99 || getLang().CPlusPlus; + bool C99orCXX = getLangOpts().C99 || getLangOpts().CPlusPlus; // C99 6.8.4p3 - In C99, the switch statement is a block. This is // not the case for C90. Start the switch scope. @@ -1130,7 +1130,7 @@ StmtResult Parser::ParseWhileStatement(ParsedAttributes &attrs, return StmtError(); } - bool C99orCXX = getLang().C99 || getLang().CPlusPlus; + bool C99orCXX = getLangOpts().C99 || getLangOpts().CPlusPlus; // C99 6.8.5p5 - In C99, the while statement is a block. This is not // the case for C90. Start the loop scope. @@ -1200,7 +1200,7 @@ StmtResult Parser::ParseDoStatement(ParsedAttributes &attrs) { // C99 6.8.5p5 - In C99, the do statement is a block. This is not // the case for C90. Start the loop scope. unsigned ScopeFlags; - if (getLang().C99) + if (getLangOpts().C99) ScopeFlags = Scope::BreakScope | Scope::ContinueScope | Scope::DeclScope; else ScopeFlags = Scope::BreakScope | Scope::ContinueScope; @@ -1216,7 +1216,7 @@ StmtResult Parser::ParseDoStatement(ParsedAttributes &attrs) { // which is entered and exited each time through the loop. // ParseScope InnerScope(this, Scope::DeclScope, - (getLang().C99 || getLang().CPlusPlus) && + (getLangOpts().C99 || getLangOpts().CPlusPlus) && Tok.isNot(tok::l_brace)); // Read the body statement. @@ -1287,7 +1287,7 @@ StmtResult Parser::ParseForStatement(ParsedAttributes &attrs, return StmtError(); } - bool C99orCXXorObjC = getLang().C99 || getLang().CPlusPlus || getLang().ObjC1; + bool C99orCXXorObjC = getLangOpts().C99 || getLangOpts().CPlusPlus || getLangOpts().ObjC1; // C99 6.8.5p5 - In C99, the for statement is a block. This is not // the case for C90. Start the loop scope. @@ -1348,7 +1348,7 @@ StmtResult Parser::ParseForStatement(ParsedAttributes &attrs, MaybeParseCXX0XAttributes(attrs); // In C++0x, "for (T NS:a" might not be a typo for :: - bool MightBeForRangeStmt = getLang().CPlusPlus; + bool MightBeForRangeStmt = getLangOpts().CPlusPlus; ColonProtectionRAIIObject ColonProtection(*this, MightBeForRangeStmt); SourceLocation DeclStart = Tok.getLocation(), DeclEnd; @@ -1360,7 +1360,7 @@ StmtResult Parser::ParseForStatement(ParsedAttributes &attrs, FirstPart = Actions.ActOnDeclStmt(DG, DeclStart, Tok.getLocation()); if (ForRangeInit.ParsedForRangeDecl()) { - Diag(ForRangeInit.ColonLoc, getLang().CPlusPlus0x ? + Diag(ForRangeInit.ColonLoc, getLangOpts().CPlusPlus0x ? diag::warn_cxx98_compat_for_range : diag::ext_for_range); ForRange = true; @@ -1404,7 +1404,7 @@ StmtResult Parser::ParseForStatement(ParsedAttributes &attrs, return StmtError(); } Collection = ParseExpression(); - } else if (getLang().CPlusPlus0x && Tok.is(tok::colon) && FirstPart.get()) { + } else if (getLangOpts().CPlusPlus0x && Tok.is(tok::colon) && FirstPart.get()) { // User tried to write the reasonable, but ill-formed, for-range-statement // for (expr : expr) { ... } Diag(Tok, diag::err_for_range_expected_decl) @@ -1431,7 +1431,7 @@ StmtResult Parser::ParseForStatement(ParsedAttributes &attrs, // missing both semicolons. } else { ExprResult Second; - if (getLang().CPlusPlus) + if (getLangOpts().CPlusPlus) ParseCXXCondition(Second, SecondVar, ForLoc, true); else { Second = ParseExpression(); @@ -1605,10 +1605,10 @@ StmtResult Parser::ParseReturnStatement(ParsedAttributes &attrs) { return StmtError(); } - if (Tok.is(tok::l_brace) && getLang().CPlusPlus) { + if (Tok.is(tok::l_brace) && getLangOpts().CPlusPlus) { R = ParseInitializer(); if (R.isUsable()) - Diag(R.get()->getLocStart(), getLang().CPlusPlus0x ? + Diag(R.get()->getLocStart(), getLangOpts().CPlusPlus0x ? diag::warn_cxx98_compat_generalized_initializer_lists : diag::ext_generalized_initializer_lists) << R.get()->getSourceRange(); @@ -1771,7 +1771,7 @@ StmtResult Parser::ParseAsmStatement(bool &msAsm) { assert(Tok.is(tok::kw_asm) && "Not an asm stmt"); SourceLocation AsmLoc = ConsumeToken(); - if (getLang().MicrosoftExt && Tok.isNot(tok::l_paren) && !isTypeQualifier()) { + if (getLangOpts().MicrosoftExt && Tok.isNot(tok::l_paren) && !isTypeQualifier()) { msAsm = true; return ParseMicrosoftAsmStatement(AsmLoc); } diff --git a/lib/Parse/ParseTemplate.cpp b/lib/Parse/ParseTemplate.cpp index 84b967e213..305f07bc90 100644 --- a/lib/Parse/ParseTemplate.cpp +++ b/lib/Parse/ParseTemplate.cpp @@ -478,7 +478,7 @@ Decl *Parser::ParseTypeParameter(unsigned Depth, unsigned Position) { EllipsisLoc = ConsumeToken(); Diag(EllipsisLoc, - getLang().CPlusPlus0x + getLangOpts().CPlusPlus0x ? diag::warn_cxx98_compat_variadic_templates : diag::ext_variadic_templates); } @@ -553,7 +553,7 @@ Parser::ParseTemplateTemplateParameter(unsigned Depth, unsigned Position) { EllipsisLoc = ConsumeToken(); Diag(EllipsisLoc, - getLang().CPlusPlus0x + getLangOpts().CPlusPlus0x ? diag::warn_cxx98_compat_variadic_templates : diag::ext_variadic_templates); } @@ -716,7 +716,7 @@ Parser::ParseTemplateIdAfterTemplateName(TemplateTy Template, if (NextToken().is(tok::greater) || NextToken().is(tok::greatergreater)) ReplaceStr = "> > "; - Diag(Tok.getLocation(), getLang().CPlusPlus0x ? + Diag(Tok.getLocation(), getLangOpts().CPlusPlus0x ? diag::warn_cxx98_compat_two_right_angle_brackets : diag::err_two_right_angle_brackets_need_space) << FixItHint::CreateReplacement(SourceRange(Tok.getLocation()), @@ -776,7 +776,7 @@ bool Parser::AnnotateTemplateIdToken(TemplateTy Template, TemplateNameKind TNK, SourceLocation TemplateKWLoc, UnqualifiedId &TemplateName, bool AllowTypeAnnotation) { - assert(getLang().CPlusPlus && "Can only annotate template-ids in C++"); + assert(getLangOpts().CPlusPlus && "Can only annotate template-ids in C++"); assert(Template && Tok.is(tok::less) && "Parser isn't at the beginning of a template-id"); diff --git a/lib/Parse/ParseTentative.cpp b/lib/Parse/ParseTentative.cpp index 92ae770fa0..1e30c7fff6 100644 --- a/lib/Parse/ParseTentative.cpp +++ b/lib/Parse/ParseTentative.cpp @@ -149,7 +149,7 @@ Parser::TPResult Parser::TryParseSimpleDeclaration(bool AllowForRangeDecl) { else { ConsumeToken(); - if (getLang().ObjC1 && Tok.is(tok::less)) + if (getLangOpts().ObjC1 && Tok.is(tok::less)) TryParseProtocolQualifiers(); } @@ -258,7 +258,7 @@ bool Parser::isCXXConditionDeclaration() { else { ConsumeToken(); - if (getLang().ObjC1 && Tok.is(tok::less)) + if (getLangOpts().ObjC1 && Tok.is(tok::less)) TryParseProtocolQualifiers(); } assert(Tok.is(tok::l_paren) && "Expected '('"); @@ -276,7 +276,7 @@ bool Parser::isCXXConditionDeclaration() { if (Tok.is(tok::equal) || Tok.is(tok::kw_asm) || Tok.is(tok::kw___attribute)) TPR = TPResult::True(); - else if (getLang().CPlusPlus0x && Tok.is(tok::l_brace)) + else if (getLangOpts().CPlusPlus0x && Tok.is(tok::l_brace)) TPR = TPResult::True(); else TPR = TPResult::False(); @@ -335,7 +335,7 @@ bool Parser::isCXXTypeId(TentativeCXXTypeIdContext Context, bool &isAmbiguous) { else { ConsumeToken(); - if (getLang().ObjC1 && Tok.is(tok::less)) + if (getLangOpts().ObjC1 && Tok.is(tok::less)) TryParseProtocolQualifiers(); } @@ -360,7 +360,7 @@ bool Parser::isCXXTypeId(TentativeCXXTypeIdContext Context, bool &isAmbiguous) { // ',', this is a type-id. Otherwise, it's an expression. } else if (Context == TypeIdAsTemplateArgument && (Tok.is(tok::greater) || Tok.is(tok::comma) || - (getLang().CPlusPlus0x && Tok.is(tok::greatergreater)))) { + (getLangOpts().CPlusPlus0x && Tok.is(tok::greatergreater)))) { TPR = TPResult::True(); isAmbiguous = true; @@ -430,7 +430,7 @@ bool Parser::isCXX0XAttributeSpecifier (bool CheckClosing, return false; // No tentative parsing if we don't need to look for ]] - if (!CheckClosing && !getLang().ObjC1) + if (!CheckClosing && !getLangOpts().ObjC1) return true; struct TentativeReverter { @@ -1005,7 +1005,7 @@ Parser::isCXXDeclarationSpecifier(Parser::TPResult BracedCastResult) { case tok::annot_typename: case_typename: // In Objective-C, we might have a protocol-qualified type. - if (getLang().ObjC1 && NextToken().is(tok::less)) { + if (getLangOpts().ObjC1 && NextToken().is(tok::less)) { // Tentatively parse the TentativeParsingAction PA(*this); ConsumeToken(); // The type token @@ -1022,7 +1022,7 @@ Parser::isCXXDeclarationSpecifier(Parser::TPResult BracedCastResult) { if (isFollowedByParen) return TPResult::Ambiguous(); - if (getLang().CPlusPlus0x && isFollowedByBrace) + if (getLangOpts().CPlusPlus0x && isFollowedByBrace) return BracedCastResult; return TPResult::True(); @@ -1053,7 +1053,7 @@ Parser::isCXXDeclarationSpecifier(Parser::TPResult BracedCastResult) { // enum E : int { a = 4 }; // enum // enum E : int { 4 }; // bit-field // }; - if (getLang().CPlusPlus0x && NextToken().is(tok::l_brace)) + if (getLangOpts().CPlusPlus0x && NextToken().is(tok::l_brace)) return BracedCastResult; if (isStartOfObjCClassMessageMissingOpenBracket()) @@ -1080,7 +1080,7 @@ Parser::isCXXDeclarationSpecifier(Parser::TPResult BracedCastResult) { if (isFollowedByParen) return TPResult::Ambiguous(); - if (getLang().CPlusPlus0x && isFollowedByBrace) + if (getLangOpts().CPlusPlus0x && isFollowedByBrace) return BracedCastResult; return TPResult::True(); @@ -1150,7 +1150,7 @@ Parser::TPResult Parser::TryParseDeclarationSpecifier() { else { ConsumeToken(); - if (getLang().ObjC1 && Tok.is(tok::less)) + if (getLangOpts().ObjC1 && Tok.is(tok::less)) TryParseProtocolQualifiers(); } diff --git a/lib/Parse/Parser.cpp b/lib/Parse/Parser.cpp index 725a8f8c30..9613ad0f85 100644 --- a/lib/Parse/Parser.cpp +++ b/lib/Parse/Parser.cpp @@ -25,7 +25,7 @@ using namespace clang; IdentifierInfo *Parser::getSEHExceptKeyword() { // __except is accepted as a (contextual) keyword - if (!Ident__except && (getLang().MicrosoftExt || getLang().Borland)) + if (!Ident__except && (getLangOpts().MicrosoftExt || getLangOpts().Borland)) Ident__except = PP.getIdentifierInfo("__except"); return Ident__except; @@ -70,7 +70,7 @@ Parser::Parser(Preprocessor &pp, Sema &actions) FPContractHandler.reset(new PragmaFPContractHandler(actions, *this)); PP.AddPragmaHandler("STDC", FPContractHandler.get()); - if (getLang().OpenCL) { + if (getLangOpts().OpenCL) { OpenCLExtensionHandler.reset( new PragmaOpenCLExtensionHandler(actions, *this)); PP.AddPragmaHandler("OPENCL", OpenCLExtensionHandler.get()); @@ -388,7 +388,7 @@ Parser::~Parser() { PP.RemovePragmaHandler(RedefineExtnameHandler.get()); RedefineExtnameHandler.reset(); - if (getLang().OpenCL) { + if (getLangOpts().OpenCL) { PP.RemovePragmaHandler("OPENCL", OpenCLExtensionHandler.get()); OpenCLExtensionHandler.reset(); PP.RemovePragmaHandler("OPENCL", FPContractHandler.get()); @@ -411,12 +411,12 @@ void Parser::Initialize() { ConsumeToken(); if (Tok.is(tok::eof) && - !getLang().CPlusPlus) // Empty source file is an extension in C + !getLangOpts().CPlusPlus) // Empty source file is an extension in C Diag(Tok, diag::ext_empty_source_file); // Initialization for Objective-C context sensitive keywords recognition. // Referenced in Parser::ParseObjCTypeQualifierList. - if (getLang().ObjC1) { + if (getLangOpts().ObjC1) { ObjCTypeQuals[objc_in] = &PP.getIdentifierTable().get("in"); ObjCTypeQuals[objc_out] = &PP.getIdentifierTable().get("out"); ObjCTypeQuals[objc_inout] = &PP.getIdentifierTable().get("inout"); @@ -431,7 +431,7 @@ void Parser::Initialize() { Ident_super = &PP.getIdentifierTable().get("super"); - if (getLang().AltiVec) { + if (getLangOpts().AltiVec) { Ident_vector = &PP.getIdentifierTable().get("vector"); Ident_pixel = &PP.getIdentifierTable().get("pixel"); } @@ -447,7 +447,7 @@ void Parser::Initialize() { Ident___exception_code = Ident___exception_info = Ident___abnormal_termination = 0; Ident_GetExceptionCode = Ident_GetExceptionInfo = Ident_AbnormalTermination = 0; - if(getLang().Borland) { + if(getLangOpts().Borland) { Ident__exception_info = PP.getIdentifierInfo("_exception_info"); Ident___exception_info = PP.getIdentifierInfo("__exception_info"); Ident_GetExceptionInfo = PP.getIdentifierInfo("GetExceptionInformation"); @@ -481,7 +481,7 @@ bool Parser::ParseTopLevelDecl(DeclGroupPtrTy &Result) { Result = DeclGroupPtrTy(); if (Tok.is(tok::eof)) { // Late template parsing can begin. - if (getLang().DelayedTemplateParsing) + if (getLangOpts().DelayedTemplateParsing) Actions.SetLateTemplateParser(LateTemplateParserCallback, this); Actions.ActOnEndOfTranslationUnit(); @@ -553,7 +553,7 @@ Parser::ParseExternalDeclaration(ParsedAttributesWithRange &attrs, HandlePragmaPack(); return DeclGroupPtrTy(); case tok::semi: - Diag(Tok, getLang().CPlusPlus0x ? + Diag(Tok, getLangOpts().CPlusPlus0x ? diag::warn_cxx98_compat_top_level_semi : diag::ext_top_level_semi) << FixItHint::CreateRemoval(Tok.getLocation()); @@ -592,7 +592,7 @@ Parser::ParseExternalDeclaration(ParsedAttributesWithRange &attrs, return ParseObjCAtDirectives(); case tok::minus: case tok::plus: - if (!getLang().ObjC1) { + if (!getLangOpts().ObjC1) { Diag(Tok, diag::err_expected_external_declaration); ConsumeToken(); return DeclGroupPtrTy(); @@ -622,7 +622,7 @@ Parser::ParseExternalDeclaration(ParsedAttributesWithRange &attrs, case tok::kw_static: // Parse (then ignore) 'static' prior to a template instantiation. This is // a GCC extension that we intentionally do not support. - if (getLang().CPlusPlus && NextToken().is(tok::kw_template)) { + if (getLangOpts().CPlusPlus && NextToken().is(tok::kw_template)) { Diag(ConsumeToken(), diag::warn_static_inline_explicit_inst_ignored) << 0; SourceLocation DeclEnd; @@ -632,7 +632,7 @@ Parser::ParseExternalDeclaration(ParsedAttributesWithRange &attrs, goto dont_know; case tok::kw_inline: - if (getLang().CPlusPlus) { + if (getLangOpts().CPlusPlus) { tok::TokenKind NextKind = NextToken().getKind(); // Inline namespaces. Allowed as an extension even in C++03. @@ -655,11 +655,11 @@ Parser::ParseExternalDeclaration(ParsedAttributesWithRange &attrs, goto dont_know; case tok::kw_extern: - if (getLang().CPlusPlus && NextToken().is(tok::kw_template)) { + if (getLangOpts().CPlusPlus && NextToken().is(tok::kw_template)) { // Extern templates SourceLocation ExternLoc = ConsumeToken(); SourceLocation TemplateLoc = ConsumeToken(); - Diag(ExternLoc, getLang().CPlusPlus0x ? + Diag(ExternLoc, getLangOpts().CPlusPlus0x ? diag::warn_cxx98_compat_extern_template : diag::ext_extern_template) << SourceRange(ExternLoc, TemplateLoc); SourceLocation DeclEnd; @@ -695,7 +695,7 @@ Parser::ParseExternalDeclaration(ParsedAttributesWithRange &attrs, /// declarator, continues a declaration or declaration list. bool Parser::isDeclarationAfterDeclarator() { // Check for '= delete' or '= default' - if (getLang().CPlusPlus && Tok.is(tok::equal)) { + if (getLangOpts().CPlusPlus && Tok.is(tok::equal)) { const Token &KW = NextToken(); if (KW.is(tok::kw_default) || KW.is(tok::kw_delete)) return false; @@ -706,7 +706,7 @@ bool Parser::isDeclarationAfterDeclarator() { Tok.is(tok::semi) || // int X(); -> not a function def Tok.is(tok::kw_asm) || // int X() __asm__ -> not a function def Tok.is(tok::kw___attribute) || // int X() __attr__ -> not a function def - (getLang().CPlusPlus && + (getLangOpts().CPlusPlus && Tok.is(tok::l_paren)); // int X(0) -> not a function def [C++] } @@ -718,11 +718,11 @@ bool Parser::isStartOfFunctionDefinition(const ParsingDeclarator &Declarator) { return true; // Handle K&R C argument lists: int X(f) int f; {} - if (!getLang().CPlusPlus && + if (!getLangOpts().CPlusPlus && Declarator.getFunctionTypeInfo().isKNRPrototype()) return isDeclarationSpecifier(); - if (getLang().CPlusPlus && Tok.is(tok::equal)) { + if (getLangOpts().CPlusPlus && Tok.is(tok::equal)) { const Token &KW = NextToken(); return KW.is(tok::kw_default) || KW.is(tok::kw_delete); } @@ -765,7 +765,7 @@ Parser::ParseDeclarationOrFunctionDefinition(ParsingDeclSpec &DS, // ObjC2 allows prefix attributes on class interfaces and protocols. // FIXME: This still needs better diagnostics. We should only accept // attributes here, no types, etc. - if (getLang().ObjC2 && Tok.is(tok::at)) { + if (getLangOpts().ObjC2 && Tok.is(tok::at)) { SourceLocation AtLoc = ConsumeToken(); // the "@" if (!Tok.isObjCAtKeyword(tok::objc_interface) && !Tok.isObjCAtKeyword(tok::objc_protocol)) { @@ -791,7 +791,7 @@ Parser::ParseDeclarationOrFunctionDefinition(ParsingDeclSpec &DS, // If the declspec consisted only of 'extern' and we have a string // literal following it, this must be a C++ linkage specifier like // 'extern "C"'. - if (Tok.is(tok::string_literal) && getLang().CPlusPlus && + if (Tok.is(tok::string_literal) && getLangOpts().CPlusPlus && DS.getStorageClassSpec() == DeclSpec::SCS_extern && DS.getParsedSpecifiers() == DeclSpec::PQ_StorageClassSpecifier) { Decl *TheDecl = ParseLinkage(DS, Declarator::FileContext); @@ -838,7 +838,7 @@ Decl *Parser::ParseFunctionDefinition(ParsingDeclarator &D, // If this is C90 and the declspecs were completely missing, fudge in an // implicit int. We do this here because this is the only place where // declaration-specifiers are completely optional in the grammar. - if (getLang().ImplicitInt && D.getDeclSpec().isEmpty()) { + if (getLangOpts().ImplicitInt && D.getDeclSpec().isEmpty()) { const char *PrevSpec; unsigned DiagID; D.getMutableDeclSpec().SetTypeSpecType(DeclSpec::TST_int, @@ -856,7 +856,7 @@ Decl *Parser::ParseFunctionDefinition(ParsingDeclarator &D, // We should have either an opening brace or, in a C++ constructor, // we may have a colon. if (Tok.isNot(tok::l_brace) && - (!getLang().CPlusPlus || + (!getLangOpts().CPlusPlus || (Tok.isNot(tok::colon) && Tok.isNot(tok::kw_try) && Tok.isNot(tok::equal)))) { Diag(Tok, diag::err_expected_fn_body); @@ -884,7 +884,7 @@ Decl *Parser::ParseFunctionDefinition(ParsingDeclarator &D, // In delayed template parsing mode, for function template we consume the // tokens and store them for late parsing at the end of the translation unit. - if (getLang().DelayedTemplateParsing && + if (getLangOpts().DelayedTemplateParsing && TemplateInfo.Kind == ParsedTemplateInfo::Template) { MultiTemplateParamsArg TemplateParameterLists(Actions, TemplateInfo.TemplateParams->data(), @@ -940,7 +940,7 @@ Decl *Parser::ParseFunctionDefinition(ParsingDeclarator &D, D.getMutableDeclSpec().abort(); if (Tok.is(tok::equal)) { - assert(getLang().CPlusPlus && "Only C++ function definitions have '='"); + assert(getLangOpts().CPlusPlus && "Only C++ function definitions have '='"); ConsumeToken(); Actions.ActOnFinishFunctionBody(Res, 0, false); @@ -948,7 +948,7 @@ Decl *Parser::ParseFunctionDefinition(ParsingDeclarator &D, bool Delete = false; SourceLocation KWLoc; if (Tok.is(tok::kw_delete)) { - Diag(Tok, getLang().CPlusPlus0x ? + Diag(Tok, getLangOpts().CPlusPlus0x ? diag::warn_cxx98_compat_deleted_function : diag::ext_deleted_function); @@ -956,7 +956,7 @@ Decl *Parser::ParseFunctionDefinition(ParsingDeclarator &D, Actions.SetDeclDeleted(Res, KWLoc); Delete = true; } else if (Tok.is(tok::kw_default)) { - Diag(Tok, getLang().CPlusPlus0x ? + Diag(Tok, getLangOpts().CPlusPlus0x ? diag::warn_cxx98_compat_defaulted_function : diag::ext_defaulted_function); @@ -1240,7 +1240,7 @@ bool Parser::TryAnnotateTypeOrScopeToken(bool EnteringContext, bool NeedType) { 0, /*IsTypename*/true)) return true; if (!SS.isSet()) { - if (getLang().MicrosoftExt) + if (getLangOpts().MicrosoftExt) Diag(Tok.getLocation(), diag::warn_expected_qualified_after_typename); else Diag(Tok.getLocation(), diag::err_expected_qualified_after_typename); @@ -1291,7 +1291,7 @@ bool Parser::TryAnnotateTypeOrScopeToken(bool EnteringContext, bool NeedType) { bool wasScopeAnnotation = Tok.is(tok::annot_cxxscope); CXXScopeSpec SS; - if (getLang().CPlusPlus) + if (getLangOpts().CPlusPlus) if (ParseOptionalCXXScopeSpecifier(SS, ParsedType(), EnteringContext)) return true; @@ -1323,7 +1323,7 @@ bool Parser::TryAnnotateTypeOrScopeToken(bool EnteringContext, bool NeedType) { return false; } - if (!getLang().CPlusPlus) { + if (!getLangOpts().CPlusPlus) { // If we're in C, we can't have :: tokens at all (the lexer won't return // them). If the identifier is not a type, then it can't be scope either, // just early exit. @@ -1402,7 +1402,7 @@ bool Parser::TryAnnotateTypeOrScopeToken(bool EnteringContext, bool NeedType) { /// Note that this routine emits an error if you call it with ::new or ::delete /// as the current tokens, so only call it in contexts where these are invalid. bool Parser::TryAnnotateCXXScopeToken(bool EnteringContext) { - assert(getLang().CPlusPlus && + assert(getLangOpts().CPlusPlus && "Call sites of this function should be guarded by checking for C++"); assert((Tok.is(tok::identifier) || Tok.is(tok::coloncolon) || (Tok.is(tok::annot_template_id) && NextToken().is(tok::coloncolon)) || |