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/Sema | |
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/Sema')
34 files changed, 740 insertions, 740 deletions
diff --git a/lib/Sema/DeclSpec.cpp b/lib/Sema/DeclSpec.cpp index 72a51bc474..97e00f0c56 100644 --- a/lib/Sema/DeclSpec.cpp +++ b/lib/Sema/DeclSpec.cpp @@ -421,7 +421,7 @@ bool DeclSpec::SetStorageClassSpec(Sema &S, SCS SC, SourceLocation Loc, // It seems sensible to prohibit private_extern too // The cl_clang_storage_class_specifiers extension enables support for // these storage-class specifiers. - if (S.getLangOptions().OpenCL && + if (S.getLangOpts().OpenCL && !S.getOpenCLOptions().cl_clang_storage_class_specifiers) { switch (SC) { case SCS_extern: @@ -440,7 +440,7 @@ bool DeclSpec::SetStorageClassSpec(Sema &S, SCS SC, SourceLocation Loc, if (StorageClassSpec != SCS_unspecified) { // Maybe this is an attempt to use C++0x 'auto' outside of C++0x mode. bool isInvalid = true; - if (TypeSpecType == TST_unspecified && S.getLangOptions().CPlusPlus) { + if (TypeSpecType == TST_unspecified && S.getLangOpts().CPlusPlus) { if (SC == SCS_auto) return SetTypeSpecType(TST_auto, Loc, PrevSpec, DiagID); if (StorageClassSpec == SCS_auto) { @@ -866,7 +866,7 @@ void DeclSpec::Finish(DiagnosticsEngine &D, Preprocessor &PP) { TypeSpecType = TST_double; // _Complex -> _Complex double. } else if (TypeSpecType == TST_int || TypeSpecType == TST_char) { // Note that this intentionally doesn't include _Complex _Bool. - if (!PP.getLangOptions().CPlusPlus) + if (!PP.getLangOpts().CPlusPlus) Diag(D, TSTLoc, diag::ext_integer_complex); } else if (TypeSpecType != TST_float && TypeSpecType != TST_double) { Diag(D, TSCLoc, diag::err_invalid_complex_spec) @@ -880,7 +880,7 @@ void DeclSpec::Finish(DiagnosticsEngine &D, Preprocessor &PP) { // class specifier, then assume this is an attempt to use C++0x's 'auto' // type specifier. // FIXME: Does Microsoft really support implicit int in C++? - if (PP.getLangOptions().CPlusPlus && !PP.getLangOptions().MicrosoftExt && + if (PP.getLangOpts().CPlusPlus && !PP.getLangOpts().MicrosoftExt && TypeSpecType == TST_unspecified && StorageClassSpec == SCS_auto) { TypeSpecType = TST_auto; StorageClassSpec = StorageClassSpecAsWritten = SCS_unspecified; @@ -889,9 +889,9 @@ void DeclSpec::Finish(DiagnosticsEngine &D, Preprocessor &PP) { } // Diagnose if we've recovered from an ill-formed 'auto' storage class // specifier in a pre-C++0x dialect of C++. - if (!PP.getLangOptions().CPlusPlus0x && TypeSpecType == TST_auto) + if (!PP.getLangOpts().CPlusPlus0x && TypeSpecType == TST_auto) Diag(D, TSTLoc, diag::ext_auto_type_specifier); - if (PP.getLangOptions().CPlusPlus && !PP.getLangOptions().CPlusPlus0x && + if (PP.getLangOpts().CPlusPlus && !PP.getLangOpts().CPlusPlus0x && StorageClassSpec == SCS_auto) Diag(D, StorageClassSpecLoc, diag::warn_auto_storage_class) << FixItHint::CreateRemoval(StorageClassSpecLoc); diff --git a/lib/Sema/IdentifierResolver.cpp b/lib/Sema/IdentifierResolver.cpp index 218323134a..4d62cab167 100644 --- a/lib/Sema/IdentifierResolver.cpp +++ b/lib/Sema/IdentifierResolver.cpp @@ -97,7 +97,7 @@ IdentifierResolver::IdDeclInfo::ReplaceDecl(NamedDecl *Old, NamedDecl *New) { //===----------------------------------------------------------------------===// IdentifierResolver::IdentifierResolver(Preprocessor &PP) - : LangOpt(PP.getLangOptions()), PP(PP), + : LangOpt(PP.getLangOpts()), PP(PP), IdDeclInfos(new IdDeclInfoMap) { } diff --git a/lib/Sema/JumpDiagnostics.cpp b/lib/Sema/JumpDiagnostics.cpp index 9a1d023fec..ab786c65aa 100644 --- a/lib/Sema/JumpDiagnostics.cpp +++ b/lib/Sema/JumpDiagnostics.cpp @@ -135,7 +135,7 @@ static ScopePair GetDiagForGotoScopeDecl(ASTContext &Context, const Decl *D) { return ScopePair(diag::note_protected_by_cleanup, diag::note_exits_cleanup); - if (Context.getLangOptions().ObjCAutoRefCount && VD->hasLocalStorage()) { + if (Context.getLangOpts().ObjCAutoRefCount && VD->hasLocalStorage()) { switch (VD->getType().getObjCLifetime()) { case Qualifiers::OCL_None: case Qualifiers::OCL_ExplicitNone: @@ -149,7 +149,7 @@ static ScopePair GetDiagForGotoScopeDecl(ASTContext &Context, const Decl *D) { } } - if (Context.getLangOptions().CPlusPlus && VD->hasLocalStorage()) { + if (Context.getLangOpts().CPlusPlus && VD->hasLocalStorage()) { // C++11 [stmt.dcl]p3: // A program that jumps from a point where a variable with automatic // storage duration is not in scope to a point where it is in scope @@ -654,7 +654,7 @@ static bool IsMicrosoftJumpWarning(unsigned JumpDiag, unsigned InDiagNote) { /// Return true if a particular note should be downgraded to a compatibility /// warning in C++11 mode. static bool IsCXX98CompatWarning(Sema &S, unsigned InDiagNote) { - return S.getLangOptions().CPlusPlus0x && + return S.getLangOpts().CPlusPlus0x && InDiagNote == diag::note_protected_by_variable_non_pod; } @@ -737,7 +737,7 @@ void JumpScopeChecker::CheckJump(Stmt *From, Stmt *To, SourceLocation DiagLoc, SmallVector<unsigned, 10> ToScopesError; SmallVector<unsigned, 10> ToScopesWarning; for (unsigned I = ToScope; I != CommonScope; I = Scopes[I].ParentScope) { - if (S.getLangOptions().MicrosoftMode && JumpDiagWarning != 0 && + if (S.getLangOpts().MicrosoftMode && JumpDiagWarning != 0 && IsMicrosoftJumpWarning(JumpDiagError, Scopes[I].InDiag)) ToScopesWarning.push_back(I); else if (IsCXX98CompatWarning(S, Scopes[I].InDiag)) diff --git a/lib/Sema/Sema.cpp b/lib/Sema/Sema.cpp index 40308f07b1..4557a23621 100644 --- a/lib/Sema/Sema.cpp +++ b/lib/Sema/Sema.cpp @@ -60,7 +60,7 @@ LambdaScopeInfo::~LambdaScopeInfo() { } PrintingPolicy Sema::getPrintingPolicy(const ASTContext &Context, const Preprocessor &PP) { PrintingPolicy Policy = Context.getPrintingPolicy(); - Policy.Bool = Context.getLangOptions().Bool; + Policy.Bool = Context.getLangOpts().Bool; if (!Policy.Bool) { if (MacroInfo *BoolMacro = PP.getMacroInfo(&Context.Idents.get("bool"))) { Policy.Bool = BoolMacro->isObjectLike() && @@ -82,8 +82,8 @@ void Sema::ActOnTranslationUnitScope(Scope *S) { Sema::Sema(Preprocessor &pp, ASTContext &ctxt, ASTConsumer &consumer, TranslationUnitKind TUKind, CodeCompleteConsumer *CodeCompleter) - : TheTargetAttributesSema(0), FPFeatures(pp.getLangOptions()), - LangOpts(pp.getLangOptions()), PP(pp), Context(ctxt), Consumer(consumer), + : TheTargetAttributesSema(0), FPFeatures(pp.getLangOpts()), + LangOpts(pp.getLangOpts()), PP(pp), Context(ctxt), Consumer(consumer), Diags(PP.getDiagnostics()), SourceMgr(PP.getSourceManager()), CollectStats(false), ExternalSource(0), CodeCompleter(CodeCompleter), CurContext(0), OriginalLexicalContext(0), @@ -107,10 +107,10 @@ Sema::Sema(Preprocessor &pp, ASTContext &ctxt, ASTConsumer &consumer, for (unsigned I = 0; I != NSAPI::NumNSNumberLiteralMethods; ++I) NSNumberLiteralMethods[I] = 0; - if (getLangOptions().ObjC1) + if (getLangOpts().ObjC1) NSAPIObj.reset(new NSAPI(Context)); - if (getLangOptions().CPlusPlus) + if (getLangOpts().CPlusPlus) FieldCollector.reset(new CXXFieldCollector()); // Tell diagnostics how to render things from the AST library. @@ -152,7 +152,7 @@ void Sema::Initialize() { // Initialize predefined Objective-C types: - if (PP.getLangOptions().ObjC1) { + if (PP.getLangOpts().ObjC1) { // If 'SEL' does not yet refer to any declarations, make it refer to the // predefined 'SEL'. DeclarationName SEL = &Context.Idents.get("SEL"); @@ -265,7 +265,7 @@ ExprResult Sema::ImpCastExprToType(Expr *E, QualType Ty, if (ExprTy == TypeTy) return Owned(E); - if (getLangOptions().ObjCAutoRefCount) + if (getLangOpts().ObjCAutoRefCount) CheckObjCARCConversion(SourceRange(), Ty, E, CCK); // If this is a derived-to-base cast to a through a virtual base, we @@ -698,7 +698,7 @@ Sema::SemaDiagnosticBuilder::~SemaDiagnosticBuilder() { // make access control a part of SFINAE for the purposes of checking // type traits. if (!SemaRef.AccessCheckingSFINAE && - !SemaRef.getLangOptions().CPlusPlus0x) + !SemaRef.getLangOpts().CPlusPlus0x) break; SourceLocation Loc = getLocation(); diff --git a/lib/Sema/SemaAccess.cpp b/lib/Sema/SemaAccess.cpp index 57d5e43f96..ea74346c16 100644 --- a/lib/Sema/SemaAccess.cpp +++ b/lib/Sema/SemaAccess.cpp @@ -1274,7 +1274,7 @@ static AccessResult CheckEffectiveAccess(Sema &S, AccessTarget &Entity) { assert(Entity.getAccess() != AS_public && "called for public access!"); - if (S.getLangOptions().MicrosoftMode && + if (S.getLangOpts().MicrosoftMode && IsMicrosoftUsingDeclarationAccessBug(S, Loc, Entity)) return AR_accessible; @@ -1394,7 +1394,7 @@ void Sema::HandleDependentAccessCheck(const DependentDiagnostic &DD, Sema::AccessResult Sema::CheckUnresolvedLookupAccess(UnresolvedLookupExpr *E, DeclAccessPair Found) { - if (!getLangOptions().AccessControl || + if (!getLangOpts().AccessControl || !E->getNamingClass() || Found.getAccess() == AS_public) return AR_accessible; @@ -1410,7 +1410,7 @@ Sema::AccessResult Sema::CheckUnresolvedLookupAccess(UnresolvedLookupExpr *E, /// access which has now been resolved to a member. Sema::AccessResult Sema::CheckUnresolvedMemberAccess(UnresolvedMemberExpr *E, DeclAccessPair Found) { - if (!getLangOptions().AccessControl || + if (!getLangOpts().AccessControl || Found.getAccess() == AS_public) return AR_accessible; @@ -1428,7 +1428,7 @@ Sema::AccessResult Sema::CheckUnresolvedMemberAccess(UnresolvedMemberExpr *E, Sema::AccessResult Sema::CheckDestructorAccess(SourceLocation Loc, CXXDestructorDecl *Dtor, const PartialDiagnostic &PDiag) { - if (!getLangOptions().AccessControl) + if (!getLangOpts().AccessControl) return AR_accessible; // There's never a path involved when checking implicit destructor access. @@ -1451,7 +1451,7 @@ Sema::AccessResult Sema::CheckConstructorAccess(SourceLocation UseLoc, const InitializedEntity &Entity, AccessSpecifier Access, bool IsCopyBindingRefToTemp) { - if (!getLangOptions().AccessControl || + if (!getLangOpts().AccessControl || Access == AS_public) return AR_accessible; @@ -1498,7 +1498,7 @@ Sema::AccessResult Sema::CheckConstructorAccess(SourceLocation UseLoc, CXXConstructorDecl *Constructor, AccessSpecifier Access, PartialDiagnostic PD) { - if (!getLangOptions().AccessControl || + if (!getLangOpts().AccessControl || Access == AS_public) return AR_accessible; @@ -1517,7 +1517,7 @@ Sema::AccessResult Sema::CheckDirectMemberAccess(SourceLocation UseLoc, NamedDecl *Target, const PartialDiagnostic &Diag) { AccessSpecifier Access = Target->getAccess(); - if (!getLangOptions().AccessControl || + if (!getLangOpts().AccessControl || Access == AS_public) return AR_accessible; @@ -1536,7 +1536,7 @@ Sema::AccessResult Sema::CheckAllocationAccess(SourceLocation OpLoc, CXXRecordDecl *NamingClass, DeclAccessPair Found, bool Diagnose) { - if (!getLangOptions().AccessControl || + if (!getLangOpts().AccessControl || !NamingClass || Found.getAccess() == AS_public) return AR_accessible; @@ -1556,7 +1556,7 @@ Sema::AccessResult Sema::CheckMemberOperatorAccess(SourceLocation OpLoc, Expr *ObjectExpr, Expr *ArgExpr, DeclAccessPair Found) { - if (!getLangOptions().AccessControl || + if (!getLangOpts().AccessControl || Found.getAccess() == AS_public) return AR_accessible; @@ -1574,7 +1574,7 @@ Sema::AccessResult Sema::CheckMemberOperatorAccess(SourceLocation OpLoc, Sema::AccessResult Sema::CheckAddressOfMemberAccess(Expr *OvlExpr, DeclAccessPair Found) { - if (!getLangOptions().AccessControl || + if (!getLangOpts().AccessControl || Found.getAccess() == AS_none || Found.getAccess() == AS_public) return AR_accessible; @@ -1606,7 +1606,7 @@ Sema::AccessResult Sema::CheckBaseClassAccess(SourceLocation AccessLoc, unsigned DiagID, bool ForceCheck, bool ForceUnprivileged) { - if (!ForceCheck && !getLangOptions().AccessControl) + if (!ForceCheck && !getLangOpts().AccessControl) return AR_accessible; if (Path.Access == AS_public) @@ -1635,7 +1635,7 @@ Sema::AccessResult Sema::CheckBaseClassAccess(SourceLocation AccessLoc, /// Checks access to all the declarations in the given result set. void Sema::CheckLookupAccess(const LookupResult &R) { - assert(getLangOptions().AccessControl + assert(getLangOpts().AccessControl && "performing access check without access control"); assert(R.getNamingClass() && "performing access check without naming class"); diff --git a/lib/Sema/SemaAttr.cpp b/lib/Sema/SemaAttr.cpp index 8b438a4801..e935fc735b 100644 --- a/lib/Sema/SemaAttr.cpp +++ b/lib/Sema/SemaAttr.cpp @@ -378,7 +378,7 @@ void Sema::ActOnPragmaFPContract(tok::OnOffSwitch OOS) { FPFeatures.fp_contract = 0; break; case tok::OOS_DEFAULT: - FPFeatures.fp_contract = getLangOptions().DefaultFPContract; + FPFeatures.fp_contract = getLangOpts().DefaultFPContract; break; } } diff --git a/lib/Sema/SemaCXXScopeSpec.cpp b/lib/Sema/SemaCXXScopeSpec.cpp index b307fe086d..1c414dda5d 100644 --- a/lib/Sema/SemaCXXScopeSpec.cpp +++ b/lib/Sema/SemaCXXScopeSpec.cpp @@ -186,7 +186,7 @@ bool Sema::isUnknownSpecialization(const CXXScopeSpec &SS) { /// /// \param NNS a dependent nested name specifier. CXXRecordDecl *Sema::getCurrentInstantiationOf(NestedNameSpecifier *NNS) { - assert(getLangOptions().CPlusPlus && "Only callable in C++"); + assert(getLangOpts().CPlusPlus && "Only callable in C++"); assert(NNS->isDependent() && "Only dependent nested-name-specifier allowed"); if (!NNS->getAsType()) @@ -274,11 +274,11 @@ bool Sema::isAcceptableNestedNameSpecifier(NamedDecl *SD) { return true; else if (TypedefNameDecl *TD = dyn_cast<TypedefNameDecl>(SD)) { if (TD->getUnderlyingType()->isRecordType() || - (Context.getLangOptions().CPlusPlus0x && + (Context.getLangOpts().CPlusPlus0x && TD->getUnderlyingType()->isEnumeralType())) return true; } else if (isa<RecordDecl>(SD) || - (Context.getLangOptions().CPlusPlus0x && isa<EnumDecl>(SD))) + (Context.getLangOpts().CPlusPlus0x && isa<EnumDecl>(SD))) return true; return false; @@ -502,8 +502,8 @@ bool Sema::BuildCXXNestedNameSpecifier(Scope *S, if ((Corrected = CorrectTypo(Found.getLookupNameInfo(), Found.getLookupKind(), S, &SS, Validator, LookupCtx, EnteringContext))) { - std::string CorrectedStr(Corrected.getAsString(getLangOptions())); - std::string CorrectedQuotedStr(Corrected.getQuoted(getLangOptions())); + std::string CorrectedStr(Corrected.getAsString(getLangOpts())); + std::string CorrectedQuotedStr(Corrected.getQuoted(getLangOpts())); if (LookupCtx) Diag(Found.getNameLoc(), diag::err_no_member_suggest) << Name << LookupCtx << CorrectedQuotedStr << SS.getRange() @@ -652,7 +652,7 @@ bool Sema::BuildCXXNestedNameSpecifier(Scope *S, // public: // void foo() { D::foo2(); } // }; - if (getLangOptions().MicrosoftExt) { + if (getLangOpts().MicrosoftExt) { DeclContext *DC = LookupCtx ? LookupCtx : CurContext; if (DC->isDependentContext() && DC->isFunctionOrMethod()) { SS.Extend(Context, &Identifier, IdentifierLoc, CCLoc); @@ -705,7 +705,7 @@ bool Sema::ActOnCXXNestedNameSpecifierDecltype(CXXScopeSpec &SS, QualType T = BuildDecltypeType(DS.getRepAsExpr(), DS.getTypeSpecTypeLoc()); if (!T->isDependentType() && !T->getAs<TagType>()) { Diag(DS.getTypeSpecTypeLoc(), diag::err_expected_class) - << T << getLangOptions().CPlusPlus; + << T << getLangOpts().CPlusPlus; return true; } diff --git a/lib/Sema/SemaCast.cpp b/lib/Sema/SemaCast.cpp index 802979f61b..54683e127e 100644 --- a/lib/Sema/SemaCast.cpp +++ b/lib/Sema/SemaCast.cpp @@ -118,7 +118,7 @@ namespace { } void checkObjCARCConversion(Sema::CheckedConversionKind CCK) { - assert(Self.getLangOptions().ObjCAutoRefCount); + assert(Self.getLangOpts().ObjCAutoRefCount); Expr *src = SrcExpr.get(); if (Self.CheckObjCARCConversion(OpRange, DestType, src, CCK) == @@ -222,7 +222,7 @@ Sema::ActOnCXXNamedCast(SourceLocation OpLoc, tok::TokenKind Kind, if (D.isInvalidType()) return ExprError(); - if (getLangOptions().CPlusPlus) { + if (getLangOpts().CPlusPlus) { // Check that there are no default arguments (C++ only). CheckExtraCXXDefaultArguments(D); } @@ -462,7 +462,7 @@ CastsAwayConstness(Sema &Self, QualType SrcType, QualType DestType, // If the only checking we care about is for Objective-C lifetime qualifiers, // and we're not in ARC mode, there's nothing to check. if (!CheckCVR && CheckObjCLifetime && - !Self.Context.getLangOptions().ObjCAutoRefCount) + !Self.Context.getLangOpts().ObjCAutoRefCount) return false; // Casting away constness is defined in C++ 5.2.11p8 with reference to @@ -710,7 +710,7 @@ void CastOperation::CheckReinterpretCast() { diagnoseBadCast(Self, msg, CT_Reinterpret, OpRange, SrcExpr.get(), DestType, /*listInitialization=*/false); } - } else if (tcr == TC_Success && Self.getLangOptions().ObjCAutoRefCount) { + } else if (tcr == TC_Success && Self.getLangOpts().ObjCAutoRefCount) { checkObjCARCConversion(Sema::CCK_OtherCast); } } @@ -772,7 +772,7 @@ void CastOperation::CheckStaticCast() { } else if (tcr == TC_Success) { if (Kind == CK_BitCast) checkCastAlign(); - if (Self.getLangOptions().ObjCAutoRefCount) + if (Self.getLangOpts().ObjCAutoRefCount) checkObjCARCConversion(Sema::CCK_OtherCast); } else if (Kind == CK_BitCast) { checkCastAlign(); @@ -1664,7 +1664,7 @@ static TryCastResult TryReinterpretCast(Sema &Self, ExprResult &SrcExpr, // integral type size doesn't matter. if ((Self.Context.getTypeSize(SrcType) > Self.Context.getTypeSize(DestType)) && - !Self.getLangOptions().MicrosoftExt) { + !Self.getLangOpts().MicrosoftExt) { msg = diag::err_bad_reinterpret_cast_small_int; return TC_Failed; } @@ -1738,7 +1738,7 @@ static TryCastResult TryReinterpretCast(Sema &Self, ExprResult &SrcExpr, // FIXME: Conditionally-supported behavior should be configurable in the // TargetInfo or similar. Self.Diag(OpRange.getBegin(), - Self.getLangOptions().CPlusPlus0x ? + Self.getLangOpts().CPlusPlus0x ? diag::warn_cxx98_compat_cast_fn_obj : diag::ext_cast_fn_obj) << OpRange; return TC_Success; @@ -1747,7 +1747,7 @@ static TryCastResult TryReinterpretCast(Sema &Self, ExprResult &SrcExpr, if (DestType->isFunctionPointerType()) { // See above. Self.Diag(OpRange.getBegin(), - Self.getLangOptions().CPlusPlus0x ? + Self.getLangOpts().CPlusPlus0x ? diag::warn_cxx98_compat_cast_fn_obj : diag::ext_cast_fn_obj) << OpRange; return TC_Success; @@ -1858,7 +1858,7 @@ void CastOperation::CheckCXXCStyleCast(bool FunctionalStyle, } } - if (Self.getLangOptions().ObjCAutoRefCount && tcr == TC_Success) + if (Self.getLangOpts().ObjCAutoRefCount && tcr == TC_Success) checkObjCARCConversion(CCK); if (tcr != TC_Success && msg != 0) { @@ -1887,7 +1887,7 @@ void CastOperation::CheckCXXCStyleCast(bool FunctionalStyle, /// Check the semantics of a C-style cast operation, in C. void CastOperation::CheckCStyleCast() { - assert(!Self.getLangOptions().CPlusPlus); + assert(!Self.getLangOpts().CPlusPlus); // C-style casts can resolve __unknown_any types. if (claimPlaceholder(BuiltinType::UnknownAny)) { @@ -2033,7 +2033,7 @@ void CastOperation::CheckCStyleCast() { } // ARC imposes extra restrictions on casts. - if (Self.getLangOptions().ObjCAutoRefCount) { + if (Self.getLangOpts().ObjCAutoRefCount) { checkObjCARCConversion(Sema::CCK_CStyleCast); if (SrcExpr.isInvalid()) return; @@ -2078,7 +2078,7 @@ ExprResult Sema::BuildCStyleCastExpr(SourceLocation LPLoc, Op.DestRange = CastTypeInfo->getTypeLoc().getSourceRange(); Op.OpRange = SourceRange(LPLoc, CastExpr->getLocEnd()); - if (getLangOptions().CPlusPlus) { + if (getLangOpts().CPlusPlus) { Op.CheckCXXCStyleCast(/*FunctionalStyle=*/ false, isa<InitListExpr>(CastExpr)); } else { diff --git a/lib/Sema/SemaChecking.cpp b/lib/Sema/SemaChecking.cpp index f546bbe1fd..f00a655f59 100644 --- a/lib/Sema/SemaChecking.cpp +++ b/lib/Sema/SemaChecking.cpp @@ -43,7 +43,7 @@ using namespace sema; SourceLocation Sema::getLocationOfStringLiteralByte(const StringLiteral *SL, unsigned ByteNo) const { return SL->getLocationOfByte(ByteNo, PP.getSourceManager(), - PP.getLangOptions(), PP.getTargetInfo()); + PP.getLangOpts(), PP.getTargetInfo()); } /// Checks that a call expression's argument count is the desired number. @@ -2214,7 +2214,7 @@ CheckPrintfHandler::HandlePrintfSpecifier(const analyze_printf::PrintfSpecifier LM.getLength()))); if (!FS.hasStandardLengthModifier()) HandleNonStandardLengthModifier(LM, startSpecifier, specifierLen); - if (!FS.hasStandardConversionSpecifier(S.getLangOptions())) + if (!FS.hasStandardConversionSpecifier(S.getLangOpts())) HandleNonStandardConversionSpecifier(CS, startSpecifier, specifierLen); if (!FS.hasStandardLengthConversionCombination()) HandleNonStandardConversionSpecification(LM, CS, startSpecifier, @@ -2257,7 +2257,7 @@ CheckPrintfHandler::HandlePrintfSpecifier(const analyze_printf::PrintfSpecifier // We may be able to offer a FixItHint if it is a supported type. PrintfSpecifier fixedFS = FS; - bool success = fixedFS.fixType(Ex->getType(), S.getLangOptions(), + bool success = fixedFS.fixType(Ex->getType(), S.getLangOpts(), S.Context, IsObjCLiteral); if (success) { @@ -2407,7 +2407,7 @@ bool CheckScanfHandler::HandleScanfSpecifier( if (!FS.hasStandardLengthModifier()) HandleNonStandardLengthModifier(LM, startSpecifier, specifierLen); - if (!FS.hasStandardConversionSpecifier(S.getLangOptions())) + if (!FS.hasStandardConversionSpecifier(S.getLangOpts())) HandleNonStandardConversionSpecifier(CS, startSpecifier, specifierLen); if (!FS.hasStandardLengthConversionCombination()) HandleNonStandardConversionSpecification(LM, CS, startSpecifier, @@ -2425,7 +2425,7 @@ bool CheckScanfHandler::HandleScanfSpecifier( const analyze_scanf::ScanfArgTypeResult &ATR = FS.getArgType(S.Context); if (ATR.isValid() && !ATR.matchesType(S.Context, Ex->getType())) { ScanfSpecifier fixedFS = FS; - bool success = fixedFS.fixType(Ex->getType(), S.getLangOptions(), + bool success = fixedFS.fixType(Ex->getType(), S.getLangOpts(), S.Context); if (success) { @@ -2496,7 +2496,7 @@ void Sema::CheckFormatString(const StringLiteral *FExpr, inFunctionCall); if (!analyze_format_string::ParsePrintfString(H, Str, Str + StrLen, - getLangOptions())) + getLangOpts())) H.DoneProcessing(); } else if (Type == FST_Scanf) { CheckScanfHandler H(*this, FExpr, OrigFormatExpr, firstDataArg, @@ -2505,7 +2505,7 @@ void Sema::CheckFormatString(const StringLiteral *FExpr, inFunctionCall); if (!analyze_format_string::ParseScanfString(H, Str, Str + StrLen, - getLangOptions())) + getLangOpts())) H.DoneProcessing(); } // TODO: handle other formats } @@ -2891,7 +2891,7 @@ Sema::CheckReturnStackAddr(Expr *RetValExp, QualType lhsType, // Perform checking for returned stack addresses, local blocks, // label addresses or references to temporaries. if (lhsType->isPointerType() || - (!getLangOptions().ObjCAutoRefCount && lhsType->isBlockPointerType())) { + (!getLangOpts().ObjCAutoRefCount && lhsType->isBlockPointerType())) { stackE = EvalAddr(RetValExp, refVars); } else if (lhsType->isReferenceType()) { stackE = EvalVal(RetValExp, refVars); @@ -4138,7 +4138,7 @@ void CheckImplicitConversion(Sema &S, Expr *E, QualType T, // In C, we pretend that the type of an EnumConstantDecl is its enumeration // type, to give us better diagnostics. QualType SourceType = E->getType(); - if (!S.getLangOptions().CPlusPlus) { + if (!S.getLangOpts().CPlusPlus) { if (DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(E)) if (EnumConstantDecl *ECD = dyn_cast<EnumConstantDecl>(DRE->getDecl())) { EnumDecl *Enum = cast<EnumDecl>(ECD->getDeclContext()); @@ -4338,7 +4338,7 @@ bool Sema::CheckParmsForFunctionDef(ParmVarDecl **P, ParmVarDecl **PEnd, if (CheckParameterNames && Param->getIdentifier() == 0 && !Param->isImplicit() && - !getLangOptions().CPlusPlus) + !getLangOpts().CPlusPlus) Diag(Param->getLocation(), diag::err_parameter_name_omitted); // C99 6.7.5.3p12: diff --git a/lib/Sema/SemaCodeComplete.cpp b/lib/Sema/SemaCodeComplete.cpp index df2768ccc2..21a5cfa79d 100644 --- a/lib/Sema/SemaCodeComplete.cpp +++ b/lib/Sema/SemaCodeComplete.cpp @@ -533,7 +533,7 @@ bool ResultBuilder::isInterestingDecl(NamedDecl *ND, // Filter out any unwanted results. if (Filter && !(this->*Filter)(ND)) { // Check whether it is interesting as a nested-name-specifier. - if (AllowNestedNameSpecifiers && SemaRef.getLangOptions().CPlusPlus && + if (AllowNestedNameSpecifiers && SemaRef.getLangOpts().CPlusPlus && IsNestedNameSpecifier(ND) && (Filter != &ResultBuilder::IsMember || (isa<CXXRecordDecl>(ND) && @@ -553,7 +553,7 @@ bool ResultBuilder::CheckHiddenResult(Result &R, DeclContext *CurContext, // In C, there is no way to refer to a hidden name. // FIXME: This isn't true; we can find a tag name hidden by an ordinary // name if we introduce the tag type. - if (!SemaRef.getLangOptions().CPlusPlus) + if (!SemaRef.getLangOpts().CPlusPlus) return true; DeclContext *HiddenCtx = R.Declaration->getDeclContext()->getRedeclContext(); @@ -732,7 +732,7 @@ void ResultBuilder::AdjustResultPriorityForDecl(Result &R) { } void ResultBuilder::MaybeAddConstructorResults(Result R) { - if (!SemaRef.getLangOptions().CPlusPlus || !R.Declaration || + if (!SemaRef.getLangOpts().CPlusPlus || !R.Declaration || !CompletionContext.wantConstructorResults()) return; @@ -988,9 +988,9 @@ bool ResultBuilder::IsOrdinaryName(NamedDecl *ND) const { ND = cast<NamedDecl>(ND->getUnderlyingDecl()); unsigned IDNS = Decl::IDNS_Ordinary; - if (SemaRef.getLangOptions().CPlusPlus) + if (SemaRef.getLangOpts().CPlusPlus) IDNS |= Decl::IDNS_Tag | Decl::IDNS_Namespace | Decl::IDNS_Member; - else if (SemaRef.getLangOptions().ObjC1) { + else if (SemaRef.getLangOpts().ObjC1) { if (isa<ObjCIvarDecl>(ND)) return true; } @@ -1006,9 +1006,9 @@ bool ResultBuilder::IsOrdinaryNonTypeName(NamedDecl *ND) const { return false; unsigned IDNS = Decl::IDNS_Ordinary; - if (SemaRef.getLangOptions().CPlusPlus) + if (SemaRef.getLangOpts().CPlusPlus) IDNS |= Decl::IDNS_Tag | Decl::IDNS_Namespace | Decl::IDNS_Member; - else if (SemaRef.getLangOptions().ObjC1) { + else if (SemaRef.getLangOpts().ObjC1) { if (isa<ObjCIvarDecl>(ND)) return true; } @@ -1033,7 +1033,7 @@ bool ResultBuilder::IsOrdinaryNonValueName(NamedDecl *ND) const { ND = cast<NamedDecl>(ND->getUnderlyingDecl()); unsigned IDNS = Decl::IDNS_Ordinary; - if (SemaRef.getLangOptions().CPlusPlus) + if (SemaRef.getLangOpts().CPlusPlus) IDNS |= Decl::IDNS_Tag | Decl::IDNS_Namespace; return (ND->getIdentifierNamespace() & IDNS) && @@ -1135,7 +1135,7 @@ static bool isObjCReceiverType(ASTContext &C, QualType T) { break; } - if (!C.getLangOptions().CPlusPlus) + if (!C.getLangOpts().CPlusPlus) return false; // FIXME: We could perform more analysis here to determine whether a @@ -1165,8 +1165,8 @@ bool ResultBuilder::IsObjCMessageReceiverOrLambdaCapture(NamedDecl *ND) const { } bool ResultBuilder::IsObjCCollection(NamedDecl *ND) const { - if ((SemaRef.getLangOptions().CPlusPlus && !IsOrdinaryName(ND)) || - (!SemaRef.getLangOptions().CPlusPlus && !IsOrdinaryNonTypeName(ND))) + if ((SemaRef.getLangOpts().CPlusPlus && !IsOrdinaryName(ND)) || + (!SemaRef.getLangOpts().CPlusPlus && !IsOrdinaryNonTypeName(ND))) return false; QualType T = getDeclUsageType(SemaRef.Context, ND); @@ -1176,7 +1176,7 @@ bool ResultBuilder::IsObjCCollection(NamedDecl *ND) const { T = SemaRef.Context.getBaseElementType(T); return T->isObjCObjectType() || T->isObjCObjectPointerType() || T->isObjCIdType() || - (SemaRef.getLangOptions().CPlusPlus && T->isRecordType()); + (SemaRef.getLangOpts().CPlusPlus && T->isRecordType()); } bool ResultBuilder::IsImpossibleToSatisfy(NamedDecl *ND) const { @@ -1464,7 +1464,7 @@ static void AddOrdinaryNameResults(Sema::ParserCompletionContext CCC, typedef CodeCompletionResult Result; switch (CCC) { case Sema::PCC_Namespace: - if (SemaRef.getLangOptions().CPlusPlus) { + if (SemaRef.getLangOpts().CPlusPlus) { if (Results.includeCodePatterns()) { // namespace <identifier> { declarations } Builder.AddTypedTextChunk("namespace"); @@ -1509,14 +1509,14 @@ static void AddOrdinaryNameResults(Sema::ParserCompletionContext CCC, } } - if (SemaRef.getLangOptions().ObjC1) + if (SemaRef.getLangOpts().ObjC1) AddObjCTopLevelResults(Results, true); AddTypedefResult(Results); // Fall through case Sema::PCC_Class: - if (SemaRef.getLangOptions().CPlusPlus) { + if (SemaRef.getLangOpts().CPlusPlus) { // Using declaration Builder.AddTypedTextChunk("using"); Builder.AddChunk(CodeCompletionString::CK_HorizontalSpace); @@ -1560,7 +1560,7 @@ static void AddOrdinaryNameResults(Sema::ParserCompletionContext CCC, case Sema::PCC_Template: case Sema::PCC_MemberTemplate: - if (SemaRef.getLangOptions().CPlusPlus && Results.includeCodePatterns()) { + if (SemaRef.getLangOpts().CPlusPlus && Results.includeCodePatterns()) { // template < parameters > Builder.AddTypedTextChunk("template"); Builder.AddChunk(CodeCompletionString::CK_LeftAngle); @@ -1569,32 +1569,32 @@ static void AddOrdinaryNameResults(Sema::ParserCompletionContext CCC, Results.AddResult(Result(Builder.TakeString())); } - AddStorageSpecifiers(CCC, SemaRef.getLangOptions(), Results); - AddFunctionSpecifiers(CCC, SemaRef.getLangOptions(), Results); + AddStorageSpecifiers(CCC, SemaRef.getLangOpts(), Results); + AddFunctionSpecifiers(CCC, SemaRef.getLangOpts(), Results); break; case Sema::PCC_ObjCInterface: - AddObjCInterfaceResults(SemaRef.getLangOptions(), Results, true); - AddStorageSpecifiers(CCC, SemaRef.getLangOptions(), Results); - AddFunctionSpecifiers(CCC, SemaRef.getLangOptions(), Results); + AddObjCInterfaceResults(SemaRef.getLangOpts(), Results, true); + AddStorageSpecifiers(CCC, SemaRef.getLangOpts(), Results); + AddFunctionSpecifiers(CCC, SemaRef.getLangOpts(), Results); break; case Sema::PCC_ObjCImplementation: - AddObjCImplementationResults(SemaRef.getLangOptions(), Results, true); - AddStorageSpecifiers(CCC, SemaRef.getLangOptions(), Results); - AddFunctionSpecifiers(CCC, SemaRef.getLangOptions(), Results); + AddObjCImplementationResults(SemaRef.getLangOpts(), Results, true); + AddStorageSpecifiers(CCC, SemaRef.getLangOpts(), Results); + AddFunctionSpecifiers(CCC, SemaRef.getLangOpts(), Results); break; case Sema::PCC_ObjCInstanceVariableList: - AddObjCVisibilityResults(SemaRef.getLangOptions(), Results, true); + AddObjCVisibilityResults(SemaRef.getLangOpts(), Results, true); break; case Sema::PCC_RecoveryInFunction: case Sema::PCC_Statement: { AddTypedefResult(Results); - if (SemaRef.getLangOptions().CPlusPlus && Results.includeCodePatterns() && - SemaRef.getLangOptions().CXXExceptions) { + if (SemaRef.getLangOpts().CPlusPlus && Results.includeCodePatterns() && + SemaRef.getLangOpts().CXXExceptions) { Builder.AddTypedTextChunk("try"); Builder.AddChunk(CodeCompletionString::CK_LeftBrace); Builder.AddPlaceholderChunk("statements"); @@ -1610,14 +1610,14 @@ static void AddOrdinaryNameResults(Sema::ParserCompletionContext CCC, Builder.AddChunk(CodeCompletionString::CK_RightBrace); Results.AddResult(Result(Builder.TakeString())); } - if (SemaRef.getLangOptions().ObjC1) + if (SemaRef.getLangOpts().ObjC1) AddObjCStatementResults(Results, true); if (Results.includeCodePatterns()) { // if (condition) { statements } Builder.AddTypedTextChunk("if"); Builder.AddChunk(CodeCompletionString::CK_LeftParen); - if (SemaRef.getLangOptions().CPlusPlus) + if (SemaRef.getLangOpts().CPlusPlus) Builder.AddPlaceholderChunk("condition"); else Builder.AddPlaceholderChunk("expression"); @@ -1631,7 +1631,7 @@ static void AddOrdinaryNameResults(Sema::ParserCompletionContext CCC, // switch (condition) { } Builder.AddTypedTextChunk("switch"); Builder.AddChunk(CodeCompletionString::CK_LeftParen); - if (SemaRef.getLangOptions().CPlusPlus) + if (SemaRef.getLangOpts().CPlusPlus) Builder.AddPlaceholderChunk("condition"); else Builder.AddPlaceholderChunk("expression"); @@ -1661,7 +1661,7 @@ static void AddOrdinaryNameResults(Sema::ParserCompletionContext CCC, /// while (condition) { statements } Builder.AddTypedTextChunk("while"); Builder.AddChunk(CodeCompletionString::CK_LeftParen); - if (SemaRef.getLangOptions().CPlusPlus) + if (SemaRef.getLangOpts().CPlusPlus) Builder.AddPlaceholderChunk("condition"); else Builder.AddPlaceholderChunk("expression"); @@ -1687,7 +1687,7 @@ static void AddOrdinaryNameResults(Sema::ParserCompletionContext CCC, // for ( for-init-statement ; condition ; expression ) { statements } Builder.AddTypedTextChunk("for"); Builder.AddChunk(CodeCompletionString::CK_LeftParen); - if (SemaRef.getLangOptions().CPlusPlus || SemaRef.getLangOptions().C99) + if (SemaRef.getLangOpts().CPlusPlus || SemaRef.getLangOpts().C99) Builder.AddPlaceholderChunk("init-statement"); else Builder.AddPlaceholderChunk("init-expression"); @@ -1752,11 +1752,11 @@ static void AddOrdinaryNameResults(Sema::ParserCompletionContext CCC, // Fall through (for statement expressions). case Sema::PCC_ForInit: case Sema::PCC_Condition: - AddStorageSpecifiers(CCC, SemaRef.getLangOptions(), Results); + AddStorageSpecifiers(CCC, SemaRef.getLangOpts(), Results); // Fall through: conditions and statements can have expressions. case Sema::PCC_ParenthesizedExpression: - if (SemaRef.getLangOptions().ObjCAutoRefCount && + if (SemaRef.getLangOpts().ObjCAutoRefCount && CCC == Sema::PCC_ParenthesizedExpression) { // (__bridge <type>)<expression> Builder.AddTypedTextChunk("__bridge"); @@ -1785,7 +1785,7 @@ static void AddOrdinaryNameResults(Sema::ParserCompletionContext CCC, // Fall through case Sema::PCC_Expression: { - if (SemaRef.getLangOptions().CPlusPlus) { + if (SemaRef.getLangOpts().CPlusPlus) { // 'this', if we're in a non-static member function. addThisCompletion(SemaRef, Results); @@ -1799,7 +1799,7 @@ static void AddOrdinaryNameResults(Sema::ParserCompletionContext CCC, Builder.AddTypedTextChunk("false"); Results.AddResult(Result(Builder.TakeString())); - if (SemaRef.getLangOptions().RTTI) { + if (SemaRef.getLangOpts().RTTI) { // dynamic_cast < type-id > ( expression ) Builder.AddTypedTextChunk("dynamic_cast"); Builder.AddChunk(CodeCompletionString::CK_LeftAngle); @@ -1841,7 +1841,7 @@ static void AddOrdinaryNameResults(Sema::ParserCompletionContext CCC, Builder.AddChunk(CodeCompletionString::CK_RightParen); Results.AddResult(Result(Builder.TakeString())); - if (SemaRef.getLangOptions().RTTI) { + if (SemaRef.getLangOpts().RTTI) { // typeid ( expression-or-type ) Builder.AddResultTypeChunk("std::type_info"); Builder.AddTypedTextChunk("typeid"); @@ -1889,7 +1889,7 @@ static void AddOrdinaryNameResults(Sema::ParserCompletionContext CCC, Builder.AddPlaceholderChunk("expression"); Results.AddResult(Result(Builder.TakeString())); - if (SemaRef.getLangOptions().CXXExceptions) { + if (SemaRef.getLangOpts().CXXExceptions) { // throw expression Builder.AddResultTypeChunk("void"); Builder.AddTypedTextChunk("throw"); @@ -1900,7 +1900,7 @@ static void AddOrdinaryNameResults(Sema::ParserCompletionContext CCC, // FIXME: Rethrow? - if (SemaRef.getLangOptions().CPlusPlus0x) { + if (SemaRef.getLangOpts().CPlusPlus0x) { // nullptr Builder.AddResultTypeChunk("std::nullptr_t"); Builder.AddTypedTextChunk("nullptr"); @@ -1932,7 +1932,7 @@ static void AddOrdinaryNameResults(Sema::ParserCompletionContext CCC, } } - if (SemaRef.getLangOptions().ObjC1) { + if (SemaRef.getLangOpts().ObjC1) { // Add "super", if we're in an Objective-C class with a superclass. if (ObjCMethodDecl *Method = SemaRef.getCurMethodDecl()) { // The interface can be NULL. @@ -1967,10 +1967,10 @@ static void AddOrdinaryNameResults(Sema::ParserCompletionContext CCC, break; } - if (WantTypesInContext(CCC, SemaRef.getLangOptions())) - AddTypeSpecifierResults(SemaRef.getLangOptions(), Results); + if (WantTypesInContext(CCC, SemaRef.getLangOpts())) + AddTypeSpecifierResults(SemaRef.getLangOpts(), Results); - if (SemaRef.getLangOptions().CPlusPlus && CCC != Sema::PCC_Type) + if (SemaRef.getLangOpts().CPlusPlus && CCC != Sema::PCC_Type) Results.AddResult(Result("operator")); } @@ -2016,7 +2016,7 @@ static void MaybeAddSentinel(ASTContext &Context, NamedDecl *FunctionOrMethod, CodeCompletionBuilder &Result) { if (SentinelAttr *Sentinel = FunctionOrMethod->getAttr<SentinelAttr>()) if (Sentinel->getSentinel() == 0) { - if (Context.getLangOptions().ObjC1 && + if (Context.getLangOpts().ObjC1 && Context.Idents.get("nil").hasMacroDefinition()) Result.AddTextChunk(", nil"); else if (Context.Idents.get("NULL").hasMacroDefinition()) @@ -2872,7 +2872,7 @@ static void AddMacroResults(Preprocessor &PP, ResultBuilder &Results, M != MEnd; ++M) { Results.AddResult(Result(M->first, getMacroUsagePriority(M->first->getName(), - PP.getLangOptions(), + PP.getLangOpts(), TargetTypeIsPointer))); } @@ -2932,8 +2932,8 @@ static enum CodeCompletionContext::Kind mapCodeCompletionContext(Sema &S, return CodeCompletionContext::CCC_Recovery; case Sema::PCC_ForInit: - if (S.getLangOptions().CPlusPlus || S.getLangOptions().C99 || - S.getLangOptions().ObjC1) + if (S.getLangOpts().CPlusPlus || S.getLangOpts().C99 || + S.getLangOpts().ObjC1) return CodeCompletionContext::CCC_ParenthesizedExpression; else return CodeCompletionContext::CCC_Expression; @@ -3113,12 +3113,12 @@ void Sema::CodeCompleteOrdinaryName(Scope *S, case PCC_Expression: case PCC_ForInit: case PCC_Condition: - if (WantTypesInContext(CompletionContext, getLangOptions())) + if (WantTypesInContext(CompletionContext, getLangOpts())) Results.setFilter(&ResultBuilder::IsOrdinaryName); else Results.setFilter(&ResultBuilder::IsOrdinaryNonTypeName); - if (getLangOptions().CPlusPlus) + if (getLangOpts().CPlusPlus) MaybeAddOverrideCalls(*this, /*InContext=*/0, Results); break; @@ -3147,7 +3147,7 @@ void Sema::CodeCompleteOrdinaryName(Scope *S, case PCC_Statement: case PCC_RecoveryInFunction: if (S->getFnParent()) - AddPrettyFunctionResults(PP.getLangOptions(), Results); + AddPrettyFunctionResults(PP.getLangOpts(), Results); break; case PCC_Namespace: @@ -3192,10 +3192,10 @@ void Sema::CodeCompleteDeclSpec(Scope *S, DeclSpec &DS, // Type qualifiers can come after names. Results.AddResult(Result("const")); Results.AddResult(Result("volatile")); - if (getLangOptions().C99) + if (getLangOpts().C99) Results.AddResult(Result("restrict")); - if (getLangOptions().CPlusPlus) { + if (getLangOpts().CPlusPlus) { if (AllowNonIdentifiers) { Results.AddResult(Result("operator")); } @@ -3266,7 +3266,7 @@ void Sema::CodeCompleteExpression(Scope *S, Results.setFilter(&ResultBuilder::IsObjCCollection); else if (Data.IntegralConstantExpression) Results.setFilter(&ResultBuilder::IsIntegralConstantValue); - else if (WantTypesInContext(PCC_Expression, getLangOptions())) + else if (WantTypesInContext(PCC_Expression, getLangOpts())) Results.setFilter(&ResultBuilder::IsOrdinaryName); else Results.setFilter(&ResultBuilder::IsOrdinaryNonTypeName); @@ -3295,7 +3295,7 @@ void Sema::CodeCompleteExpression(Scope *S, if (S->getFnParent() && !Data.ObjCCollection && !Data.IntegralConstantExpression) - AddPrettyFunctionResults(PP.getLangOptions(), Results); + AddPrettyFunctionResults(PP.getLangOpts(), Results); if (CodeCompleter->includeMacros()) AddMacroResults(PP, Results, PreferredTypeIsPointer); @@ -3308,7 +3308,7 @@ void Sema::CodeCompleteExpression(Scope *S, void Sema::CodeCompletePostfixExpression(Scope *S, ExprResult E) { if (E.isInvalid()) CodeCompleteOrdinaryName(S, PCC_RecoveryInFunction); - else if (getLangOptions().ObjC1) + else if (getLangOpts().ObjC1) CodeCompleteObjCInstanceMessage(S, E.take(), 0, 0, false); } @@ -3470,7 +3470,7 @@ void Sema::CodeCompleteMemberReferenceExpr(Scope *S, Expr *Base, LookupVisibleDecls(Record->getDecl(), LookupMemberName, Consumer, CodeCompleter->includeGlobals()); - if (getLangOptions().CPlusPlus) { + if (getLangOpts().CPlusPlus) { if (!Results.empty()) { // The "template" keyword can follow "->" or "." in the grammar. // However, we only want to suggest the template keyword if something @@ -3590,7 +3590,7 @@ void Sema::CodeCompleteTypeQualifiers(DeclSpec &DS) { Results.AddResult("const"); if (!(DS.getTypeQualifiers() & DeclSpec::TQ_volatile)) Results.AddResult("volatile"); - if (getLangOptions().C99 && + if (getLangOpts().C99 && !(DS.getTypeQualifiers() & DeclSpec::TQ_restrict)) Results.AddResult("restrict"); Results.ExitScope(); @@ -3655,7 +3655,7 @@ void Sema::CodeCompleteCase(Scope *S) { } } - if (getLangOptions().CPlusPlus && !Qualifier && EnumeratorsSeen.empty()) { + if (getLangOpts().CPlusPlus && !Qualifier && EnumeratorsSeen.empty()) { // If there are no prior enumerators in C++, check whether we have to // qualify the names of the enumerators that we suggest, because they // may not be visible in this scope. @@ -3755,7 +3755,7 @@ void Sema::CodeCompleteCall(Scope *S, Expr *FnIn, else if (DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(NakedFn)) { FunctionDecl *FDecl = dyn_cast<FunctionDecl>(DRE->getDecl()); if (FDecl) { - if (!getLangOptions().CPlusPlus || + if (!getLangOpts().CPlusPlus || !FDecl->getType()->getAs<FunctionProtoType>()) Results.push_back(ResultCandidate(FDecl)); else @@ -3883,7 +3883,7 @@ void Sema::CodeCompleteAfterIf(Scope *S) { Builder.AddTextChunk("if"); Builder.AddChunk(CodeCompletionString::CK_HorizontalSpace); Builder.AddChunk(CodeCompletionString::CK_LeftParen); - if (getLangOptions().CPlusPlus) + if (getLangOpts().CPlusPlus) Builder.AddPlaceholderChunk("condition"); else Builder.AddPlaceholderChunk("expression"); @@ -3901,7 +3901,7 @@ void Sema::CodeCompleteAfterIf(Scope *S) { Results.ExitScope(); if (S->getFnParent()) - AddPrettyFunctionResults(PP.getLangOptions(), Results); + AddPrettyFunctionResults(PP.getLangOpts(), Results); if (CodeCompleter->includeMacros()) AddMacroResults(PP, Results); @@ -4085,7 +4085,7 @@ void Sema::CodeCompleteOperatorName(Scope *S) { CodeCompleter->includeGlobals()); // Add any type specifiers - AddTypeSpecifierResults(getLangOptions(), Results); + AddTypeSpecifierResults(getLangOpts(), Results); Results.ExitScope(); HandleCodeCompleteResults(this, CodeCompleter, @@ -4350,9 +4350,9 @@ void Sema::CodeCompleteObjCAtDirective(Scope *S) { CodeCompletionContext::CCC_Other); Results.EnterNewScope(); if (isa<ObjCImplDecl>(CurContext)) - AddObjCImplementationResults(getLangOptions(), Results, false); + AddObjCImplementationResults(getLangOpts(), Results, false); else if (CurContext->isObjCContainer()) - AddObjCInterfaceResults(getLangOptions(), Results, false); + AddObjCInterfaceResults(getLangOpts(), Results, false); else AddObjCTopLevelResults(Results, false); Results.ExitScope(); @@ -4367,8 +4367,8 @@ static void AddObjCExpressionResults(ResultBuilder &Results, bool NeedAt) { // @encode ( type-name ) const char *EncodeType = "char[]"; - if (Results.getSema().getLangOptions().CPlusPlus || - Results.getSema().getLangOptions().ConstStrings) + if (Results.getSema().getLangOpts().CPlusPlus || + Results.getSema().getLangOpts().ConstStrings) EncodeType = " const char[]"; Builder.AddResultTypeChunk(EncodeType); Builder.AddTypedTextChunk(OBJC_AT_KEYWORD_NAME(NeedAt,encode)); @@ -4474,7 +4474,7 @@ void Sema::CodeCompleteObjCAtVisibility(Scope *S) { ResultBuilder Results(*this, CodeCompleter->getAllocator(), CodeCompletionContext::CCC_Other); Results.EnterNewScope(); - AddObjCVisibilityResults(getLangOptions(), Results, false); + AddObjCVisibilityResults(getLangOpts(), Results, false); Results.ExitScope(); HandleCodeCompleteResults(this, CodeCompleter, CodeCompletionContext::CCC_Other, @@ -5076,7 +5076,7 @@ void Sema::CodeCompleteObjCMessageReceiver(Scope *S) { typedef CodeCompletionResult Result; ResultBuilder Results(*this, CodeCompleter->getAllocator(), CodeCompletionContext::CCC_ObjCMessageReceiver, - getLangOptions().CPlusPlus0x + getLangOpts().CPlusPlus0x ? &ResultBuilder::IsObjCMessageReceiverOrLambdaCapture : &ResultBuilder::IsObjCMessageReceiver); @@ -5095,7 +5095,7 @@ void Sema::CodeCompleteObjCMessageReceiver(Scope *S) { AddSuperSendCompletion(*this, /*NeedSuperKeyword=*/true, 0, 0, Results); } - if (getLangOptions().CPlusPlus0x) + if (getLangOpts().CPlusPlus0x) addThisCompletion(*this, Results); Results.ExitScope(); @@ -6763,7 +6763,7 @@ void Sema::CodeCompleteObjCMethodDecl(Scope *S, // Add Key-Value-Coding and Key-Value-Observing accessor methods for all of // the properties in this class and its categories. - if (Context.getLangOptions().ObjC2) { + if (Context.getLangOpts().ObjC2) { SmallVector<ObjCContainerDecl *, 4> Containers; Containers.push_back(SearchDecl); @@ -6975,7 +6975,7 @@ void Sema::CodeCompletePreprocessorDirective(bool InConditional) { Builder.AddPlaceholderChunk("arguments"); Results.AddResult(Builder.TakeString()); - if (getLangOptions().ObjC1) { + if (getLangOpts().ObjC1) { // #import "header" Builder.AddTypedTextChunk("import"); Builder.AddChunk(CodeCompletionString::CK_HorizontalSpace); diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index f6e3aa7215..a9c1ec1cd6 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -191,7 +191,7 @@ ParsedType Sema::getTypeName(IdentifierInfo &II, SourceLocation NameLoc, // Ignore a correction to a template type as the to-be-corrected // identifier is not a template (typo correction for template names // is handled elsewhere). - !(getLangOptions().CPlusPlus && NewSSPtr && + !(getLangOpts().CPlusPlus && NewSSPtr && isTemplateName(S, *NewSSPtr, false, TemplateName, ParsedType(), false, Template, MemberOfUnknownSpecialization))) { ParsedType Ty = getTypeName(*NewII, NameLoc, S, NewSSPtr, @@ -199,9 +199,9 @@ ParsedType Sema::getTypeName(IdentifierInfo &II, SourceLocation NameLoc, IsCtorOrDtorName, WantNontrivialTypeSourceInfo); if (Ty) { - std::string CorrectedStr(Correction.getAsString(getLangOptions())); + std::string CorrectedStr(Correction.getAsString(getLangOpts())); std::string CorrectedQuotedStr( - Correction.getQuoted(getLangOptions())); + Correction.getQuoted(getLangOpts())); Diag(NameLoc, diag::err_unknown_typename_suggest) << Result.getLookupName() << CorrectedQuotedStr << FixItHint::CreateReplacement(SourceRange(NameLoc), @@ -373,8 +373,8 @@ bool Sema::DiagnoseUnknownTypeName(const IdentifierInfo &II, if (TypoCorrection Corrected = CorrectTypo(DeclarationNameInfo(&II, IILoc), LookupOrdinaryName, S, SS, Validator)) { - std::string CorrectedStr(Corrected.getAsString(getLangOptions())); - std::string CorrectedQuotedStr(Corrected.getQuoted(getLangOptions())); + std::string CorrectedStr(Corrected.getAsString(getLangOpts())); + std::string CorrectedQuotedStr(Corrected.getQuoted(getLangOpts())); if (Corrected.isKeyword()) { // We corrected to a keyword. @@ -406,7 +406,7 @@ bool Sema::DiagnoseUnknownTypeName(const IdentifierInfo &II, return true; } - if (getLangOptions().CPlusPlus) { + if (getLangOpts().CPlusPlus) { // See if II is a class template that the user forgot to pass arguments to. UnqualifiedId Name; Name.setIdentifier(&II, IILoc); @@ -436,7 +436,7 @@ bool Sema::DiagnoseUnknownTypeName(const IdentifierInfo &II, << &II << DC << SS->getRange(); else if (isDependentScopeSpecifier(*SS)) { unsigned DiagID = diag::err_typename_missing; - if (getLangOptions().MicrosoftMode && isMicrosoftMissingTypename(SS, S)) + if (getLangOpts().MicrosoftMode && isMicrosoftMissingTypename(SS, S)) DiagID = diag::warn_typename_missing; Diag(SS->getRange().getBegin(), DiagID) @@ -456,7 +456,7 @@ bool Sema::DiagnoseUnknownTypeName(const IdentifierInfo &II, /// \brief Determine whether the given result set contains either a type name /// or static bool isResultTypeOrTemplate(LookupResult &R, const Token &NextToken) { - bool CheckTemplate = R.getSema().getLangOptions().CPlusPlus && + bool CheckTemplate = R.getSema().getLangOpts().CPlusPlus && NextToken.is(tok::less); for (LookupResult::iterator I = R.begin(), IEnd = R.end(); I != IEnd; ++I) { @@ -508,7 +508,7 @@ Corrected: if (!SS.isSet() && NextToken.is(tok::l_paren)) { // In C++, this is an ADL-only call. // FIXME: Reference? - if (getLangOptions().CPlusPlus) + if (getLangOpts().CPlusPlus) return BuildDeclarationNameExpr(SS, Result, /*ADL=*/true); // C90 6.3.2.2: @@ -533,7 +533,7 @@ Corrected: // In C, we first see whether there is a tag type by the same name, in // which case it's likely that the user just forget to write "enum", // "struct", or "union". - if (!getLangOptions().CPlusPlus && !SecondTry) { + if (!getLangOpts().CPlusPlus && !SecondTry) { Result.clear(LookupTagName); LookupParsedName(Result, S, &SS); if (TagDecl *Tag = Result.getAsSingle<TagDecl>()) { @@ -562,7 +562,7 @@ Corrected: } Diag(NameLoc, diag::err_use_of_tag_name_without_tag) - << Name << TagName << getLangOptions().CPlusPlus + << Name << TagName << getLangOpts().CPlusPlus << FixItHint::CreateInsertion(NameLoc, FixItTagName); break; } @@ -580,13 +580,13 @@ Corrected: &SS, DefaultValidator)) { unsigned UnqualifiedDiag = diag::err_undeclared_var_use_suggest; unsigned QualifiedDiag = diag::err_no_member_suggest; - std::string CorrectedStr(Corrected.getAsString(getLangOptions())); - std::string CorrectedQuotedStr(Corrected.getQuoted(getLangOptions())); + std::string CorrectedStr(Corrected.getAsString(getLangOpts())); + std::string CorrectedQuotedStr(Corrected.getQuoted(getLangOpts())); NamedDecl *FirstDecl = Corrected.getCorrectionDecl(); NamedDecl *UnderlyingFirstDecl = FirstDecl? FirstDecl->getUnderlyingDecl() : 0; - if (getLangOptions().CPlusPlus && NextToken.is(tok::less) && + if (getLangOpts().CPlusPlus && NextToken.is(tok::less) && UnderlyingFirstDecl && isa<TemplateDecl>(UnderlyingFirstDecl)) { UnqualifiedDiag = diag::err_no_template_suggest; QualifiedDiag = diag::err_no_member_template_suggest; @@ -668,7 +668,7 @@ Corrected: break; case LookupResult::Ambiguous: - if (getLangOptions().CPlusPlus && NextToken.is(tok::less) && + if (getLangOpts().CPlusPlus && NextToken.is(tok::less) && hasAnyAcceptableTemplateNames(Result)) { // C++ [temp.local]p3: // A lookup that finds an injected-class-name (10.2) can result in an @@ -692,7 +692,7 @@ Corrected: return NameClassification::Error(); } - if (getLangOptions().CPlusPlus && NextToken.is(tok::less) && + if (getLangOpts().CPlusPlus && NextToken.is(tok::less) && (IsFilteredTemplateName || hasAnyAcceptableTemplateNames(Result))) { // C++ [temp.names]p3: // After name lookup (3.4) finds that a name is a template-name or that @@ -895,7 +895,7 @@ void Sema::ActOnReenterFunctionContext(Scope* S, Decl *D) { /// attribute. static bool AllowOverloadingOfFunction(LookupResult &Previous, ASTContext &Context) { - if (Context.getLangOptions().CPlusPlus) + if (Context.getLangOpts().CPlusPlus) return true; if (Previous.getResultKind() == LookupResult::FoundOverloaded) @@ -922,7 +922,7 @@ void Sema::PushOnScopeChains(NamedDecl *D, Scope *S, bool AddToContext) { // Out-of-line definitions shouldn't be pushed into scope in C++. // Out-of-line variable and function definitions shouldn't even in C. - if ((getLangOptions().CPlusPlus || isa<VarDecl>(D) || isa<FunctionDecl>(D)) && + if ((getLangOpts().CPlusPlus || isa<VarDecl>(D) || isa<FunctionDecl>(D)) && D->isOutOfLine() && !D->getDeclContext()->getRedeclContext()->Equals( D->getLexicalDeclContext()->getRedeclContext())) @@ -1184,7 +1184,7 @@ static void GenerateFixForUnusedDecl(const NamedDecl *D, ASTContext &Ctx, FixItHint &Hint) { if (isa<LabelDecl>(D)) { SourceLocation AfterColon = Lexer::findLocationAfterToken(D->getLocEnd(), - tok::colon, Ctx.getSourceManager(), Ctx.getLangOptions(), true); + tok::colon, Ctx.getSourceManager(), Ctx.getLangOpts(), true); if (AfterColon.isInvalid()) return; Hint = FixItHint::CreateRemoval(CharSourceRange:: @@ -1329,7 +1329,7 @@ Scope *Sema::getNonFieldDeclScope(Scope *S) { while (((S->getFlags() & Scope::DeclScope) == 0) || (S->getEntity() && ((DeclContext *)S->getEntity())->isTransparentContext()) || - (S->isClassScope() && !getLangOptions().CPlusPlus)) + (S->isClassScope() && !getLangOpts().CPlusPlus)) S = S->getParent(); return S; } @@ -1464,7 +1464,7 @@ void Sema::MergeTypedefNameDecl(TypedefNameDecl *New, LookupResult &OldDecls) { // Allow multiple definitions for ObjC built-in typedefs. // FIXME: Verify the underlying types are equivalent! - if (getLangOptions().ObjC1) { + if (getLangOpts().ObjC1) { const IdentifierInfo *TypeID = New->getIdentifier(); switch (TypeID->getLength()) { default: break; @@ -1520,10 +1520,10 @@ void Sema::MergeTypedefNameDecl(TypedefNameDecl *New, LookupResult &OldDecls) { if (TypedefNameDecl *Typedef = dyn_cast<TypedefNameDecl>(Old)) New->setPreviousDeclaration(Typedef); - if (getLangOptions().MicrosoftExt) + if (getLangOpts().MicrosoftExt) return; - if (getLangOptions().CPlusPlus) { + if (getLangOpts().CPlusPlus) { // C++ [dcl.typedef]p2: // In a given non-class scope, a typedef specifier can be used to // redefine the name of any type declared in that scope to refer @@ -1562,7 +1562,7 @@ void Sema::MergeTypedefNameDecl(TypedefNameDecl *New, LookupResult &OldDecls) { } // Modules always permit redefinition of typedefs, as does C11. - if (getLangOptions().Modules || getLangOptions().C11) + if (getLangOpts().Modules || getLangOpts().C11) return; // If we have a redefinition of a typedef in C, emit a warning. This warning @@ -1762,8 +1762,8 @@ bool Sema::MergeFunctionDecl(FunctionDecl *New, Decl *OldD) { if (!isa<CXXMethodDecl>(New) && !isa<CXXMethodDecl>(Old) && New->getStorageClass() == SC_Static && Old->getStorageClass() != SC_Static && - !canRedefineFunction(Old, getLangOptions())) { - if (getLangOptions().MicrosoftExt) { + !canRedefineFunction(Old, getLangOpts())) { + if (getLangOpts().MicrosoftExt) { Diag(New->getLocation(), diag::warn_static_non_static) << New; Diag(Old->getLocation(), PrevDiag); } else { @@ -1845,7 +1845,7 @@ bool Sema::MergeFunctionDecl(FunctionDecl *New, Decl *OldD) { NewQType = Context.getCanonicalType(New->getType()); } - if (getLangOptions().CPlusPlus) { + if (getLangOpts().CPlusPlus) { // (C++98 13.1p2): // Certain function declarations cannot be overloaded: // -- Function declarations that differ only in the return type @@ -1957,7 +1957,7 @@ bool Sema::MergeFunctionDecl(FunctionDecl *New, Decl *OldD) { // C: Function types need to be compatible, not identical. This handles // duplicate function decls like "void f(int); void f(enum X);" properly. - if (!getLangOptions().CPlusPlus && + if (!getLangOpts().CPlusPlus && Context.typesAreCompatible(OldQType, NewQType)) { const FunctionType *OldFuncType = OldQType->getAs<FunctionType>(); const FunctionType *NewFuncType = NewQType->getAs<FunctionType>(); @@ -2009,7 +2009,7 @@ bool Sema::MergeFunctionDecl(FunctionDecl *New, Decl *OldD) { // the K&R definition becomes variadic. This is sort of an edge case, but // it's legal per the standard depending on how you read C99 6.7.5.3p15 and // C99 6.9.1p8. - if (!getLangOptions().CPlusPlus && + if (!getLangOpts().CPlusPlus && Old->hasPrototype() && !New->hasPrototype() && New->getType()->getAs<FunctionProtoType>() && Old->getNumParams() == New->getNumParams()) { @@ -2117,7 +2117,7 @@ bool Sema::MergeCompatibleFunctionDecls(FunctionDecl *New, FunctionDecl *Old) { mergeParamDeclAttributes(New->getParamDecl(i), Old->getParamDecl(i), Context); - if (getLangOptions().CPlusPlus) + if (getLangOpts().CPlusPlus) return MergeCXXFunctionDecl(New, Old); return false; @@ -2155,7 +2155,7 @@ void Sema::MergeVarDeclTypes(VarDecl *New, VarDecl *Old) { return; QualType MergedT; - if (getLangOptions().CPlusPlus) { + if (getLangOpts().CPlusPlus) { AutoType *AT = New->getType()->getContainedAutoType(); if (AT && !AT->isDeduced()) { // We don't know what the new type is until the initializer is attached. @@ -2316,7 +2316,7 @@ void Sema::MergeVarDecl(VarDecl *New, LookupResult &Previous) { // C++ doesn't have tentative definitions, so go right ahead and check here. const VarDecl *Def; - if (getLangOptions().CPlusPlus && + if (getLangOpts().CPlusPlus && New->isThisDeclarationADefinition() == VarDecl::Definition && (Def = Old->getDefinition())) { Diag(New->getLocation(), diag::err_redefinition) @@ -2422,7 +2422,7 @@ Decl *Sema::ParsedFreeStandingDeclSpec(Scope *S, AccessSpecifier AS, if (RecordDecl *Record = dyn_cast_or_null<RecordDecl>(Tag)) { if (!Record->getDeclName() && Record->isCompleteDefinition() && DS.getStorageClassSpec() != DeclSpec::SCS_typedef) { - if (getLangOptions().CPlusPlus || + if (getLangOpts().CPlusPlus || Record->getDeclContext()->isRecord()) return BuildAnonymousStructOrUnion(S, DS, AS, Record); @@ -2433,7 +2433,7 @@ Decl *Sema::ParsedFreeStandingDeclSpec(Scope *S, AccessSpecifier AS, } // Check for Microsoft C extension: anonymous struct. - if (getLangOptions().MicrosoftExt && !getLangOptions().CPlusPlus && + if (getLangOpts().MicrosoftExt && !getLangOpts().CPlusPlus && CurContext->isRecord() && DS.getStorageClassSpec() == DeclSpec::SCS_unspecified) { // Handle 2 kinds of anonymous struct: @@ -2450,7 +2450,7 @@ Decl *Sema::ParsedFreeStandingDeclSpec(Scope *S, AccessSpecifier AS, } } - if (getLangOptions().CPlusPlus && + if (getLangOpts().CPlusPlus && DS.getStorageClassSpec() != DeclSpec::SCS_typedef) if (EnumDecl *Enum = dyn_cast_or_null<EnumDecl>(Tag)) if (Enum->enumerator_begin() == Enum->enumerator_end() && @@ -2699,17 +2699,17 @@ Decl *Sema::BuildAnonymousStructOrUnion(Scope *S, DeclSpec &DS, DeclContext *Owner = Record->getDeclContext(); // Diagnose whether this anonymous struct/union is an extension. - if (Record->isUnion() && !getLangOptions().CPlusPlus && !getLangOptions().C11) + if (Record->isUnion() && !getLangOpts().CPlusPlus && !getLangOpts().C11) Diag(Record->getLocation(), diag::ext_anonymous_union); - else if (!Record->isUnion() && getLangOptions().CPlusPlus) + else if (!Record->isUnion() && getLangOpts().CPlusPlus) Diag(Record->getLocation(), diag::ext_gnu_anonymous_struct); - else if (!Record->isUnion() && !getLangOptions().C11) + else if (!Record->isUnion() && !getLangOpts().C11) Diag(Record->getLocation(), diag::ext_c11_anonymous_struct); // C and C++ require different kinds of checks for anonymous // structs/unions. bool Invalid = false; - if (getLangOptions().CPlusPlus) { + if (getLangOpts().CPlusPlus) { const char* PrevSpec = 0; unsigned DiagID; if (Record->isUnion()) { @@ -2799,7 +2799,7 @@ Decl *Sema::BuildAnonymousStructOrUnion(Scope *S, DeclSpec &DS, if (!MemRecord->isAnonymousStructOrUnion() && MemRecord->getDeclName()) { // Visual C++ allows type definition in anonymous struct or union. - if (getLangOptions().MicrosoftExt) + if (getLangOpts().MicrosoftExt) Diag(MemRecord->getLocation(), diag::ext_anonymous_record_with_type) << (int)Record->isUnion(); else { @@ -2823,7 +2823,7 @@ Decl *Sema::BuildAnonymousStructOrUnion(Scope *S, DeclSpec &DS, DK = diag::err_anonymous_record_with_static; // Visual C++ allows type definition in anonymous struct or union. - if (getLangOptions().MicrosoftExt && + if (getLangOpts().MicrosoftExt && DK == diag::err_anonymous_record_with_type) Diag((*Mem)->getLocation(), diag::ext_anonymous_record_with_type) << (int)Record->isUnion(); @@ -2838,7 +2838,7 @@ Decl *Sema::BuildAnonymousStructOrUnion(Scope *S, DeclSpec &DS, if (!Record->isUnion() && !Owner->isRecord()) { Diag(Record->getLocation(), diag::err_anonymous_struct_not_member) - << (int)getLangOptions().CPlusPlus; + << (int)getLangOpts().CPlusPlus; Invalid = true; } @@ -2859,7 +2859,7 @@ Decl *Sema::BuildAnonymousStructOrUnion(Scope *S, DeclSpec &DS, /*BitWidth=*/0, /*Mutable=*/false, /*HasInit=*/false); Anon->setAccess(AS); - if (getLangOptions().CPlusPlus) + if (getLangOpts().CPlusPlus) FieldCollector->Add(cast<FieldDecl>(Anon)); } else { DeclSpec::SCS SCSpec = DS.getStorageClassSpec(); @@ -3645,7 +3645,7 @@ Sema::ActOnTypedefDeclarator(Scope* S, Declarator& D, DeclContext* DC, Previous.clear(); } - if (getLangOptions().CPlusPlus) { + if (getLangOpts().CPlusPlus) { // Check that there are no default arguments (C++ only). CheckExtraCXXDefaultArguments(D); } @@ -3775,7 +3775,7 @@ isOutOfScopePreviousDeclaration(NamedDecl *PrevDecl, DeclContext *DC, if (!PrevDecl->hasLinkage()) return false; - if (Context.getLangOptions().CPlusPlus) { + if (Context.getLangOpts().CPlusPlus) { // C++ [basic.link]p6: // If there is a visible declaration of an entity with linkage // having the same name and type, ignoring entities declared @@ -3864,7 +3864,7 @@ Sema::ActOnVariableDeclarator(Scope *S, Declarator &D, DeclContext *DC, DeclarationName Name = GetNameForDeclarator(D).getName(); // Check that there are no default arguments (C++ only). - if (getLangOptions().CPlusPlus) + if (getLangOpts().CPlusPlus) CheckExtraCXXDefaultArguments(D); DeclSpec::SCS SCSpec = D.getDeclSpec().getStorageClassSpec(); @@ -3906,7 +3906,7 @@ Sema::ActOnVariableDeclarator(Scope *S, Declarator &D, DeclContext *DC, } } - if (getLangOptions().OpenCL) { + if (getLangOpts().OpenCL) { // Set up the special work-group-local storage class for variables in the // OpenCL __local address space. if (R.getAddressSpace() == LangAS::opencl_local) @@ -3915,7 +3915,7 @@ Sema::ActOnVariableDeclarator(Scope *S, Declarator &D, DeclContext *DC, bool isExplicitSpecialization = false; VarDecl *NewVD; - if (!getLangOptions().CPlusPlus) { + if (!getLangOpts().CPlusPlus) { NewVD = VarDecl::Create(Context, DC, D.getLocStart(), D.getIdentifierLoc(), II, R, TInfo, SC, SCAsWritten); @@ -3943,7 +3943,7 @@ Sema::ActOnVariableDeclarator(Scope *S, Declarator &D, DeclContext *DC, // the program is ill-formed. C++11 drops this restriction. if (RD->isUnion()) Diag(D.getIdentifierLoc(), - getLangOptions().CPlusPlus0x + getLangOpts().CPlusPlus0x ? diag::warn_cxx98_compat_static_data_member_in_union : diag::ext_static_data_member_in_union) << Name; // We conservatively disallow static data members in anonymous structs. @@ -4043,7 +4043,7 @@ Sema::ActOnVariableDeclarator(Scope *S, Declarator &D, DeclContext *DC, // In auto-retain/release, infer strong retension for variables of // retainable type. - if (getLangOptions().ObjCAutoRefCount && inferObjCARCLifetime(NewVD)) + if (getLangOpts().ObjCAutoRefCount && inferObjCARCLifetime(NewVD)) NewVD->setInvalidDecl(); // Handle GNU asm-label extension (encoded as an attribute). @@ -4090,7 +4090,7 @@ Sema::ActOnVariableDeclarator(Scope *S, Declarator &D, DeclContext *DC, FilterLookupForScope(Previous, DC, S, NewVD->hasLinkage(), isExplicitSpecialization); - if (!getLangOptions().CPlusPlus) { + if (!getLangOpts().CPlusPlus) { D.setRedeclaration(CheckVariableDeclaration(NewVD, Previous)); } else { // Merge the decl with the existing one if appropriate. @@ -4283,7 +4283,7 @@ bool Sema::CheckVariableDeclaration(VarDecl *NewVD, if (NewVD->hasLocalStorage() && T.isObjCGCWeak() && !NewVD->hasAttr<BlocksAttr>()) { - if (getLangOptions().getGC() != LangOptions::NonGC) + if (getLangOpts().getGC() != LangOptions::NonGC) Diag(NewVD->getLocation(), diag::warn_gc_attribute_weak_on_local); else Diag(NewVD->getLocation(), diag::warn_attribute_weak_on_local); @@ -4502,7 +4502,7 @@ static NamedDecl* DiagnoseInvalidRedeclaration( llvm::SmallVector<unsigned, 1> MismatchedParams; llvm::SmallVector<std::pair<FunctionDecl*, unsigned>, 1> NearMatches; TypoCorrection Correction; - bool isFriendDecl = (SemaRef.getLangOptions().CPlusPlus && + bool isFriendDecl = (SemaRef.getLangOpts().CPlusPlus && ExtraArgs.D.getDeclSpec().isFriendSpecified()); unsigned DiagMsg = isFriendDecl ? diag::err_no_matching_local_friend : diag::err_member_def_does_not_match; @@ -4584,10 +4584,10 @@ static NamedDecl* DiagnoseInvalidRedeclaration( if (Correction) SemaRef.Diag(NewFD->getLocation(), DiagMsg) - << Name << NewDC << Correction.getQuoted(SemaRef.getLangOptions()) + << Name << NewDC << Correction.getQuoted(SemaRef.getLangOpts()) << FixItHint::CreateReplacement( NewFD->getLocation(), - Correction.getAsString(SemaRef.getLangOptions())); + Correction.getAsString(SemaRef.getLangOpts())); else SemaRef.Diag(NewFD->getLocation(), DiagMsg) << Name << NewDC << NewFD->getLocation(); @@ -4611,7 +4611,7 @@ static NamedDecl* DiagnoseInvalidRedeclaration( << Idx << FDParam->getType() << NewFD->getParamDecl(Idx-1)->getType(); } else if (Correction) { SemaRef.Diag(FD->getLocation(), diag::note_previous_decl) - << Correction.getQuoted(SemaRef.getLangOptions()); + << Correction.getQuoted(SemaRef.getLangOpts()); } else if (FDisConst != NewFDisConst) { SemaRef.Diag(FD->getLocation(), diag::note_member_def_close_const_match) << NewFDisConst << FD->getSourceRange().getEnd(); @@ -4668,7 +4668,7 @@ static FunctionDecl* CreateNewFunctionDecl(Sema &SemaRef, Declarator &D, FunctionDecl::StorageClass SCAsWritten = StorageClassSpecToFunctionDeclStorageClass(SCSpec); - if (!SemaRef.getLangOptions().CPlusPlus) { + if (!SemaRef.getLangOpts().CPlusPlus) { // Determine whether the function was written with a // prototype. This true when: // - there is a prototype in the declarator, or @@ -4730,7 +4730,7 @@ static FunctionDecl* CreateNewFunctionDecl(Sema &SemaRef, Declarator &D, // If the class is complete, then we now create the implicit exception // specification. If the class is incomplete or dependent, we can't do // it yet. - if (SemaRef.getLangOptions().CPlusPlus0x && !Record->isDependentType() && + if (SemaRef.getLangOpts().CPlusPlus0x && !Record->isDependentType() && Record->getDefinition() && !Record->isBeingDefined() && R->getAs<FunctionProtoType>()->getExceptionSpecType() == EST_None) { SemaRef.AdjustDestructorExceptionSpec(Record, NewDD); @@ -4862,7 +4862,7 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC, if (OriginalLexicalContext && OriginalLexicalContext->isObjCContainer()) NewFD->setTopLevelDeclInObjCContainer(); - if (getLangOptions().CPlusPlus) { + if (getLangOpts().CPlusPlus) { bool isInline = D.getDeclSpec().isInlineSpecified(); bool isVirtual = D.getDeclSpec().isVirtualSpecified(); bool isExplicit = D.getDeclSpec().isExplicitSpecified(); @@ -5204,7 +5204,7 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC, // In C++, the empty parameter-type-list must be spelled "void"; a // typedef of void is not permitted. - if (getLangOptions().CPlusPlus && + if (getLangOpts().CPlusPlus && Param->getType().getUnqualifiedType() != Context.VoidTy) { bool IsTypeAlias = false; if (const TypedefType *TT = Param->getType()->getAs<TypedefType>()) @@ -5266,7 +5266,7 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC, ProcessDeclAttributes(S, NewFD, D, /*NonInheritable=*/true, /*Inheritable=*/false); - if (!getLangOptions().CPlusPlus) { + if (!getLangOpts().CPlusPlus) { // Perform semantic checking on the function declaration. bool isExplicitSpecialization=false; if (!NewFD->isInvalidDecl()) { @@ -5358,7 +5358,7 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC, if (CurContext->isDependentContext() && CurContext->isRecord() && !isFriend) { isDependentClassScopeExplicitSpecialization = true; - Diag(NewFD->getLocation(), getLangOptions().MicrosoftExt ? + Diag(NewFD->getLocation(), getLangOpts().MicrosoftExt ? diag::ext_function_specialization_in_class : diag::err_function_specialization_in_class) << NewFD->getDeclName(); @@ -5576,7 +5576,7 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC, // Set this FunctionDecl's range up to the right paren. NewFD->setRangeEnd(D.getSourceRange().getEnd()); - if (getLangOptions().CPlusPlus) { + if (getLangOpts().CPlusPlus) { if (FunctionTemplate) { if (NewFD->isInvalidDecl()) FunctionTemplate->setInvalidDecl(); @@ -5586,7 +5586,7 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC, MarkUnusedFileScopedDecl(NewFD); - if (getLangOptions().CUDA) + if (getLangOpts().CUDA) if (IdentifierInfo *II = NewFD->getIdentifier()) if (!NewFD->isInvalidDecl() && NewFD->getDeclContext()->getRedeclContext()->isTranslationUnit()) { @@ -5676,7 +5676,7 @@ bool Sema::CheckFunctionDeclaration(Scope *S, FunctionDecl *NewFD, break; } - if (!getLangOptions().CPlusPlus && !NewFD->hasAttr<OverloadableAttr>()) { + if (!getLangOpts().CPlusPlus && !NewFD->hasAttr<OverloadableAttr>()) { // If a function name is overloadable in C, then every function // with that name must be marked "overloadable". Diag(NewFD->getLocation(), diag::err_attribute_overloadable_missing) @@ -5734,7 +5734,7 @@ bool Sema::CheckFunctionDeclaration(Scope *S, FunctionDecl *NewFD, } // Semantic checking for this function declaration (in isolation). - if (getLangOptions().CPlusPlus) { + if (getLangOpts().CPlusPlus) { // C++-specific checks. if (CXXConstructorDecl *Constructor = dyn_cast<CXXConstructorDecl>(NewFD)) { CheckConstructor(Constructor); @@ -5835,7 +5835,7 @@ void Sema::CheckMain(FunctionDecl* FD, const DeclSpec& DS) { // shall not appear in a declaration of main. // static main is not an error under C99, but we should warn about it. if (FD->getStorageClass() == SC_Static) - Diag(DS.getStorageClassSpecLoc(), getLangOptions().CPlusPlus + Diag(DS.getStorageClassSpecLoc(), getLangOpts().CPlusPlus ? diag::err_static_main : diag::warn_static_main) << FixItHint::CreateRemoval(DS.getStorageClassSpecLoc()); if (FD->isInlineSpecified()) @@ -5861,7 +5861,7 @@ void Sema::CheckMain(FunctionDecl* FD, const DeclSpec& DS) { // In C with GNU extensions we allow main() to have non-integer return // type, but we should warn about the extension, and we disable the // implicit-return-zero rule. - } else if (getLangOptions().GNUMode && !getLangOptions().CPlusPlus) { + } else if (getLangOpts().GNUMode && !getLangOpts().CPlusPlus) { Diag(FD->getTypeSpecStartLoc(), diag::ext_main_returns_nonint); // Otherwise, this is just a flat-out error. @@ -6126,7 +6126,7 @@ void Sema::AddInitializerToDecl(Decl *RealDecl, Expr *Init, VDecl->ClearLinkageCache(); // In ARC, infer lifetime. - if (getLangOptions().ObjCAutoRefCount && inferObjCARCLifetime(VDecl)) + if (getLangOpts().ObjCAutoRefCount && inferObjCARCLifetime(VDecl)) VDecl->setInvalidDecl(); // If this is a redeclaration, check that the type we just deduced matches @@ -6172,7 +6172,7 @@ void Sema::AddInitializerToDecl(Decl *RealDecl, Expr *Init, } const VarDecl* PrevInit = 0; - if (getLangOptions().CPlusPlus) { + if (getLangOpts().CPlusPlus) { // C++ [class.static.data]p4 // If a static data member is of const integral or const // enumeration type, its declaration in the class definition can @@ -6215,7 +6215,7 @@ void Sema::AddInitializerToDecl(Decl *RealDecl, Expr *Init, // Top-level message sends default to 'id' when we're in a debugger // and we are assigning it to a variable of 'id' type. - if (getLangOptions().DebuggerCastResultToId && DclT->isObjCIdType()) + if (getLangOpts().DebuggerCastResultToId && DclT->isObjCIdType()) if (Init->getType() == Context.UnknownAnyTy && isa<ObjCMessageExpr>(Init)) { ExprResult Result = forceUnknownAnyToType(Init, Context.getObjCIdType()); if (Result.isInvalid()) { @@ -6277,7 +6277,7 @@ void Sema::AddInitializerToDecl(Decl *RealDecl, Expr *Init, // C99 6.7.8p4: All the expressions in an initializer for an object that has // static storage duration shall be constant expressions or string literals. // C++ does not have this restriction. - if (!getLangOptions().CPlusPlus && !VDecl->isInvalidDecl() && + if (!getLangOpts().CPlusPlus && !VDecl->isInvalidDecl() && VDecl->getStorageClass() == SC_Static) CheckForConstantInitializer(Init, DclT); } else if (VDecl->isStaticDataMember() && @@ -6321,7 +6321,7 @@ void Sema::AddInitializerToDecl(Decl *RealDecl, Expr *Init, } else if (DclT->isIntegralOrEnumerationType()) { // Check whether the expression is a constant expression. SourceLocation Loc; - if (getLangOptions().CPlusPlus0x && DclT.isVolatileQualified()) + if (getLangOpts().CPlusPlus0x && DclT.isVolatileQualified()) // In C++11, a non-constexpr const static data member with an // in-class initializer cannot be volatile. Diag(VDecl->getLocation(), diag::err_in_class_initializer_volatile); @@ -6346,7 +6346,7 @@ void Sema::AddInitializerToDecl(Decl *RealDecl, Expr *Init, } else if (DclT->isFloatingType()) { // also permits complex, which is ok Diag(VDecl->getLocation(), diag::ext_in_class_initializer_float_type) << DclT << Init->getSourceRange(); - if (getLangOptions().CPlusPlus0x) + if (getLangOpts().CPlusPlus0x) Diag(VDecl->getLocation(), diag::note_in_class_initializer_float_type_constexpr) << FixItHint::CreateInsertion(VDecl->getLocStart(), "constexpr "); @@ -6358,7 +6358,7 @@ void Sema::AddInitializerToDecl(Decl *RealDecl, Expr *Init, } // Suggest adding 'constexpr' in C++11 for literal types. - } else if (getLangOptions().CPlusPlus0x && DclT->isLiteralType()) { + } else if (getLangOpts().CPlusPlus0x && DclT->isLiteralType()) { Diag(VDecl->getLocation(), diag::err_in_class_initializer_literal_type) << DclT << Init->getSourceRange() << FixItHint::CreateInsertion(VDecl->getLocStart(), "constexpr "); @@ -6371,12 +6371,12 @@ void Sema::AddInitializerToDecl(Decl *RealDecl, Expr *Init, } } else if (VDecl->isFileVarDecl()) { if (VDecl->getStorageClassAsWritten() == SC_Extern && - (!getLangOptions().CPlusPlus || + (!getLangOpts().CPlusPlus || !Context.getBaseElementType(VDecl->getType()).isConstQualified())) Diag(VDecl->getLocation(), diag::warn_extern_init); // C99 6.7.8p4. All file scoped initializers need to be constant. - if (!getLangOptions().CPlusPlus && !VDecl->isInvalidDecl()) + if (!getLangOpts().CPlusPlus && !VDecl->isInvalidDecl()) CheckForConstantInitializer(Init, DclT); } @@ -6597,7 +6597,7 @@ void Sema::ActOnUninitializedDecl(Decl *RealDecl, // trivial default constructor and a trivial destructor, a cv-qualified // version of one of these types, or an array of one of the preceding // types and is declared without an initializer. - if (getLangOptions().CPlusPlus && Var->hasLocalStorage()) { + if (getLangOpts().CPlusPlus && Var->hasLocalStorage()) { if (const RecordType *Record = Context.getBaseElementType(Type)->getAs<RecordType>()) { CXXRecordDecl *CXXRecord = cast<CXXRecordDecl>(Record->getDecl()); @@ -6689,7 +6689,7 @@ void Sema::CheckCompleteVariableDeclaration(VarDecl *var) { // In ARC, don't allow jumps past the implicit initialization of a // local retaining variable. - if (getLangOptions().ObjCAutoRefCount && + if (getLangOpts().ObjCAutoRefCount && var->hasLocalStorage()) { switch (var->getType().getObjCLifetime()) { case Qualifiers::OCL_None: @@ -6705,7 +6705,7 @@ void Sema::CheckCompleteVariableDeclaration(VarDecl *var) { } // All the following checks are C++ only. - if (!getLangOptions().CPlusPlus) return; + if (!getLangOpts().CPlusPlus) return; QualType baseType = Context.getBaseElementType(var->getType()); if (baseType->isDependentType()) return; @@ -6859,7 +6859,7 @@ Decl *Sema::ActOnParamDeclarator(Scope *S, Declarator &D) { if (DS.getStorageClassSpec() == DeclSpec::SCS_register) { StorageClass = SC_Register; StorageClassAsWritten = SC_Register; - } else if (getLangOptions().CPlusPlus && + } else if (getLangOpts().CPlusPlus && DS.getStorageClassSpec() == DeclSpec::SCS_auto) { StorageClass = SC_Auto; StorageClassAsWritten = SC_Auto; @@ -6880,7 +6880,7 @@ Decl *Sema::ActOnParamDeclarator(Scope *S, Declarator &D) { TypeSourceInfo *TInfo = GetTypeForDeclarator(D, S); QualType parmDeclType = TInfo->getType(); - if (getLangOptions().CPlusPlus) { + if (getLangOpts().CPlusPlus) { // Check that there are no default arguments inside the type of this // parameter. CheckExtraCXXDefaultArguments(D); @@ -7030,7 +7030,7 @@ ParmVarDecl *Sema::CheckParameter(DeclContext *DC, SourceLocation StartLoc, VarDecl::StorageClass StorageClass, VarDecl::StorageClass StorageClassAsWritten) { // In ARC, infer a lifetime qualifier for appropriate parameter types. - if (getLangOptions().ObjCAutoRefCount && + if (getLangOpts().ObjCAutoRefCount && T.getObjCLifetime() == Qualifiers::OCL_None && T->isObjCLifetimeType()) { @@ -7183,11 +7183,11 @@ void Sema::CheckForFunctionRedefinition(FunctionDecl *FD) { // was an extern inline function. const FunctionDecl *Definition; if (FD->isDefined(Definition) && - !canRedefineFunction(Definition, getLangOptions())) { - if (getLangOptions().GNUMode && Definition->isInlineSpecified() && + !canRedefineFunction(Definition, getLangOpts())) { + if (getLangOpts().GNUMode && Definition->isInlineSpecified() && Definition->getStorageClass() == SC_Extern) Diag(FD->getLocation(), diag::err_redefinition_extern_inline) - << FD->getDeclName() << getLangOptions().CPlusPlus; + << FD->getDeclName() << getLangOpts().CPlusPlus; else Diag(FD->getLocation(), diag::err_redefinition) << FD->getDeclName(); Diag(Definition->getLocation(), diag::note_previous_definition); @@ -7385,7 +7385,7 @@ Decl *Sema::ActOnFinishFunctionBody(Decl *dcl, Stmt *Body, // MSVC permits the use of pure specifier (=0) on function definition, // defined at class scope, warn about this non standard construct. - if (getLangOptions().MicrosoftExt && FD->isPure()) + if (getLangOpts().MicrosoftExt && FD->isPure()) Diag(FD->getLocation(), diag::warn_pure_function_definition); if (!FD->isInvalidDecl()) { @@ -7524,7 +7524,7 @@ NamedDecl *Sema::ImplicitlyDefineFunction(SourceLocation Loc, unsigned diag_id; if (II.getName().startswith("__builtin_")) diag_id = diag::warn_builtin_unknown; - else if (getLangOptions().C99) + else if (getLangOpts().C99) diag_id = diag::ext_implicit_function_decl; else diag_id = diag::warn_implicit_function_decl; @@ -7537,8 +7537,8 @@ NamedDecl *Sema::ImplicitlyDefineFunction(SourceLocation Loc, DeclFilterCCC<FunctionDecl> Validator; if (S && (Corrected = CorrectTypo(DeclarationNameInfo(&II, Loc), LookupOrdinaryName, S, 0, Validator))) { - std::string CorrectedStr = Corrected.getAsString(getLangOptions()); - std::string CorrectedQuotedStr = Corrected.getQuoted(getLangOptions()); + std::string CorrectedStr = Corrected.getAsString(getLangOpts()); + std::string CorrectedQuotedStr = Corrected.getQuoted(getLangOpts()); FunctionDecl *Func = Corrected.getCorrectionDeclAs<FunctionDecl>(); Diag(Loc, diag::note_function_suggestion) << CorrectedQuotedStr @@ -7627,7 +7627,7 @@ void Sema::AddKnownFunctionAttributes(FunctionDecl *FD) { // Mark const if we don't care about errno and that is the only // thing preventing the function from being const. This allows // IRgen to use LLVM intrinsics for such functions. - if (!getLangOptions().MathErrno && + if (!getLangOpts().MathErrno && Context.BuiltinInfo.isConstWithoutErrno(BuiltinID)) { if (!FD->getAttr<ConstAttr>()) FD->addAttr(::new (Context) ConstAttr(FD->getLocation(), Context)); @@ -7645,7 +7645,7 @@ void Sema::AddKnownFunctionAttributes(FunctionDecl *FD) { IdentifierInfo *Name = FD->getIdentifier(); if (!Name) return; - if ((!getLangOptions().CPlusPlus && + if ((!getLangOpts().CPlusPlus && FD->getDeclContext()->isTranslationUnit()) || (isa<LinkageSpecDecl>(FD->getDeclContext()) && cast<LinkageSpecDecl>(FD->getDeclContext())->getLanguage() == @@ -7924,7 +7924,7 @@ Decl *Sema::ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK, UPPC_FixedUnderlyingType)) EnumUnderlying = Context.IntTy.getTypePtr(); - } else if (getLangOptions().MicrosoftMode) + } else if (getLangOpts().MicrosoftMode) // Microsoft enums are always of int type. EnumUnderlying = Context.IntTy.getTypePtr(); } @@ -8018,7 +8018,7 @@ Decl *Sema::ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK, if (Previous.isAmbiguous()) return 0; - if (!getLangOptions().CPlusPlus && TUK != TUK_Reference) { + if (!getLangOpts().CPlusPlus && TUK != TUK_Reference) { // FIXME: This makes sure that we ignore the contexts associated // with C structs, unions, and enums when looking for a matching // tag declaration or definition. See the similar lookup tweak @@ -8041,7 +8041,7 @@ Decl *Sema::ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK, Previous.clear(); } - if (getLangOptions().CPlusPlus && Name && DC && StdNamespace && + if (getLangOpts().CPlusPlus && Name && DC && StdNamespace && DC->Equals(getStdNamespace()) && Name->isStr("bad_alloc")) { // This is a declaration of or a reference to "std::bad_alloc". isStdBadAlloc = true; @@ -8097,7 +8097,7 @@ Decl *Sema::ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK, // Find the scope where we'll be declaring the tag. while (S->isClassScope() || - (getLangOptions().CPlusPlus && + (getLangOpts().CPlusPlus && S->isFunctionPrototypeScope()) || ((S->getFlags() & Scope::DeclScope) == 0) || (S->getEntity() && @@ -8114,7 +8114,7 @@ Decl *Sema::ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK, // In C++, we need to do a redeclaration lookup to properly // diagnose some problems. - if (getLangOptions().CPlusPlus) { + if (getLangOpts().CPlusPlus) { Previous.setRedeclarationKind(ForRedeclaration); LookupQualifiedName(Previous, SearchDC); } @@ -8132,7 +8132,7 @@ Decl *Sema::ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK, // technically forbidden by the current standard but which is // okay according to the likely resolution of an open issue; // see http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#407 - if (getLangOptions().CPlusPlus) { + if (getLangOpts().CPlusPlus) { if (TypedefNameDecl *TD = dyn_cast<TypedefNameDecl>(PrevDecl)) { if (const TagType *TT = TD->getUnderlyingType()->getAs<TagType>()) { TagDecl *Tag = TT->getDecl(); @@ -8235,7 +8235,7 @@ Decl *Sema::ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK, // For our current ASTs this shouldn't be a problem, but will // need to be changed with DeclGroups. if ((TUK == TUK_Reference && (!PrevTagDecl->getFriendObjectKind() || - getLangOptions().MicrosoftExt)) || TUK == TUK_Friend) + getLangOpts().MicrosoftExt)) || TUK == TUK_Friend) return PrevTagDecl; // Diagnose attempts to redefine a tag. @@ -8250,7 +8250,7 @@ Decl *Sema::ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK, == TSK_ExplicitSpecialization) { // A redeclaration in function prototype scope in C isn't // visible elsewhere, so merely issue a warning. - if (!getLangOptions().CPlusPlus && S->containedInPrototypeScope()) + if (!getLangOpts().CPlusPlus && S->containedInPrototypeScope()) Diag(NameLoc, diag::warn_redefinition_in_param_list) << Name; else Diag(NameLoc, diag::err_redefinition) << Name; @@ -8380,7 +8380,7 @@ CreateNewDecl: // If this is an undefined enum, warn. if (TUK != TUK_Definition && !Invalid) { TagDecl *Def; - if (getLangOptions().CPlusPlus0x && cast<EnumDecl>(New)->isFixed()) { + if (getLangOpts().CPlusPlus0x && cast<EnumDecl>(New)->isFixed()) { // C++0x: 7.2p2: opaque-enum-declaration. // Conflicts are diagnosed above. Do nothing. } @@ -8390,9 +8390,9 @@ CreateNewDecl: Diag(Def->getLocation(), diag::note_previous_definition); } else { unsigned DiagID = diag::ext_forward_ref_enum; - if (getLangOptions().MicrosoftMode) + if (getLangOpts().MicrosoftMode) DiagID = diag::ext_ms_forward_ref_enum; - else if (getLangOptions().CPlusPlus) + else if (getLangOpts().CPlusPlus) DiagID = diag::err_forward_ref_enum; Diag(Loc, DiagID); @@ -8418,7 +8418,7 @@ CreateNewDecl: // FIXME: Tag decls should be chained to any simultaneous vardecls, e.g.: // struct X { int A; } D; D should chain to X. - if (getLangOptions().CPlusPlus) { + if (getLangOpts().CPlusPlus) { // FIXME: Look for a way to use RecordDecl for simple structs. New = CXXRecordDecl::Create(Context, Kind, SearchDC, KWLoc, Loc, Name, cast_or_null<CXXRecordDecl>(PrevDecl)); @@ -8484,7 +8484,7 @@ CreateNewDecl: // If we're declaring or defining a tag in function prototype scope // in C, note that this type can only be used within the function. - if (Name && S->isFunctionPrototypeScope() && !getLangOptions().CPlusPlus) + if (Name && S->isFunctionPrototypeScope() && !getLangOpts().CPlusPlus) Diag(Loc, diag::warn_decl_in_param_list) << Context.getTagDeclType(New); // Set the lexical context. If the tag has a C++ scope specifier, the @@ -8497,7 +8497,7 @@ CreateNewDecl: // the tag name visible. if (TUK == TUK_Friend) New->setObjectOfFriendDecl(/* PreviouslyDeclared = */ !Previous.empty() || - getLangOptions().MicrosoftExt); + getLangOpts().MicrosoftExt); // Set the access specifier. if (!Invalid && SearchDC->isRecord()) @@ -8537,7 +8537,7 @@ CreateNewDecl: // If we were in function prototype scope (and not in C++ mode), add this // tag to the list of decls to inject into the function definition scope. - if (S->isFunctionPrototypeScope() && !getLangOptions().CPlusPlus && + if (S->isFunctionPrototypeScope() && !getLangOpts().CPlusPlus && InFunctionDeclarator && Name) DeclsInPrototypeScope.push_back(New); @@ -8708,7 +8708,7 @@ ExprResult Sema::VerifyBitField(SourceLocation FieldLoc, if (!FieldTy->isDependentType()) { uint64_t TypeSize = Context.getTypeSize(FieldTy); if (Value.getZExtValue() > TypeSize) { - if (!getLangOptions().CPlusPlus) { + if (!getLangOpts().CPlusPlus) { if (FieldName) return Diag(FieldLoc, diag::err_bitfield_width_exceeds_type_size) << FieldName << (unsigned)Value.getZExtValue() @@ -8753,7 +8753,7 @@ FieldDecl *Sema::HandleField(Scope *S, RecordDecl *Record, TypeSourceInfo *TInfo = GetTypeForDeclarator(D, S); QualType T = TInfo->getType(); - if (getLangOptions().CPlusPlus) { + if (getLangOpts().CPlusPlus) { CheckExtraCXXDefaultArguments(D); if (DiagnoseUnexpandedParameterPack(D.getIdentifierLoc(), TInfo, @@ -8940,7 +8940,7 @@ FieldDecl *Sema::CheckFieldDecl(DeclarationName Name, QualType T, NewFD->setInvalidDecl(); } - if (!InvalidDecl && getLangOptions().CPlusPlus) { + if (!InvalidDecl && getLangOpts().CPlusPlus) { if (Record->isUnion()) { if (const RecordType *RT = EltTy->getAs<RecordType>()) { CXXRecordDecl* RDecl = cast<CXXRecordDecl>(RT->getDecl()); @@ -8973,7 +8973,7 @@ FieldDecl *Sema::CheckFieldDecl(DeclarationName Name, QualType T, // In auto-retain/release, infer strong retension for fields of // retainable type. - if (getLangOptions().ObjCAutoRefCount && inferObjCARCLifetime(NewFD)) + if (getLangOpts().ObjCAutoRefCount && inferObjCARCLifetime(NewFD)) NewFD->setInvalidDecl(); if (T.isObjCGCWeak()) @@ -8985,7 +8985,7 @@ FieldDecl *Sema::CheckFieldDecl(DeclarationName Name, QualType T, bool Sema::CheckNontrivialField(FieldDecl *FD) { assert(FD); - assert(getLangOptions().CPlusPlus && "valid check only for C++"); + assert(getLangOpts().CPlusPlus && "valid check only for C++"); if (FD->isInvalidDecl()) return true; @@ -9009,8 +9009,8 @@ bool Sema::CheckNontrivialField(FieldDecl *FD) { member = CXXDestructor; if (member != CXXInvalid) { - if (!getLangOptions().CPlusPlus0x && - getLangOptions().ObjCAutoRefCount && RDecl->hasObjectMember()) { + if (!getLangOpts().CPlusPlus0x && + getLangOpts().ObjCAutoRefCount && RDecl->hasObjectMember()) { // Objective-C++ ARC: it is an error to have a non-trivial field of // a union. However, system headers in Objective-C programs // occasionally have Objective-C lifetime objects within unions, @@ -9025,12 +9025,12 @@ bool Sema::CheckNontrivialField(FieldDecl *FD) { } } - Diag(FD->getLocation(), getLangOptions().CPlusPlus0x ? + Diag(FD->getLocation(), getLangOpts().CPlusPlus0x ? diag::warn_cxx98_compat_nontrivial_union_or_anon_struct_member : diag::err_illegal_union_or_anon_struct_member) << (int)FD->getParent()->isUnion() << FD->getDeclName() << member; DiagnoseNontrivial(RT, member); - return !getLangOptions().CPlusPlus0x; + return !getLangOpts().CPlusPlus0x; } } } @@ -9319,7 +9319,7 @@ Decl *Sema::ActOnIvar(Scope *S, NewID->setInvalidDecl(); // In ARC, infer 'retaining' for ivars of retainable type. - if (getLangOptions().ObjCAutoRefCount && inferObjCARCLifetime(NewID)) + if (getLangOpts().ObjCAutoRefCount && inferObjCARCLifetime(NewID)) NewID->setInvalidDecl(); if (D.getDeclSpec().isModulePrivateSpecified()) @@ -9441,21 +9441,21 @@ void Sema::ActOnFields(Scope* S, continue; } else if (FDTy->isIncompleteArrayType() && Record && ((i + 1 == Fields.end() && !Record->isUnion()) || - ((getLangOptions().MicrosoftExt || - getLangOptions().CPlusPlus) && + ((getLangOpts().MicrosoftExt || + getLangOpts().CPlusPlus) && (i + 1 == Fields.end() || Record->isUnion())))) { // Flexible array member. // Microsoft and g++ is more permissive regarding flexible array. // It will accept flexible array in union and also // as the sole element of a struct/class. - if (getLangOptions().MicrosoftExt) { + if (getLangOpts().MicrosoftExt) { if (Record->isUnion()) Diag(FD->getLocation(), diag::ext_flexible_array_union_ms) << FD->getDeclName(); else if (Fields.size() == 1) Diag(FD->getLocation(), diag::ext_flexible_array_empty_aggregate_ms) << FD->getDeclName() << Record->getTagKind(); - } else if (getLangOptions().CPlusPlus) { + } else if (getLangOpts().CPlusPlus) { if (Record->isUnion()) Diag(FD->getLocation(), diag::ext_flexible_array_union_gnu) << FD->getDeclName(); @@ -9518,8 +9518,8 @@ void Sema::ActOnFields(Scope* S, QualType T = Context.getObjCObjectPointerType(FD->getType()); FD->setType(T); } - else if (!getLangOptions().CPlusPlus) { - if (getLangOptions().ObjCAutoRefCount && Record && !ARCErrReported) { + else if (!getLangOpts().CPlusPlus) { + if (getLangOpts().ObjCAutoRefCount && Record && !ARCErrReported) { // It's an error in ARC if a field has lifetime. // We don't want to report this in a system header, though, // so we just make the field unavailable. @@ -9541,8 +9541,8 @@ void Sema::ActOnFields(Scope* S, ARCErrReported = true; } } - else if (getLangOptions().ObjC1 && - getLangOptions().getGC() != LangOptions::NonGC && + else if (getLangOpts().ObjC1 && + getLangOpts().getGC() != LangOptions::NonGC && Record && !Record->hasObjectMember()) { if (FD->getType()->isObjCObjectPointerType() || FD->getType().isObjCGCStrong()) @@ -9586,7 +9586,7 @@ void Sema::ActOnFields(Scope* S, // non-POD because of the presence of an Objective-C pointer member. // If so, objects of this type cannot be shared between code compiled // with instant objects and code compiled with manual retain/release. - if (getLangOptions().ObjCAutoRefCount && + if (getLangOpts().ObjCAutoRefCount && CXXRecord->hasObjectMember() && CXXRecord->getLinkage() == ExternalLinkage) { if (CXXRecord->isPOD()) { @@ -9612,7 +9612,7 @@ void Sema::ActOnFields(Scope* S, } // Adjust user-defined destructor exception spec. - if (getLangOptions().CPlusPlus0x && + if (getLangOpts().CPlusPlus0x && CXXRecord->hasUserDeclaredDestructor()) AdjustDestructorExceptionSpec(CXXRecord,CXXRecord->getDestructor()); @@ -9812,8 +9812,8 @@ EnumConstantDecl *Sema::CheckEnumConstant(EnumDecl *Enum, EltTy = Context.DependentTy; else { SourceLocation ExpLoc; - if (getLangOptions().CPlusPlus0x && Enum->isFixed() && - !getLangOptions().MicrosoftMode) { + if (getLangOpts().CPlusPlus0x && Enum->isFixed() && + !getLangOpts().MicrosoftMode) { // C++11 [dcl.enum]p5: If the underlying type is fixed, [...] the // constant-expression in the enumerator-definition shall be a converted // constant expression of the underlying type. @@ -9838,14 +9838,14 @@ EnumConstantDecl *Sema::CheckEnumConstant(EnumDecl *Enum, // we perform a non-narrowing conversion as part of converted constant // expression checking. if (!isRepresentableIntegerValue(Context, EnumVal, EltTy)) { - if (getLangOptions().MicrosoftMode) { + if (getLangOpts().MicrosoftMode) { Diag(IdLoc, diag::ext_enumerator_too_large) << EltTy; Val = ImpCastExprToType(Val, EltTy, CK_IntegralCast).take(); } else Diag(IdLoc, diag::err_enumerator_too_large) << EltTy; } else Val = ImpCastExprToType(Val, EltTy, CK_IntegralCast).take(); - } else if (getLangOptions().CPlusPlus) { + } else if (getLangOpts().CPlusPlus) { // C++11 [dcl.enum]p5: // If the underlying type is not fixed, the type of each enumerator // is the type of its initializing value: @@ -9941,9 +9941,9 @@ EnumConstantDecl *Sema::CheckEnumConstant(EnumDecl *Enum, // an int (C99 6.7.2.2p2). However, we support GCC's extension that // permits enumerator values that are representable in some larger // integral type. - if (!getLangOptions().CPlusPlus && !T.isNull()) + if (!getLangOpts().CPlusPlus && !T.isNull()) Diag(IdLoc, diag::warn_enum_value_overflow); - } else if (!getLangOptions().CPlusPlus && + } else if (!getLangOpts().CPlusPlus && !isRepresentableIntegerValue(Context, EnumVal, EltTy)) { // Enforce C99 6.7.2.2p2 even when we compute the next value. Diag(IdLoc, diag::ext_enum_value_not_int) @@ -9990,7 +9990,7 @@ Decl *Sema::ActOnEnumConstant(Scope *S, Decl *theEnumDecl, Decl *lastEnumConst, if (PrevDecl) { // When in C++, we may get a TagDecl with the same name; in this case the // enum constant will 'hide' the tag. - assert((getLangOptions().CPlusPlus || !isa<TagDecl>(PrevDecl)) && + assert((getLangOpts().CPlusPlus || !isa<TagDecl>(PrevDecl)) && "Received TagDecl when not in C++!"); if (!isa<TagDecl>(PrevDecl) && isDeclInScope(PrevDecl, CurContext, S)) { if (isa<EnumConstantDecl>(PrevDecl)) @@ -10162,13 +10162,13 @@ void Sema::ActOnEnumBody(SourceLocation EnumLoc, SourceLocation LBraceLoc, BestType = Context.UnsignedIntTy; BestWidth = IntWidth; BestPromotionType - = (NumPositiveBits == BestWidth || !getLangOptions().CPlusPlus) + = (NumPositiveBits == BestWidth || !getLangOpts().CPlusPlus) ? Context.UnsignedIntTy : Context.IntTy; } else if (NumPositiveBits <= (BestWidth = Context.getTargetInfo().getLongWidth())) { BestType = Context.UnsignedLongTy; BestPromotionType - = (NumPositiveBits == BestWidth || !getLangOptions().CPlusPlus) + = (NumPositiveBits == BestWidth || !getLangOpts().CPlusPlus) ? Context.UnsignedLongTy : Context.LongTy; } else { BestWidth = Context.getTargetInfo().getLongLongWidth(); @@ -10176,7 +10176,7 @@ void Sema::ActOnEnumBody(SourceLocation EnumLoc, SourceLocation LBraceLoc, "How could an initializer get larger than ULL?"); BestType = Context.UnsignedLongLongTy; BestPromotionType - = (NumPositiveBits == BestWidth || !getLangOptions().CPlusPlus) + = (NumPositiveBits == BestWidth || !getLangOpts().CPlusPlus) ? Context.UnsignedLongLongTy : Context.LongLongTy; } } @@ -10201,7 +10201,7 @@ void Sema::ActOnEnumBody(SourceLocation EnumLoc, SourceLocation LBraceLoc, QualType NewTy; unsigned NewWidth; bool NewSign; - if (!getLangOptions().CPlusPlus && + if (!getLangOpts().CPlusPlus && !Enum->isFixed() && isRepresentableIntegerValue(Context, InitVal, Context.IntTy)) { NewTy = Context.IntTy; @@ -10209,7 +10209,7 @@ void Sema::ActOnEnumBody(SourceLocation EnumLoc, SourceLocation LBraceLoc, NewSign = true; } else if (ECD->getType() == BestType) { // Already the right type! - if (getLangOptions().CPlusPlus) + if (getLangOpts().CPlusPlus) // C++ [dcl.enum]p4: Following the closing brace of an // enum-specifier, each enumerator has the type of its // enumeration. @@ -10234,7 +10234,7 @@ void Sema::ActOnEnumBody(SourceLocation EnumLoc, SourceLocation LBraceLoc, ECD->getInitExpr(), /*base paths*/ 0, VK_RValue)); - if (getLangOptions().CPlusPlus) + if (getLangOpts().CPlusPlus) // C++ [dcl.enum]p4: Following the closing brace of an // enum-specifier, each enumerator has the type of its // enumeration. diff --git a/lib/Sema/SemaDeclAttr.cpp b/lib/Sema/SemaDeclAttr.cpp index 23abefe6bf..b288559cdd 100644 --- a/lib/Sema/SemaDeclAttr.cpp +++ b/lib/Sema/SemaDeclAttr.cpp @@ -2286,7 +2286,7 @@ static FormatAttrKind getFormatAttrKind(StringRef Format) { /// http://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Attributes.html static void handleInitPriorityAttr(Sema &S, Decl *D, const AttributeList &Attr) { - if (!S.getLangOptions().CPlusPlus) { + if (!S.getLangOpts().CPlusPlus) { S.Diag(Attr.getLoc(), diag::warn_attribute_ignored) << Attr.getName(); return; } @@ -3259,7 +3259,7 @@ static void handleNSReturnsRetainedAttr(Sema &S, Decl *D, returnType = MD->getResultType(); else if (ObjCPropertyDecl *PD = dyn_cast<ObjCPropertyDecl>(D)) returnType = PD->getType(); - else if (S.getLangOptions().ObjCAutoRefCount && hasDeclarator(D) && + else if (S.getLangOpts().ObjCAutoRefCount && hasDeclarator(D) && (Attr.getKind() == AttributeList::AT_ns_returns_retained)) return; // ignore: was handled as a type attribute else if (FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) @@ -3398,7 +3398,7 @@ static void handleNSBridgedAttr(Sema &S, Scope *Sc, Decl *D, // In Objective-C, verify that the type names an Objective-C type. // We don't want to check this outside of ObjC because people sometimes // do crazy C declarations of Objective-C types. - if (ParmName && S.getLangOptions().ObjC1) { + if (ParmName && S.getLangOpts().ObjC1) { // Check for an existing type with this name. LookupResult R(S, DeclarationName(ParmName), Attr.getParameterLoc(), Sema::LookupOrdinaryName); @@ -4004,7 +4004,7 @@ static void handleDelayedForbiddenType(Sema &S, DelayedDiagnostic &diag, "this system declaration uses an unsupported type")); return; } - if (S.getLangOptions().ObjCAutoRefCount) + if (S.getLangOpts().ObjCAutoRefCount) if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(decl)) { // FIXME. we may want to supress diagnostics for all // kind of forbidden type messages on unavailable functions. diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp index 29df5c12a6..abbbe11561 100644 --- a/lib/Sema/SemaDeclCXX.cpp +++ b/lib/Sema/SemaDeclCXX.cpp @@ -280,7 +280,7 @@ Sema::ActOnParamDefaultArgument(Decl *param, SourceLocation EqualLoc, UnparsedDefaultArgLocs.erase(Param); // Default arguments are only permitted in C++ - if (!getLangOptions().CPlusPlus) { + if (!getLangOpts().CPlusPlus) { Diag(EqualLoc, diag::err_param_default_argument) << DefaultArg->getSourceRange(); Param->setInvalidDecl(); @@ -405,7 +405,7 @@ bool Sema::MergeCXXFunctionDecl(FunctionDecl *New, FunctionDecl *Old) { // MSVC accepts that default parameters be redefined for member functions // of template class. The new default parameter's value is ignored. Invalid = true; - if (getLangOptions().MicrosoftExt) { + if (getLangOpts().MicrosoftExt) { CXXMethodDecl* MD = dyn_cast<CXXMethodDecl>(New); if (MD && MD->getParent()->getDescribedClassTemplate()) { // Merge the old default argument into the new parameter. @@ -538,7 +538,7 @@ bool Sema::MergeCXXFunctionDecl(FunctionDecl *New, FunctionDecl *Old) { /// validates compatibility and merges the specs if necessary. void Sema::MergeVarDeclExceptionSpecs(VarDecl *New, VarDecl *Old) { // Shortcut if exceptions are disabled. - if (!getLangOptions().CXXExceptions) + if (!getLangOpts().CXXExceptions) return; assert(Context.hasSameType(New->getType(), Old->getType()) && @@ -974,7 +974,7 @@ bool Sema::CheckConstexprFunctionBody(const FunctionDecl *Dcl, Stmt *Body) { /// the innermost class. bool Sema::isCurrentClassName(const IdentifierInfo &II, Scope *, const CXXScopeSpec *SS) { - assert(getLangOptions().CPlusPlus && "No class names in C!"); + assert(getLangOpts().CPlusPlus && "No class names in C!"); CXXRecordDecl *CurDecl; if (SS && SS->isSet() && !SS->isInvalid()) { @@ -1191,7 +1191,7 @@ static CXXRecordDecl *GetClassForType(QualType T) { /// \brief Determine whether the type \p Derived is a C++ class that is /// derived from the type \p Base. bool Sema::IsDerivedFrom(QualType Derived, QualType Base) { - if (!getLangOptions().CPlusPlus) + if (!getLangOpts().CPlusPlus) return false; CXXRecordDecl *DerivedRD = GetClassForType(Derived); @@ -1209,7 +1209,7 @@ bool Sema::IsDerivedFrom(QualType Derived, QualType Base) { /// \brief Determine whether the type \p Derived is a C++ class that is /// derived from the type \p Base. bool Sema::IsDerivedFrom(QualType Derived, QualType Base, CXXBasePaths &Paths) { - if (!getLangOptions().CPlusPlus) + if (!getLangOpts().CPlusPlus) return false; CXXRecordDecl *DerivedRD = GetClassForType(Derived); @@ -1879,8 +1879,8 @@ Sema::BuildMemInitializer(Decl *ConstructorD, if (R.empty() && BaseType.isNull() && (Corr = CorrectTypo(R.getLookupNameInfo(), R.getLookupKind(), S, &SS, Validator, ClassDecl))) { - std::string CorrectedStr(Corr.getAsString(getLangOptions())); - std::string CorrectedQuotedStr(Corr.getQuoted(getLangOptions())); + std::string CorrectedStr(Corr.getAsString(getLangOpts())); + std::string CorrectedQuotedStr(Corr.getQuoted(getLangOpts())); if (FieldDecl *Member = Corr.getCorrectionDeclAs<FieldDecl>()) { // We have found a non-static data member with a similar // name to what was typed; complain and initialize that @@ -2677,7 +2677,7 @@ BuildImplicitMemberInitializer(Sema &SemaRef, CXXConstructorDecl *Constructor, } } - if (SemaRef.getLangOptions().ObjCAutoRefCount && + if (SemaRef.getLangOpts().ObjCAutoRefCount && FieldBaseElementType->isObjCRetainableType() && FieldBaseElementType.getObjCLifetime() != Qualifiers::OCL_None && FieldBaseElementType.getObjCLifetime() != Qualifiers::OCL_ExplicitNone) { @@ -3390,7 +3390,7 @@ bool Sema::RequireNonAbstractType(SourceLocation Loc, QualType T, bool Sema::RequireNonAbstractType(SourceLocation Loc, QualType T, const PartialDiagnostic &PD) { - if (!getLangOptions().CPlusPlus) + if (!getLangOpts().CPlusPlus) return false; if (const ArrayType *AT = Context.getAsArrayType(T)) @@ -4808,7 +4808,7 @@ void Sema::AddImplicitlyDeclaredMembersToClass(CXXRecordDecl *ClassDecl) { if (!ClassDecl->hasUserDeclaredCopyConstructor()) ++ASTContext::NumImplicitCopyConstructors; - if (getLangOptions().CPlusPlus0x && ClassDecl->needsImplicitMoveConstructor()) + if (getLangOpts().CPlusPlus0x && ClassDecl->needsImplicitMoveConstructor()) ++ASTContext::NumImplicitMoveConstructors; if (!ClassDecl->hasUserDeclaredCopyAssignment()) { @@ -4822,7 +4822,7 @@ void Sema::AddImplicitlyDeclaredMembersToClass(CXXRecordDecl *ClassDecl) { DeclareImplicitCopyAssignment(ClassDecl); } - if (getLangOptions().CPlusPlus0x && ClassDecl->needsImplicitMoveAssignment()){ + if (getLangOpts().CPlusPlus0x && ClassDecl->needsImplicitMoveAssignment()){ ++ASTContext::NumImplicitMoveAssignmentOperators; // Likewise for the move assignment operator. @@ -5287,7 +5287,7 @@ void Sema::CheckConversionDeclarator(Declarator &D, QualType &R, // C++0x explicit conversion operators. if (D.getDeclSpec().isExplicitSpecified()) Diag(D.getDeclSpec().getExplicitSpecLoc(), - getLangOptions().CPlusPlus0x ? + getLangOpts().CPlusPlus0x ? diag::warn_cxx98_compat_explicit_conversion_functions : diag::ext_explicit_conversion_functions) << SourceRange(D.getDeclSpec().getExplicitSpecLoc()); @@ -5565,7 +5565,7 @@ NamespaceDecl *Sema::getOrCreateStdNamespace() { } bool Sema::isStdInitializerList(QualType Ty, QualType *Element) { - assert(getLangOptions().CPlusPlus && + assert(getLangOpts().CPlusPlus && "Looking for std::initializer_list outside of C++."); // We're looking for implicit instantiations of @@ -5727,8 +5727,8 @@ static bool TryNamespaceTypoCorrection(Sema &S, LookupResult &R, Scope *Sc, if (TypoCorrection Corrected = S.CorrectTypo(R.getLookupNameInfo(), R.getLookupKind(), Sc, &SS, Validator)) { - std::string CorrectedStr(Corrected.getAsString(S.getLangOptions())); - std::string CorrectedQuotedStr(Corrected.getQuoted(S.getLangOptions())); + std::string CorrectedStr(Corrected.getAsString(S.getLangOpts())); + std::string CorrectedQuotedStr(Corrected.getQuoted(S.getLangOpts())); if (DeclContext *DC = S.computeDeclContext(SS, false)) S.Diag(IdentLoc, diag::err_using_directive_member_suggest) << Ident << DC << CorrectedQuotedStr << SS.getRange() @@ -5864,12 +5864,12 @@ Decl *Sema::ActOnUsingDeclaration(Scope *S, case UnqualifiedId::IK_ConstructorTemplateId: // C++0x inherited constructors. Diag(Name.getLocStart(), - getLangOptions().CPlusPlus0x ? + getLangOpts().CPlusPlus0x ? diag::warn_cxx98_compat_using_decl_constructor : diag::err_using_decl_constructor) << SS.getRange(); - if (getLangOptions().CPlusPlus0x) break; + if (getLangOpts().CPlusPlus0x) break; return 0; @@ -5959,7 +5959,7 @@ bool Sema::CheckUsingShadowDecl(UsingDecl *Using, NamedDecl *Orig, // specialization. The UsingShadowDecl in D<T> then points directly // to A::foo, which will look well-formed when we instantiate. // The right solution is to not collapse the shadow-decl chain. - if (!getLangOptions().CPlusPlus0x && CurContext->isRecord()) { + if (!getLangOpts().CPlusPlus0x && CurContext->isRecord()) { DeclContext *OrigDC = Orig->getDeclContext(); // Handle enums and anonymous structs. @@ -6441,7 +6441,7 @@ bool Sema::CheckUsingDeclQualifier(SourceLocation UsingLoc, RequireCompleteDeclContext(const_cast<CXXScopeSpec&>(SS), NamedContext)) return true; - if (getLangOptions().CPlusPlus0x) { + if (getLangOpts().CPlusPlus0x) { // C++0x [namespace.udecl]p3: // In a using-declaration used as a member-declaration, the // nested-name-specifier shall name a base class of the class @@ -6836,7 +6836,7 @@ CXXConstructorDecl *Sema::DeclareImplicitDefaultConstructor( Context.getFunctionType(Context.VoidTy, 0, 0, EPI), /*TInfo=*/0, /*isExplicit=*/false, /*isInline=*/true, /*isImplicitlyDeclared=*/true, /*isConstexpr=*/ClassDecl->defaultedDefaultConstructorIsConstexpr() && - getLangOptions().CPlusPlus0x); + getLangOpts().CPlusPlus0x); DefaultCon->setAccess(AS_public); DefaultCon->setDefaulted(); DefaultCon->setImplicit(); @@ -7649,7 +7649,7 @@ CXXMethodDecl *Sema::DeclareImplicitCopyAssignment(CXXRecordDecl *ClassDecl) { // there is no user-declared move assignment operator, a copy assignment // operator is implicitly declared as defaulted. if ((ClassDecl->hasUserDeclaredMoveConstructor() && - !getLangOptions().MicrosoftMode) || + !getLangOpts().MicrosoftMode) || ClassDecl->hasUserDeclaredMoveAssignment() || ShouldDeleteSpecialMember(CopyAssignment, CXXCopyAssignment)) CopyAssignment->setDeletedAsWritten(); @@ -8541,7 +8541,7 @@ CXXConstructorDecl *Sema::DeclareImplicitCopyConstructor( Context.getFunctionType(Context.VoidTy, &ArgType, 1, EPI), /*TInfo=*/0, /*isExplicit=*/false, /*isInline=*/true, /*isImplicitlyDeclared=*/true, /*isConstexpr=*/ClassDecl->defaultedCopyConstructorIsConstexpr() && - getLangOptions().CPlusPlus0x); + getLangOpts().CPlusPlus0x); CopyConstructor->setAccess(AS_public); CopyConstructor->setDefaulted(); CopyConstructor->setTrivial(ClassDecl->hasTrivialCopyConstructor()); @@ -8569,7 +8569,7 @@ CXXConstructorDecl *Sema::DeclareImplicitCopyConstructor( // declared as defaulted. if (ClassDecl->hasUserDeclaredMoveConstructor() || (ClassDecl->hasUserDeclaredMoveAssignment() && - !getLangOptions().MicrosoftMode) || + !getLangOpts().MicrosoftMode) || ShouldDeleteSpecialMember(CopyConstructor, CXXCopyConstructor)) CopyConstructor->setDeletedAsWritten(); @@ -8696,7 +8696,7 @@ CXXConstructorDecl *Sema::DeclareImplicitMoveConstructor( Context.getFunctionType(Context.VoidTy, &ArgType, 1, EPI), /*TInfo=*/0, /*isExplicit=*/false, /*isInline=*/true, /*isImplicitlyDeclared=*/true, /*isConstexpr=*/ClassDecl->defaultedMoveConstructorIsConstexpr() && - getLangOptions().CPlusPlus0x); + getLangOpts().CPlusPlus0x); MoveConstructor->setAccess(AS_public); MoveConstructor->setDefaulted(); MoveConstructor->setTrivial(ClassDecl->hasTrivialMoveConstructor()); @@ -8844,7 +8844,7 @@ void Sema::DefineImplicitLambdaToBlockPointerConversion( // behavior. Note that only the general conversion function does this // (since it's unusable otherwise); in the case where we inline the // block literal, it has block literal lifetime semantics. - if (!BuildBlock.isInvalid() && !getLangOptions().ObjCAutoRefCount) + if (!BuildBlock.isInvalid() && !getLangOpts().ObjCAutoRefCount) BuildBlock = ImplicitCastExpr::Create(Context, BuildBlock.get()->getType(), CK_CopyAndAutoreleaseBlockObject, BuildBlock.get(), 0, VK_RValue); @@ -9528,7 +9528,7 @@ VarDecl *Sema::BuildExceptionDeclaration(Scope *S, // Only the non-fragile NeXT runtime currently supports C++ catches // of ObjC types, and no runtime supports catching ObjC types by value. - if (!Invalid && getLangOptions().ObjC1) { + if (!Invalid && getLangOpts().ObjC1) { QualType T = ExDeclType; if (const ReferenceType *RT = T->getAs<ReferenceType>()) T = RT->getPointeeType(); @@ -9537,7 +9537,7 @@ VarDecl *Sema::BuildExceptionDeclaration(Scope *S, Diag(Loc, diag::err_objc_object_catch); Invalid = true; } else if (T->isObjCObjectPointerType()) { - if (!getLangOptions().ObjCNonFragileABI) + if (!getLangOpts().ObjCNonFragileABI) Diag(Loc, diag::warn_objc_pointer_cxx_catch_fragile); } } @@ -9547,7 +9547,7 @@ VarDecl *Sema::BuildExceptionDeclaration(Scope *S, ExDecl->setExceptionVariable(true); // In ARC, infer 'retaining' for variables of retainable type. - if (getLangOptions().ObjCAutoRefCount && inferObjCARCLifetime(ExDecl)) + if (getLangOpts().ObjCAutoRefCount && inferObjCARCLifetime(ExDecl)) Invalid = true; if (!Invalid && !ExDeclType->isDependentType()) { @@ -9714,7 +9714,7 @@ FriendDecl *Sema::CheckFriendTypeDecl(SourceLocation Loc, std::string InsertionText = std::string(" ") + RD->getKindName(); Diag(TypeRange.getBegin(), - getLangOptions().CPlusPlus0x ? + getLangOpts().CPlusPlus0x ? diag::warn_cxx98_compat_unelaborated_friend_type : diag::ext_unelaborated_friend_type) << (unsigned) RD->getTagKind() @@ -9723,7 +9723,7 @@ FriendDecl *Sema::CheckFriendTypeDecl(SourceLocation Loc, InsertionText); } else { Diag(FriendLoc, - getLangOptions().CPlusPlus0x ? + getLangOpts().CPlusPlus0x ? diag::warn_cxx98_compat_nonclass_type_friend : diag::ext_nonclass_type_friend) << T @@ -9731,7 +9731,7 @@ FriendDecl *Sema::CheckFriendTypeDecl(SourceLocation Loc, } } else if (T->getAs<EnumType>()) { Diag(FriendLoc, - getLangOptions().CPlusPlus0x ? + getLangOpts().CPlusPlus0x ? diag::warn_cxx98_compat_enum_friend : diag::ext_enum_friend) << T @@ -10073,7 +10073,7 @@ Decl *Sema::ActOnFriendFunctionDecl(Scope *S, Declarator &D, // we do, too. if (!Previous.empty() && DC->Equals(CurContext)) Diag(DS.getFriendSpecLoc(), - getLangOptions().CPlusPlus0x ? + getLangOpts().CPlusPlus0x ? diag::warn_cxx98_compat_friend_is_member : diag::err_friend_is_member); @@ -10121,7 +10121,7 @@ Decl *Sema::ActOnFriendFunctionDecl(Scope *S, Declarator &D, // class that is not a member of the class . . . if (DC->Equals(CurContext)) Diag(DS.getFriendSpecLoc(), - getLangOptions().CPlusPlus0x ? + getLangOpts().CPlusPlus0x ? diag::warn_cxx98_compat_friend_is_member : diag::err_friend_is_member); @@ -10732,7 +10732,7 @@ void Sema::MarkVirtualMembersReferenced(SourceLocation Loc, /// SetIvarInitializers - This routine builds initialization ASTs for the /// Objective-C implementation whose ivars need be initialized. void Sema::SetIvarInitializers(ObjCImplementationDecl *ObjCImplementation) { - if (!getLangOptions().CPlusPlus) + if (!getLangOpts().CPlusPlus) return; if (ObjCInterfaceDecl *OID = ObjCImplementation->getClassInterface()) { SmallVector<ObjCIvarDecl*, 8> ivars; diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp index 4df5ab3916..285ef015d7 100644 --- a/lib/Sema/SemaDeclObjC.cpp +++ b/lib/Sema/SemaDeclObjC.cpp @@ -157,7 +157,7 @@ void Sema::CheckObjCMethodOverride(ObjCMethodDecl *NewMethod, Diag(Overridden->getLocation(), diag::note_related_result_type_overridden); } - if (getLangOptions().ObjCAutoRefCount) { + if (getLangOpts().ObjCAutoRefCount) { if ((NewMethod->hasAttr<NSReturnsRetainedAttr>() != Overridden->hasAttr<NSReturnsRetainedAttr>())) { Diag(NewMethod->getLocation(), @@ -299,7 +299,7 @@ void Sema::ActOnStartOfObjCMethodDef(Scope *FnBodyScope, Decl *D) { } // In ARC, disallow definition of retain/release/autorelease/retainCount - if (getLangOptions().ObjCAutoRefCount) { + if (getLangOpts().ObjCAutoRefCount) { switch (MDecl->getMethodFamily()) { case OMF_retain: case OMF_retainCount: @@ -338,11 +338,11 @@ void Sema::ActOnStartOfObjCMethodDef(Scope *FnBodyScope, Decl *D) { // Only do this if the current class actually has a superclass. if (IC->getSuperClass()) { ObjCShouldCallSuperDealloc = - !(Context.getLangOptions().ObjCAutoRefCount || - Context.getLangOptions().getGC() == LangOptions::GCOnly) && + !(Context.getLangOpts().ObjCAutoRefCount || + Context.getLangOpts().getGC() == LangOptions::GCOnly) && MDecl->getMethodFamily() == OMF_dealloc; ObjCShouldCallSuperFinalize = - Context.getLangOptions().getGC() != LangOptions::NonGC && + Context.getLangOpts().getGC() != LangOptions::NonGC && MDecl->getMethodFamily() == OMF_finalize; } } @@ -1386,7 +1386,7 @@ static bool checkMethodFamilyMismatch(Sema &S, ObjCMethodDecl *impl, void Sema::WarnConflictingTypedMethods(ObjCMethodDecl *ImpMethodDecl, ObjCMethodDecl *MethodDecl, bool IsProtocolMethodDecl) { - if (getLangOptions().ObjCAutoRefCount && + if (getLangOpts().ObjCAutoRefCount && checkMethodFamilyMismatch(*this, ImpMethodDecl, MethodDecl)) return; @@ -1493,7 +1493,7 @@ void Sema::CheckProtocolMethodDefs(SourceLocation ImpLoc, ObjCInterfaceDecl *Super = IDecl->getSuperClass(); ObjCInterfaceDecl *NSIDecl = 0; - if (getLangOptions().NeXTRuntime) { + if (getLangOpts().NeXTRuntime) { // check to see if class implements forwardInvocation method and objects // of this class are derived from 'NSProxy' so that to forward requests // from one object to another. @@ -1942,7 +1942,7 @@ bool Sema::MatchTwoMethodDeclarations(const ObjCMethodDecl *left, left->getResultType(), right->getResultType())) return false; - if (getLangOptions().ObjCAutoRefCount && + if (getLangOpts().ObjCAutoRefCount && (left->hasAttr<NSReturnsRetainedAttr>() != right->hasAttr<NSReturnsRetainedAttr>() || left->hasAttr<NSConsumesSelfAttr>() @@ -1959,7 +1959,7 @@ bool Sema::MatchTwoMethodDeclarations(const ObjCMethodDecl *left, if (!matchTypes(Context, strategy, lparm->getType(), rparm->getType())) return false; - if (getLangOptions().ObjCAutoRefCount && + if (getLangOpts().ObjCAutoRefCount && lparm->hasAttr<NSConsumedAttr>() != rparm->hasAttr<NSConsumedAttr>()) return false; } @@ -2086,14 +2086,14 @@ ObjCMethodDecl *Sema::LookupMethodInGlobalPool(Selector Sel, SourceRange R, // differences. In ARC, however, we also need to check for loose // mismatches, because most of them are errors. if (!strictSelectorMatch || - (issueDiagnostic && getLangOptions().ObjCAutoRefCount)) + (issueDiagnostic && getLangOpts().ObjCAutoRefCount)) for (ObjCMethodList *Next = MethList.Next; Next; Next = Next->Next) { // This checks if the methods differ in type mismatch. if (!MatchTwoMethodDeclarations(MethList.Method, Next->Method, MMS_loose) && !isAcceptableMethodMismatch(MethList.Method, Next->Method)) { issueDiagnostic = true; - if (getLangOptions().ObjCAutoRefCount) + if (getLangOpts().ObjCAutoRefCount) issueError = true; break; } @@ -2856,7 +2856,7 @@ Decl *Sema::ActOnMethodDeclaration( } bool ARCError = false; - if (getLangOptions().ObjCAutoRefCount) + if (getLangOpts().ObjCAutoRefCount) ARCError = CheckARCMethodDecl(*this, ObjCMethod); // Infer the related result type when possible. @@ -2945,7 +2945,7 @@ void Sema::ActOnDefs(Scope *S, Decl *TagD, SourceLocation DeclStart, for (SmallVectorImpl<Decl*>::iterator D = Decls.begin(); D != Decls.end(); ++D) { FieldDecl *FD = cast<FieldDecl>(*D); - if (getLangOptions().CPlusPlus) + if (getLangOpts().CPlusPlus) PushOnScopeChains(cast<FieldDecl>(FD), S); else if (RecordDecl *Record = dyn_cast<RecordDecl>(TagD)) Record->addDecl(FD); @@ -2986,7 +2986,7 @@ VarDecl *Sema::BuildObjCExceptionDecl(TypeSourceInfo *TInfo, QualType T, New->setExceptionVariable(true); // In ARC, infer 'retaining' for variables of retainable type. - if (getLangOptions().ObjCAutoRefCount && inferObjCARCLifetime(New)) + if (getLangOpts().ObjCAutoRefCount && inferObjCARCLifetime(New)) Invalid = true; if (Invalid) @@ -3014,7 +3014,7 @@ Decl *Sema::ActOnObjCExceptionDecl(Scope *S, Declarator &D) { // Check that there are no default arguments inside the type of this // exception object (C++ only). - if (getLangOptions().CPlusPlus) + if (getLangOpts().CPlusPlus) CheckExtraCXXDefaultArguments(D); TypeSourceInfo *TInfo = GetTypeForDeclarator(D, S); diff --git a/lib/Sema/SemaExceptionSpec.cpp b/lib/Sema/SemaExceptionSpec.cpp index 8b6fcaa2b8..42221f8df4 100644 --- a/lib/Sema/SemaExceptionSpec.cpp +++ b/lib/Sema/SemaExceptionSpec.cpp @@ -102,7 +102,7 @@ bool Sema::CheckEquivalentExceptionSpec(FunctionDecl *Old, FunctionDecl *New) { bool MissingExceptionSpecification = false; bool MissingEmptyExceptionSpecification = false; unsigned DiagID = diag::err_mismatched_exception_spec; - if (getLangOptions().MicrosoftExt) + if (getLangOpts().MicrosoftExt) DiagID = diag::warn_mismatched_exception_spec; if (!CheckEquivalentExceptionSpec(PDiag(DiagID), @@ -171,7 +171,7 @@ bool Sema::CheckEquivalentExceptionSpec(FunctionDecl *Old, FunctionDecl *New) { // If exceptions are disabled, suppress the warning about missing // exception specifications for new and delete operators. - if (!getLangOptions().CXXExceptions) { + if (!getLangOpts().CXXExceptions) { switch (New->getDeclName().getCXXOverloadedOperator()) { case OO_New: case OO_Array_New: @@ -265,7 +265,7 @@ bool Sema::CheckEquivalentExceptionSpec( const FunctionProtoType *Old, SourceLocation OldLoc, const FunctionProtoType *New, SourceLocation NewLoc) { unsigned DiagID = diag::err_mismatched_exception_spec; - if (getLangOptions().MicrosoftExt) + if (getLangOpts().MicrosoftExt) DiagID = diag::warn_mismatched_exception_spec; return CheckEquivalentExceptionSpec( PDiag(DiagID), @@ -286,7 +286,7 @@ bool Sema::CheckEquivalentExceptionSpec(const PartialDiagnostic &DiagID, bool AllowNoexceptAllMatchWithNoSpec, bool IsOperatorNew) { // Just completely ignore this under -fno-exceptions. - if (!getLangOptions().CXXExceptions) + if (!getLangOpts().CXXExceptions) return false; if (MissingExceptionSpecification) @@ -380,7 +380,7 @@ bool Sema::CheckEquivalentExceptionSpec(const PartialDiagnostic &DiagID, // As a special compatibility feature, under C++0x we accept no spec and // throw(std::bad_alloc) as equivalent for operator new and operator new[]. // This is because the implicit declaration changed, but old code would break. - if (getLangOptions().CPlusPlus0x && IsOperatorNew) { + if (getLangOpts().CPlusPlus0x && IsOperatorNew) { const FunctionProtoType *WithExceptions = 0; if (OldEST == EST_None && NewEST == EST_Dynamic) WithExceptions = New; @@ -474,7 +474,7 @@ bool Sema::CheckExceptionSpecSubset( const FunctionProtoType *Subset, SourceLocation SubLoc) { // Just auto-succeed under -fno-exceptions. - if (!getLangOptions().CXXExceptions) + if (!getLangOpts().CXXExceptions) return false; // FIXME: As usual, we could be more specific in our error messages, but @@ -702,7 +702,7 @@ bool Sema::CheckExceptionSpecCompatibility(Expr *From, QualType ToType) bool Sema::CheckOverridingFunctionExceptionSpec(const CXXMethodDecl *New, const CXXMethodDecl *Old) { - if (getLangOptions().CPlusPlus0x && isa<CXXDestructorDecl>(New)) { + if (getLangOpts().CPlusPlus0x && isa<CXXDestructorDecl>(New)) { // Don't check uninstantiated template destructors at all. We can only // synthesize correct specs after the template is instantiated. if (New->getParent()->isDependentType()) @@ -716,7 +716,7 @@ bool Sema::CheckOverridingFunctionExceptionSpec(const CXXMethodDecl *New, } } unsigned DiagID = diag::err_override_exception_spec; - if (getLangOptions().MicrosoftExt) + if (getLangOpts().MicrosoftExt) DiagID = diag::warn_override_exception_spec; return CheckExceptionSpecSubset(PDiag(DiagID), PDiag(diag::note_overridden_virtual_function), diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index a57e2ac9b2..8aac35ee69 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -122,7 +122,7 @@ static AvailabilityResult DiagnoseAvailabilityOfDecl(Sema &S, /// bool Sema::DiagnoseUseOfDecl(NamedDecl *D, SourceLocation Loc, const ObjCInterfaceDecl *UnknownObjCClass) { - if (getLangOptions().CPlusPlus && isa<FunctionDecl>(D)) { + if (getLangOpts().CPlusPlus && isa<FunctionDecl>(D)) { // If there were any diagnostics suppressed by template argument deduction, // emit them now. llvm::DenseMap<Decl *, SmallVector<PartialDiagnosticAt, 1> >::iterator @@ -310,7 +310,7 @@ ExprResult Sema::DefaultFunctionArrayConversion(Expr *E) { // An lvalue or rvalue of type "array of N T" or "array of unknown bound of // T" can be converted to an rvalue of type "pointer to T". // - if (getLangOptions().C99 || getLangOptions().CPlusPlus || E->isLValue()) + if (getLangOpts().C99 || getLangOpts().CPlusPlus || E->isLValue()) E = ImpCastExprToType(E, Context.getArrayDecayedType(Ty), CK_ArrayToPointerDecay).take(); } @@ -358,7 +358,7 @@ ExprResult Sema::DefaultLvalueConversion(Expr *E) { // We don't want to throw lvalue-to-rvalue casts on top of // expressions of certain types in C++. - if (getLangOptions().CPlusPlus && + if (getLangOpts().CPlusPlus && (E->getType() == Context.OverloadTy || T->isDependentType() || T->isRecordType())) @@ -483,7 +483,7 @@ ExprResult Sema::DefaultArgumentPromotion(Expr *E) { // is a prvalue for the temporary. // FIXME: add some way to gate this entire thing for correctness in // potentially potentially evaluated contexts. - if (getLangOptions().CPlusPlus && E->isGLValue() && + if (getLangOpts().CPlusPlus && E->isGLValue() && ExprEvalContexts.back().Context != Unevaluated) { ExprResult Temp = PerformCopyInitialization( InitializedEntity::InitializeTemporary(E->getType()), @@ -540,7 +540,7 @@ ExprResult Sema::DefaultVariadicArgumentPromotion(Expr *E, VariadicCallType CT, // or a non-trivial destructor, with no corresponding parameter, // is conditionally-supported with implementation-defined semantics. bool TrivialEnough = false; - if (getLangOptions().CPlusPlus0x && !E->getType()->isDependentType()) { + if (getLangOpts().CPlusPlus0x && !E->getType()->isDependentType()) { if (CXXRecordDecl *Record = E->getType()->getAsCXXRecordDecl()) { if (Record->hasTrivialCopyConstructor() && Record->hasTrivialMoveConstructor() && @@ -554,7 +554,7 @@ ExprResult Sema::DefaultVariadicArgumentPromotion(Expr *E, VariadicCallType CT, } if (!TrivialEnough && - getLangOptions().ObjCAutoRefCount && + getLangOpts().ObjCAutoRefCount && E->getType()->isObjCLifetimeType()) TrivialEnough = true; @@ -562,7 +562,7 @@ ExprResult Sema::DefaultVariadicArgumentPromotion(Expr *E, VariadicCallType CT, // Nothing to diagnose. This is okay. } else if (DiagRuntimeBehavior(E->getLocStart(), 0, PDiag(diag::warn_cannot_pass_non_pod_arg_to_vararg) - << getLangOptions().CPlusPlus0x << E->getType() + << getLangOpts().CPlusPlus0x << E->getType() << CT)) { // Turn this into a trap. CXXScopeSpec SS; @@ -588,7 +588,7 @@ ExprResult Sema::DefaultVariadicArgumentPromotion(Expr *E, VariadicCallType CT, } } // c++ rules are enforced elsewhere. - if (!getLangOptions().CPlusPlus && + if (!getLangOpts().CPlusPlus && RequireCompleteType(E->getExprLoc(), E->getType(), diag::err_call_incomplete_argument)) return ExprError(); @@ -1127,7 +1127,7 @@ Sema::CreateGenericSelectionExpr(SourceLocation KeyLoc, static SourceLocation getUDSuffixLoc(Sema &S, SourceLocation TokLoc, unsigned Offset) { return Lexer::AdvanceToTokenCharacter(TokLoc, Offset, S.getSourceManager(), - S.getLangOptions()); + S.getLangOpts()); } /// BuildCookedLiteralOperatorCall - A user-defined literal was found. Look up @@ -1199,7 +1199,7 @@ Sema::ActOnStringLiteral(const Token *StringToks, unsigned NumStringToks, Kind = StringLiteral::UTF32; // A C++ string literal has a const-qualified element type (C++ 2.13.4p1). - if (getLangOptions().CPlusPlus || getLangOptions().ConstStrings) + if (getLangOpts().CPlusPlus || getLangOpts().ConstStrings) StrTy.addConst(); // Get an array type for the string, according to C99 6.4.5. This includes @@ -1252,7 +1252,7 @@ ExprResult Sema::BuildDeclRefExpr(ValueDecl *D, QualType Ty, ExprValueKind VK, const DeclarationNameInfo &NameInfo, const CXXScopeSpec *SS) { - if (getLangOptions().CUDA) + if (getLangOpts().CUDA) if (const FunctionDecl *Caller = dyn_cast<FunctionDecl>(CurContext)) if (const FunctionDecl *Callee = dyn_cast<FunctionDecl>(D)) { CUDAFunctionTarget CallerTarget = IdentifyCUDATarget(Caller), @@ -1373,7 +1373,7 @@ bool Sema::DiagnoseEmptyLookup(Scope *S, CXXScopeSpec &SS, LookupResult &R, CXXMethodDecl *DepMethod = cast_or_null<CXXMethodDecl>( CurMethod->getInstantiatedFromMemberFunction()); if (DepMethod) { - if (getLangOptions().MicrosoftMode) + if (getLangOpts().MicrosoftMode) diagnostic = diag::warn_found_via_dependent_bases_lookup; Diag(R.getNameLoc(), diagnostic) << Name << FixItHint::CreateInsertion(R.getNameLoc(), "this->"); @@ -1401,7 +1401,7 @@ bool Sema::DiagnoseEmptyLookup(Scope *S, CXXScopeSpec &SS, LookupResult &R, Diag(R.getNameLoc(), diagnostic) << Name; } } else { - if (getLangOptions().MicrosoftMode) + if (getLangOpts().MicrosoftMode) diagnostic = diag::warn_found_via_dependent_bases_lookup; Diag(R.getNameLoc(), diagnostic) << Name; } @@ -1430,7 +1430,7 @@ bool Sema::DiagnoseEmptyLookup(Scope *S, CXXScopeSpec &SS, LookupResult &R, // function definition declared at class scope then we must set // DC to the lexical parent to be able to search into the parent // class. - if (getLangOptions().MicrosoftMode && isa<FunctionDecl>(DC) && + if (getLangOpts().MicrosoftMode && isa<FunctionDecl>(DC) && cast<FunctionDecl>(DC)->getFriendObjectKind() && DC->getLexicalParent()->isRecord()) DC = DC->getLexicalParent(); @@ -1442,8 +1442,8 @@ bool Sema::DiagnoseEmptyLookup(Scope *S, CXXScopeSpec &SS, LookupResult &R, TypoCorrection Corrected; if (S && (Corrected = CorrectTypo(R.getLookupNameInfo(), R.getLookupKind(), S, &SS, CCC))) { - std::string CorrectedStr(Corrected.getAsString(getLangOptions())); - std::string CorrectedQuotedStr(Corrected.getQuoted(getLangOptions())); + std::string CorrectedStr(Corrected.getAsString(getLangOpts())); + std::string CorrectedQuotedStr(Corrected.getQuoted(getLangOpts())); R.setLookupName(Corrected.getCorrection()); if (NamedDecl *ND = Corrected.getCorrectionDecl()) { @@ -1636,7 +1636,7 @@ ExprResult Sema::ActOnIdExpression(Scope *S, if (R.empty() && !ADL) { // Otherwise, this could be an implicitly declared function reference (legal // in C90, extension in C99, forbidden in C++). - if (HasTrailingLParen && II && !getLangOptions().CPlusPlus) { + if (HasTrailingLParen && II && !getLangOpts().CPlusPlus) { NamedDecl *D = ImplicitlyDefineFunction(NameLoc, *II, S); if (D) R.addDecl(D); } @@ -1649,7 +1649,7 @@ ExprResult Sema::ActOnIdExpression(Scope *S, // and we can't resolve an identifier then assume the identifier is type // dependent. The goal is to postpone name lookup to instantiation time // to be able to search into type dependent base classes. - if (getLangOptions().MicrosoftMode && CurContext->isDependentContext() && + if (getLangOpts().MicrosoftMode && CurContext->isDependentContext() && isa<CXXMethodDecl>(CurContext)) return ActOnDependentIdExpression(SS, TemplateKWLoc, NameInfo, IsAddressOfOperand, TemplateArgs); @@ -1814,7 +1814,7 @@ Sema::LookupInObjCMethod(LookupResult &Lookup, Scope *S, // Diagnose the use of an ivar outside of the declaring class. if (IV->getAccessControl() == ObjCIvarDecl::Private && !declaresSameEntity(ClassDeclared, IFace) && - !getLangOptions().DebuggerSupport) + !getLangOpts().DebuggerSupport) Diag(Loc, diag::error_private_ivar_access) << IV->getDeclName(); // FIXME: This should use a new expr for a direct reference, don't @@ -1860,7 +1860,7 @@ Sema::LookupInObjCMethod(LookupResult &Lookup, Scope *S, if (Lookup.empty() && II && AllowBuiltinCreation) { // FIXME. Consolidate this with similar code in LookupName. if (unsigned BuiltinID = II->getBuiltinID()) { - if (!(getLangOptions().CPlusPlus && + if (!(getLangOpts().CPlusPlus && Context.BuiltinInfo.isPredefinedLibFunction(BuiltinID))) { NamedDecl *D = LazilyCreateBuiltin((IdentifierInfo *)II, BuiltinID, S, Lookup.isForRedeclaration(), @@ -2052,7 +2052,7 @@ bool Sema::UseArgumentDependentLookup(const CXXScopeSpec &SS, return false; // Only in C++ or ObjC++. - if (!getLangOptions().CPlusPlus) + if (!getLangOpts().CPlusPlus) return false; // Turn off ADL when we find certain kinds of declarations during @@ -2232,7 +2232,7 @@ Sema::BuildDeclarationNameExpr(const CXXScopeSpec &SS, // exist in the high-level semantics. case Decl::Field: case Decl::IndirectField: - assert(getLangOptions().CPlusPlus && + assert(getLangOpts().CPlusPlus && "building reference to field in C?"); // These can't have reference type in well-formed programs, but @@ -2259,7 +2259,7 @@ Sema::BuildDeclarationNameExpr(const CXXScopeSpec &SS, case Decl::Var: // In C, "extern void blah;" is valid and is an r-value. - if (!getLangOptions().CPlusPlus && + if (!getLangOpts().CPlusPlus && !type.hasQualifiers() && type->isVoidType()) { valueKind = VK_RValue; @@ -2297,7 +2297,7 @@ Sema::BuildDeclarationNameExpr(const CXXScopeSpec &SS, } // Functions are l-values in C++. - if (getLangOptions().CPlusPlus) { + if (getLangOpts().CPlusPlus) { valueKind = VK_LValue; break; } @@ -2400,7 +2400,7 @@ ExprResult Sema::ActOnCharacterConstant(const Token &Tok, Scope *UDLScope) { Ty = Context.Char16Ty; // u'x' -> char16_t in C11 and C++11. else if (Literal.isUTF32()) Ty = Context.Char32Ty; // U'x' -> char32_t in C11 and C++11. - else if (!getLangOptions().CPlusPlus || Literal.isMultiChar()) + else if (!getLangOpts().CPlusPlus || Literal.isMultiChar()) Ty = Context.IntTy; // 'x' -> int in C, 'wxyz' -> int in C++. else Ty = Context.CharTy; // 'x' -> char in C++ @@ -2601,9 +2601,9 @@ ExprResult Sema::ActOnNumericConstant(const Token &Tok, Scope *UDLScope) { Res = BuildFloatingLiteral(*this, Literal, Ty, Tok.getLocation()); if (Ty == Context.DoubleTy) { - if (getLangOptions().SinglePrecisionConstants) { + if (getLangOpts().SinglePrecisionConstants) { Res = ImpCastExprToType(Res, Context.FloatTy, CK_FloatingCast).take(); - } else if (getLangOptions().OpenCL && !getOpenCLOptions().cl_khr_fp64) { + } else if (getLangOpts().OpenCL && !getOpenCLOptions().cl_khr_fp64) { Diag(Tok.getLocation(), diag::warn_double_const_requires_fp64); Res = ImpCastExprToType(Res, Context.FloatTy, CK_FloatingCast).take(); } @@ -2614,9 +2614,9 @@ ExprResult Sema::ActOnNumericConstant(const Token &Tok, Scope *UDLScope) { QualType Ty; // long long is a C99 feature. - if (!getLangOptions().C99 && Literal.isLongLong) + if (!getLangOpts().C99 && Literal.isLongLong) Diag(Tok.getLocation(), - getLangOptions().CPlusPlus0x ? + getLangOpts().CPlusPlus0x ? diag::warn_cxx98_compat_longlong : diag::ext_longlong); // Get the value in the widest-possible width. @@ -2678,7 +2678,7 @@ ExprResult Sema::ActOnNumericConstant(const Token &Tok, Scope *UDLScope) { // To be compatible with MSVC, hex integer literals ending with the // LL or i64 suffix are always signed in Microsoft mode. if (!Literal.isUnsigned && (ResultVal[LongLongSize-1] == 0 || - (getLangOptions().MicrosoftExt && Literal.isLongLong))) + (getLangOpts().MicrosoftExt && Literal.isLongLong))) Ty = Context.LongLongTy; else if (AllowUnsigned) Ty = Context.UnsignedLongLongTy; @@ -3058,7 +3058,7 @@ Sema::ActOnArraySubscriptExpr(Scope *S, Expr *Base, SourceLocation LLoc, Expr *LHSExp = Base, *RHSExp = Idx; - if (getLangOptions().CPlusPlus && + if (getLangOpts().CPlusPlus && (LHSExp->isTypeDependent() || RHSExp->isTypeDependent())) { return Owned(new (Context) ArraySubscriptExpr(LHSExp, RHSExp, Context.DependentTy, @@ -3066,7 +3066,7 @@ Sema::ActOnArraySubscriptExpr(Scope *S, Expr *Base, SourceLocation LLoc, RLoc)); } - if (getLangOptions().CPlusPlus && + if (getLangOpts().CPlusPlus && (LHSExp->getType()->isRecordType() || LHSExp->getType()->isEnumeralType() || RHSExp->getType()->isRecordType() || @@ -3193,7 +3193,7 @@ Sema::CreateBuiltinArraySubscriptExpr(Expr *Base, SourceLocation LLoc, return ExprError(); } - if (ResultType->isVoidType() && !getLangOptions().CPlusPlus) { + if (ResultType->isVoidType() && !getLangOpts().CPlusPlus) { // GNU extension: subscripting on pointer to void Diag(LLoc, diag::ext_gnu_subscript_void_type) << BaseExpr->getSourceRange(); @@ -3525,7 +3525,7 @@ Sema::CheckStaticArrayArgument(SourceLocation CallLoc, ParmVarDecl *Param, const Expr *ArgExpr) { // Static array parameters are not supported in C++. - if (!Param || getLangOptions().CPlusPlus) + if (!Param || getLangOpts().CPlusPlus) return; QualType OrigTy = Param->getOriginalType(); @@ -3579,7 +3579,7 @@ Sema::ActOnCallExpr(Scope *S, Expr *Fn, SourceLocation LParenLoc, Expr **Args = ArgExprs.release(); - if (getLangOptions().CPlusPlus) { + if (getLangOpts().CPlusPlus) { // If this is a pseudo-destructor expression, build the call immediately. if (isa<CXXPseudoDestructorExpr>(Fn)) { if (NumArgs > 0) { @@ -3785,7 +3785,7 @@ Sema::BuildResolvedCallExpr(Expr *Fn, NamedDecl *NDecl, << Fn->getType() << Fn->getSourceRange()); } - if (getLangOptions().CUDA) { + if (getLangOpts().CUDA) { if (Config) { // CUDA: Kernel calls must be to global functions if (FDecl && !FDecl->hasAttr<CUDAGlobalAttr>()) @@ -3956,7 +3956,7 @@ Sema::BuildCompoundLiteralExpr(SourceLocation LParenLoc, TypeSourceInfo *TInfo, } // In C, compound literals are l-values for some reason. - ExprValueKind VK = getLangOptions().CPlusPlus ? VK_RValue : VK_LValue; + ExprValueKind VK = getLangOpts().CPlusPlus ? VK_RValue : VK_LValue; return MaybeBindToTemporary( new (Context) CompoundLiteralExpr(LParenLoc, TInfo, literalType, @@ -3998,7 +3998,7 @@ static void maybeExtendBlockObject(Sema &S, ExprResult &E) { assert(E.get()->isRValue()); // Only do this in an r-value context. - if (!S.getLangOptions().ObjCAutoRefCount) return; + if (!S.getLangOpts().ObjCAutoRefCount) return; E = ImplicitCastExpr::Create(S.Context, E.get()->getType(), CK_ARCExtendBlockObject, E.get(), @@ -4221,7 +4221,7 @@ ExprResult Sema::CheckExtVectorCast(SourceRange R, QualType DestTy, // (See OpenCL 6.2). if (SrcTy->isVectorType()) { if (Context.getTypeSize(DestTy) != Context.getTypeSize(SrcTy) - || (getLangOptions().OpenCL && + || (getLangOpts().OpenCL && (DestTy.getCanonicalType() != SrcTy.getCanonicalType()))) { Diag(R.getBegin(),diag::err_invalid_conversion_between_ext_vectors) << DestTy << SrcTy << R; @@ -4261,7 +4261,7 @@ Sema::ActOnCastExpr(Scope *S, SourceLocation LParenLoc, if (D.isInvalidType()) return ExprError(); - if (getLangOptions().CPlusPlus) { + if (getLangOpts().CPlusPlus) { // Check that there are no default arguments (C++ only). CheckExtraCXXDefaultArguments(D); } @@ -4277,7 +4277,7 @@ Sema::ActOnCastExpr(Scope *S, SourceLocation LParenLoc, // i.e. all the elements are integer constants. ParenExpr *PE = dyn_cast<ParenExpr>(CastExpr); ParenListExpr *PLE = dyn_cast<ParenListExpr>(CastExpr); - if ((getLangOptions().AltiVec || getLangOptions().OpenCL) + if ((getLangOpts().AltiVec || getLangOpts().OpenCL) && castType->isVectorType() && (PE || PLE)) { if (PLE && PLE->getNumExprs() == 0) { Diag(PLE->getExprLoc(), diag::err_altivec_empty_initializer); @@ -4362,7 +4362,7 @@ ExprResult Sema::BuildVectorLiteral(SourceLocation LParenLoc, else { // For OpenCL, when the number of initializers is a single value, // it will be replicated to all components of the vector. - if (getLangOptions().OpenCL && + if (getLangOpts().OpenCL && VTy->getVectorKind() == VectorType::GenericVector && numExprs == 1) { QualType ElemTy = Ty->getAs<VectorType>()->getElementType(); @@ -4460,11 +4460,11 @@ static bool checkCondition(Sema &S, Expr *Cond) { if (CondTy->isScalarType()) return false; // OpenCL: Sec 6.3.i says the condition is allowed to be a vector or scalar. - if (S.getLangOptions().OpenCL && CondTy->isVectorType()) + if (S.getLangOpts().OpenCL && CondTy->isVectorType()) return false; // Emit the proper error message. - S.Diag(Cond->getLocStart(), S.getLangOptions().OpenCL ? + S.Diag(Cond->getLocStart(), S.getLangOpts().OpenCL ? diag::err_typecheck_cond_expect_scalar : diag::err_typecheck_cond_expect_scalar_or_vector) << CondTy; @@ -4676,7 +4676,7 @@ QualType Sema::CheckConditionalOperands(ExprResult &Cond, ExprResult &LHS, RHS = move(RHSResult); // C++ is sufficiently different to merit its own checker. - if (getLangOptions().CPlusPlus) + if (getLangOpts().CPlusPlus) return CXXCheckConditionalOperands(Cond, LHS, RHS, VK, OK, QuestionLoc); VK = VK_RValue; @@ -4707,7 +4707,7 @@ QualType Sema::CheckConditionalOperands(ExprResult &Cond, ExprResult &LHS, // OpenCL: If the condition is a vector, and both operands are scalar, // attempt to implicity convert them to the vector type to act like the // built in select. - if (getLangOptions().OpenCL && CondTy->isVectorType()) + if (getLangOpts().OpenCL && CondTy->isVectorType()) if (checkConditionalConvertScalarsToVectors(*this, LHS, RHS, CondTy)) return QualType(); @@ -4882,7 +4882,7 @@ QualType Sema::FindCompositeObjCPointerType(ExprResult &LHS, ExprResult &RHS, } // Check Objective-C object pointer types and 'void *' if (LHSTy->isVoidPointerType() && RHSTy->isObjCObjectPointerType()) { - if (getLangOptions().ObjCAutoRefCount) { + if (getLangOpts().ObjCAutoRefCount) { // ARC forbids the implicit conversion of object pointers to 'void *', // so these types are not compatible. Diag(QuestionLoc, diag::err_cond_voidptr_arc) << LHSTy << RHSTy @@ -4902,7 +4902,7 @@ QualType Sema::FindCompositeObjCPointerType(ExprResult &LHS, ExprResult &RHS, return destType; } if (LHSTy->isObjCObjectPointerType() && RHSTy->isVoidPointerType()) { - if (getLangOptions().ObjCAutoRefCount) { + if (getLangOpts().ObjCAutoRefCount) { // ARC forbids the implicit conversion of object pointers to 'void *', // so these types are not compatible. Diag(QuestionLoc, diag::err_cond_voidptr_arc) << LHSTy << RHSTy @@ -5056,7 +5056,7 @@ ExprResult Sema::ActOnConditionalOp(SourceLocation QuestionLoc, // We usually want to apply unary conversions *before* saving, except // in the special case of a C++ l-value conditional. - if (!(getLangOptions().CPlusPlus + if (!(getLangOpts().CPlusPlus && !commonExpr->isTypeDependent() && commonExpr->getValueKind() == RHSExpr->getValueKind() && commonExpr->isGLValue() @@ -5218,7 +5218,7 @@ checkPointerTypesForAssignment(Sema &S, QualType LHSType, QualType RHSType) { // General pointer incompatibility takes priority over qualifiers. return Sema::IncompatiblePointer; } - if (!S.getLangOptions().CPlusPlus && + if (!S.getLangOpts().CPlusPlus && S.IsNoReturnConversion(ltrans, rtrans, ltrans)) return Sema::IncompatiblePointer; return ConvTy; @@ -5241,7 +5241,7 @@ checkBlockPointerTypesForAssignment(Sema &S, QualType LHSType, rhptee = cast<BlockPointerType>(RHSType)->getPointeeType(); // In C++, the types have to match exactly. - if (S.getLangOptions().CPlusPlus) + if (S.getLangOpts().CPlusPlus) return Sema::IncompatibleBlockPointer; Sema::AssignConvertType ConvTy = Sema::Compatible; @@ -5402,7 +5402,7 @@ Sema::CheckAssignmentConstraints(QualType LHSType, ExprResult &RHS, // If we are allowing lax vector conversions, and LHS and RHS are both // vectors, the total size only needs to be the same. This is a bitcast; // no bits are changed but the result type is different. - if (getLangOptions().LaxVectorConversions && + if (getLangOpts().LaxVectorConversions && (Context.getTypeSize(LHSType) == Context.getTypeSize(RHSType))) { Kind = CK_BitCast; return IncompatibleVectors; @@ -5413,7 +5413,7 @@ Sema::CheckAssignmentConstraints(QualType LHSType, ExprResult &RHS, // Arithmetic conversions. if (LHSType->isArithmeticType() && RHSType->isArithmeticType() && - !(getLangOptions().CPlusPlus && LHSType->isEnumeralType())) { + !(getLangOpts().CPlusPlus && LHSType->isEnumeralType())) { Kind = PrepareScalarCast(RHS, LHSType); return Compatible; } @@ -5479,7 +5479,7 @@ Sema::CheckAssignmentConstraints(QualType LHSType, ExprResult &RHS, } // id -> T^ - if (getLangOptions().ObjC1 && RHSType->isObjCIdType()) { + if (getLangOpts().ObjC1 && RHSType->isObjCIdType()) { Kind = CK_AnyPointerToBlockPointerCast; return Compatible; } @@ -5501,7 +5501,7 @@ Sema::CheckAssignmentConstraints(QualType LHSType, ExprResult &RHS, Kind = CK_BitCast; Sema::AssignConvertType result = checkObjCPointerTypesForAssignment(*this, LHSType, RHSType); - if (getLangOptions().ObjCAutoRefCount && + if (getLangOpts().ObjCAutoRefCount && result == Compatible && !CheckObjCARCUnavailableWeakConversion(OrigLHSType, RHSType)) result = IncompatibleObjCWeakRef; @@ -5668,7 +5668,7 @@ Sema::CheckTransparentUnionArgumentConstraints(QualType ArgType, Sema::AssignConvertType Sema::CheckSingleAssignmentConstraints(QualType LHSType, ExprResult &RHS, bool Diagnose) { - if (getLangOptions().CPlusPlus) { + if (getLangOpts().CPlusPlus) { if (!LHSType->isRecordType() && !LHSType->isAtomicType()) { // C++ 5.17p3: If the left operand is not of class type, the // expression is implicitly converted (C++ 4) to the @@ -5693,7 +5693,7 @@ Sema::CheckSingleAssignmentConstraints(QualType LHSType, ExprResult &RHS, if (Res.isInvalid()) return Incompatible; Sema::AssignConvertType result = Compatible; - if (getLangOptions().ObjCAutoRefCount && + if (getLangOpts().ObjCAutoRefCount && !CheckObjCARCUnavailableWeakConversion(LHSType, RHS.get()->getType())) result = IncompatibleObjCWeakRef; @@ -5789,7 +5789,7 @@ QualType Sema::CheckVectorOperands(ExprResult &LHS, ExprResult &RHS, return RHSType; } - if (getLangOptions().LaxVectorConversions && + if (getLangOpts().LaxVectorConversions && Context.getTypeSize(LHSType) == Context.getTypeSize(RHSType)) { // If we are allowing lax vector conversions, and LHS and RHS are both // vectors, the total size only needs to be the same. This is a @@ -5946,7 +5946,7 @@ QualType Sema::CheckRemainderOperands( /// \brief Diagnose invalid arithmetic on two void pointers. static void diagnoseArithmeticOnTwoVoidPointers(Sema &S, SourceLocation Loc, Expr *LHSExpr, Expr *RHSExpr) { - S.Diag(Loc, S.getLangOptions().CPlusPlus + S.Diag(Loc, S.getLangOpts().CPlusPlus ? diag::err_typecheck_pointer_arith_void_type : diag::ext_gnu_void_ptr) << 1 /* two pointers */ << LHSExpr->getSourceRange() @@ -5956,7 +5956,7 @@ static void diagnoseArithmeticOnTwoVoidPointers(Sema &S, SourceLocation Loc, /// \brief Diagnose invalid arithmetic on a void pointer. static void diagnoseArithmeticOnVoidPointer(Sema &S, SourceLocation Loc, Expr *Pointer) { - S.Diag(Loc, S.getLangOptions().CPlusPlus + S.Diag(Loc, S.getLangOpts().CPlusPlus ? diag::err_typecheck_pointer_arith_void_type : diag::ext_gnu_void_ptr) << 0 /* one pointer */ << Pointer->getSourceRange(); @@ -5967,7 +5967,7 @@ static void diagnoseArithmeticOnTwoFunctionPointers(Sema &S, SourceLocation Loc, Expr *LHS, Expr *RHS) { assert(LHS->getType()->isAnyPointerType()); assert(RHS->getType()->isAnyPointerType()); - S.Diag(Loc, S.getLangOptions().CPlusPlus + S.Diag(Loc, S.getLangOpts().CPlusPlus ? diag::err_typecheck_pointer_arith_function_type : diag::ext_gnu_ptr_func_arith) << 1 /* two pointers */ << LHS->getType()->getPointeeType() @@ -5982,7 +5982,7 @@ static void diagnoseArithmeticOnTwoFunctionPointers(Sema &S, SourceLocation Loc, static void diagnoseArithmeticOnFunctionPointer(Sema &S, SourceLocation Loc, Expr *Pointer) { assert(Pointer->getType()->isAnyPointerType()); - S.Diag(Loc, S.getLangOptions().CPlusPlus + S.Diag(Loc, S.getLangOpts().CPlusPlus ? diag::err_typecheck_pointer_arith_function_type : diag::ext_gnu_ptr_func_arith) << 0 /* one pointer */ << Pointer->getType()->getPointeeType() @@ -6023,11 +6023,11 @@ static bool checkArithmeticOpPointerOperand(Sema &S, SourceLocation Loc, QualType PointeeTy = Operand->getType()->getPointeeType(); if (PointeeTy->isVoidType()) { diagnoseArithmeticOnVoidPointer(S, Loc, Operand); - return !S.getLangOptions().CPlusPlus; + return !S.getLangOpts().CPlusPlus; } if (PointeeTy->isFunctionType()) { diagnoseArithmeticOnFunctionPointer(S, Loc, Operand); - return !S.getLangOptions().CPlusPlus; + return !S.getLangOpts().CPlusPlus; } if (checkArithmeticIncompletePointerType(S, Loc, Operand)) return false; @@ -6062,7 +6062,7 @@ static bool checkArithmeticBinOpPointerOperands(Sema &S, SourceLocation Loc, else if (!isLHSVoidPtr) diagnoseArithmeticOnVoidPointer(S, Loc, RHSExpr); else diagnoseArithmeticOnTwoVoidPointers(S, Loc, LHSExpr, RHSExpr); - return !S.getLangOptions().CPlusPlus; + return !S.getLangOpts().CPlusPlus; } bool isLHSFuncPtr = isLHSPointer && LHSPointeeTy->isFunctionType(); @@ -6073,7 +6073,7 @@ static bool checkArithmeticBinOpPointerOperands(Sema &S, SourceLocation Loc, RHSExpr); else diagnoseArithmeticOnTwoFunctionPointers(S, Loc, LHSExpr, RHSExpr); - return !S.getLangOptions().CPlusPlus; + return !S.getLangOpts().CPlusPlus; } if (checkArithmeticIncompletePointerType(S, Loc, LHSExpr)) return false; @@ -6271,7 +6271,7 @@ QualType Sema::CheckSubtractionOperands(ExprResult &LHS, ExprResult &RHS, = RHS.get()->getType()->getAs<PointerType>()) { QualType rpointee = RHSPTy->getPointeeType(); - if (getLangOptions().CPlusPlus) { + if (getLangOpts().CPlusPlus) { // Pointee types must be the same: C++ [expr.add] if (!Context.hasSameUnqualifiedType(lpointee, rpointee)) { diagnosePointerIncompatibility(*this, Loc, LHS.get(), RHS.get()); @@ -6676,7 +6676,7 @@ QualType Sema::CheckCompareOperands(ExprResult &LHS, ExprResult &RHS, QualType RCanPointeeTy = RHSType->castAs<PointerType>()->getPointeeType().getCanonicalType(); - if (getLangOptions().CPlusPlus) { + if (getLangOpts().CPlusPlus) { if (LCanPointeeTy == RCanPointeeTy) return ResultTy; if (!IsRelational && @@ -6732,7 +6732,7 @@ QualType Sema::CheckCompareOperands(ExprResult &LHS, ExprResult &RHS, return ResultTy; } - if (getLangOptions().CPlusPlus) { + if (getLangOpts().CPlusPlus) { // Comparison of nullptr_t with itself. if (LHSType->isNullPtrType() && RHSType->isNullPtrType()) return ResultTy; @@ -6856,11 +6856,11 @@ QualType Sema::CheckCompareOperands(ExprResult &LHS, ExprResult &RHS, bool isError = false; if ((LHSIsNull && LHSType->isIntegerType()) || (RHSIsNull && RHSType->isIntegerType())) { - if (IsRelational && !getLangOptions().CPlusPlus) + if (IsRelational && !getLangOpts().CPlusPlus) DiagID = diag::ext_typecheck_ordered_comparison_of_pointer_and_zero; - } else if (IsRelational && !getLangOptions().CPlusPlus) + } else if (IsRelational && !getLangOpts().CPlusPlus) DiagID = diag::ext_typecheck_ordered_comparison_of_pointer_integer; - else if (getLangOptions().CPlusPlus) { + else if (getLangOpts().CPlusPlus) { DiagID = diag::err_typecheck_comparison_of_pointer_integer; isError = true; } else @@ -7023,7 +7023,7 @@ inline QualType Sema::CheckLogicalOperands( // C99 6.5.[13,14] // Parens on the RHS are ignored. llvm::APSInt Result; if (RHS.get()->EvaluateAsInt(Result, Context)) - if ((getLangOptions().Bool && !RHS.get()->getType()->isBooleanType()) || + if ((getLangOpts().Bool && !RHS.get()->getType()->isBooleanType()) || (Result != 0 && Result != 1)) { Diag(Loc, diag::warn_logical_instead_of_bitwise) << RHS.get()->getSourceRange() @@ -7033,7 +7033,7 @@ inline QualType Sema::CheckLogicalOperands( // C99 6.5.[13,14] << (Opc == BO_LAnd ? "&" : "|") << FixItHint::CreateReplacement(SourceRange( Loc, Lexer::getLocForEndOfToken(Loc, 0, getSourceManager(), - getLangOptions())), + getLangOpts())), Opc == BO_LAnd ? "&" : "|"); if (Opc == BO_LAnd) // Suggest replacing "Foo() && kNonZero" with "Foo()" @@ -7042,12 +7042,12 @@ inline QualType Sema::CheckLogicalOperands( // C99 6.5.[13,14] SourceRange( Lexer::getLocForEndOfToken(LHS.get()->getLocEnd(), 0, getSourceManager(), - getLangOptions()), + getLangOpts()), RHS.get()->getLocEnd())); } } - if (!Context.getLangOptions().CPlusPlus) { + if (!Context.getLangOpts().CPlusPlus) { LHS = UsualUnaryConversions(LHS.take()); if (LHS.isInvalid()) return QualType(); @@ -7150,7 +7150,7 @@ static bool CheckForModifiableLvalue(Expr *E, SourceLocation Loc, Sema &S) { // In ARC, use some specialized diagnostics for occasions where we // infer 'const'. These are always pseudo-strong variables. - if (S.getLangOptions().ObjCAutoRefCount) { + if (S.getLangOpts().ObjCAutoRefCount) { DeclRefExpr *declRef = dyn_cast<DeclRefExpr>(E->IgnoreParenCasts()); if (declRef && isa<VarDecl>(declRef->getDecl())) { VarDecl *var = cast<VarDecl>(declRef->getDecl()); @@ -7293,7 +7293,7 @@ QualType Sema::CheckAssignmentOperands(Expr *LHSExpr, ExprResult &RHS, if (ConvTy == Compatible) { if (LHSType.getObjCLifetime() == Qualifiers::OCL_Strong) checkRetainCycles(LHSExpr, RHS.get()); - else if (getLangOptions().ObjCAutoRefCount) + else if (getLangOpts().ObjCAutoRefCount) checkUnsafeExprAssigns(Loc, LHSExpr, RHS.get()); } } else { @@ -7314,7 +7314,7 @@ QualType Sema::CheckAssignmentOperands(Expr *LHSExpr, ExprResult &RHS, // is converted to the type of the assignment expression (above). // C++ 5.17p1: the type of the assignment expression is that of its left // operand. - return (getLangOptions().CPlusPlus + return (getLangOpts().CPlusPlus ? LHSType : LHSType.getUnqualifiedType()); } @@ -7338,7 +7338,7 @@ static QualType CheckCommaOperands(Sema &S, ExprResult &LHS, ExprResult &RHS, if (LHS.isInvalid()) return QualType(); - if (!S.getLangOptions().CPlusPlus) { + if (!S.getLangOpts().CPlusPlus) { RHS = S.DefaultFunctionArrayLvalueConversion(RHS.take()); if (RHS.isInvalid()) return QualType(); @@ -7368,7 +7368,7 @@ static QualType CheckIncrementDecrementOperand(Sema &S, Expr *Op, assert(!ResType.isNull() && "no type for increment/decrement expression"); - if (S.getLangOptions().CPlusPlus && ResType->isBooleanType()) { + if (S.getLangOpts().CPlusPlus && ResType->isBooleanType()) { // Decrement of bool is not allowed. if (!IsInc) { S.Diag(OpLoc, diag::err_decrement_bool) << Op->getSourceRange(); @@ -7395,7 +7395,7 @@ static QualType CheckIncrementDecrementOperand(Sema &S, Expr *Op, if (PR.isInvalid()) return QualType(); return CheckIncrementDecrementOperand(S, PR.take(), VK, OpLoc, IsInc, IsPrefix); - } else if (S.getLangOptions().AltiVec && ResType->isVectorType()) { + } else if (S.getLangOpts().AltiVec && ResType->isVectorType()) { // OK! ( C/C++ Language Extensions for CBEA(Version 2.6) 10.3 ) } else { S.Diag(OpLoc, diag::err_typecheck_illegal_increment_decrement) @@ -7409,7 +7409,7 @@ static QualType CheckIncrementDecrementOperand(Sema &S, Expr *Op, // In C++, a prefix increment is the same type as the operand. Otherwise // (in C or with postfix), the increment is the unqualified type of the // operand. - if (IsPrefix && S.getLangOptions().CPlusPlus) { + if (IsPrefix && S.getLangOpts().CPlusPlus) { VK = VK_LValue; return ResType; } else { @@ -7534,7 +7534,7 @@ static QualType CheckAddressOfOperand(Sema &S, ExprResult &OrigOp, // Make sure to ignore parentheses in subsequent checks Expr *op = OrigOp.get()->IgnoreParens(); - if (S.getLangOptions().C99) { + if (S.getLangOpts().C99) { // Implement C99-only parts of addressof rules. if (UnaryOperator* uOp = dyn_cast<UnaryOperator>(op)) { if (uOp->getOpcode() == UO_Deref) @@ -7611,7 +7611,7 @@ static QualType CheckAddressOfOperand(Sema &S, ExprResult &OrigOp, // in C++ it is not error to take address of a register // variable (c++03 7.1.1P3) if (vd->getStorageClass() == SC_Register && - !S.getLangOptions().CPlusPlus) { + !S.getLangOpts().CPlusPlus) { AddressOfError = AO_Register_Variable; } } else if (isa<FunctionTemplateDecl>(dcl)) { @@ -7703,7 +7703,7 @@ static QualType CheckIndirectionOperand(Sema &S, Expr *Op, ExprValueKind &VK, VK = VK_LValue; // ...except that certain expressions are never l-values in C. - if (!S.getLangOptions().CPlusPlus && Result.isCForbiddenLValueType()) + if (!S.getLangOpts().CPlusPlus && Result.isCForbiddenLValueType()) VK = VK_RValue; return Result; @@ -7810,7 +7810,7 @@ static void DiagnoseSelfAssignment(Sema &S, Expr *LHSExpr, Expr *RHSExpr, ExprResult Sema::CreateBuiltinBinOp(SourceLocation OpLoc, BinaryOperatorKind Opc, Expr *LHSExpr, Expr *RHSExpr) { - if (getLangOptions().CPlusPlus0x && isa<InitListExpr>(RHSExpr)) { + if (getLangOpts().CPlusPlus0x && isa<InitListExpr>(RHSExpr)) { // The syntax only allows initializer lists on the RHS of assignment, // so we don't need to worry about accepting invalid code for // non-assignment operators. @@ -7840,7 +7840,7 @@ ExprResult Sema::CreateBuiltinBinOp(SourceLocation OpLoc, switch (Opc) { case BO_Assign: ResultTy = CheckAssignmentOperands(LHS.get(), RHS, OpLoc, QualType()); - if (getLangOptions().CPlusPlus && + if (getLangOpts().CPlusPlus && LHS.get()->getObjectKind() != OK_ObjCProperty) { VK = LHS.get()->getValueKind(); OK = LHS.get()->getObjectKind(); @@ -7931,7 +7931,7 @@ ExprResult Sema::CreateBuiltinBinOp(SourceLocation OpLoc, break; case BO_Comma: ResultTy = CheckCommaOperands(*this, LHS, RHS, OpLoc); - if (getLangOptions().CPlusPlus && !RHS.isInvalid()) { + if (getLangOpts().CPlusPlus && !RHS.isInvalid()) { VK = RHS.get()->getValueKind(); OK = RHS.get()->getObjectKind(); } @@ -7947,7 +7947,7 @@ ExprResult Sema::CreateBuiltinBinOp(SourceLocation OpLoc, if (CompResultTy.isNull()) return Owned(new (Context) BinaryOperator(LHS.take(), RHS.take(), Opc, ResultTy, VK, OK, OpLoc)); - if (getLangOptions().CPlusPlus && LHS.get()->getObjectKind() != + if (getLangOpts().CPlusPlus && LHS.get()->getObjectKind() != OK_ObjCProperty) { VK = VK_LValue; OK = LHS.get()->getObjectKind(); @@ -8213,7 +8213,7 @@ ExprResult Sema::BuildBinOp(Scope *S, SourceLocation OpLoc, RHSExpr = resolvedRHS.take(); } - if (getLangOptions().CPlusPlus) { + if (getLangOpts().CPlusPlus) { // If either expression is type-dependent, always build an // overloaded op. if (LHSExpr->isTypeDependent() || RHSExpr->isTypeDependent()) @@ -8266,10 +8266,10 @@ ExprResult Sema::CreateBuiltinUnaryOp(SourceLocation OpLoc, if (resultType->isArithmeticType() || // C99 6.5.3.3p1 resultType->isVectorType()) break; - else if (getLangOptions().CPlusPlus && // C++ [expr.unary.op]p6-7 + else if (getLangOpts().CPlusPlus && // C++ [expr.unary.op]p6-7 resultType->isEnumeralType()) break; - else if (getLangOptions().CPlusPlus && // C++ [expr.unary.op]p6 + else if (getLangOpts().CPlusPlus && // C++ [expr.unary.op]p6 Opc == UO_Plus && resultType->isPointerType()) break; @@ -8312,7 +8312,7 @@ ExprResult Sema::CreateBuiltinUnaryOp(SourceLocation OpLoc, break; if (resultType->isScalarType()) { // C99 6.5.3.3p1: ok, fallthrough; - if (Context.getLangOptions().CPlusPlus) { + if (Context.getLangOpts().CPlusPlus) { // C++03 [expr.unary.op]p8, C++0x [expr.unary.op]p9: // operand contextually converted to bool. Input = ImpCastExprToType(Input.take(), Context.BoolTy, @@ -8341,7 +8341,7 @@ ExprResult Sema::CreateBuiltinUnaryOp(SourceLocation OpLoc, if (Input.get()->getValueKind() != VK_RValue && Input.get()->getObjectKind() == OK_Ordinary) VK = Input.get()->getValueKind(); - } else if (!getLangOptions().CPlusPlus) { + } else if (!getLangOpts().CPlusPlus) { // In C, a volatile scalar is read by __imag. In C++, it is not. Input = DefaultLvalueConversion(Input.take()); } @@ -8436,7 +8436,7 @@ ExprResult Sema::BuildUnaryOp(Scope *S, SourceLocation OpLoc, Input = Result.take(); } - if (getLangOptions().CPlusPlus && Input->getType()->isOverloadableType() && + if (getLangOpts().CPlusPlus && Input->getType()->isOverloadableType() && UnaryOperator::getOverloadedOperator(Opc) != OO_None && !(Opc == UO_AddrOf && isQualifiedMemberAccess(Input))) { // Find all of the overloaded operators visible from this @@ -8884,7 +8884,7 @@ void Sema::ActOnBlockArguments(Declarator &ParamInfo, Scope *CurScope) { if (Param->getIdentifier() == 0 && !Param->isImplicit() && !Param->isInvalidDecl() && - !getLangOptions().CPlusPlus) + !getLangOpts().CPlusPlus) Diag(Param->getLocation(), diag::err_parameter_name_omitted); Params.push_back(Param); } @@ -9159,7 +9159,7 @@ ExprResult Sema::ActOnGNUNullExpr(SourceLocation TokenLoc) { static void MakeObjCStringLiteralFixItHint(Sema& SemaRef, QualType DstType, Expr *SrcExpr, FixItHint &Hint) { - if (!SemaRef.getLangOptions().ObjC1) + if (!SemaRef.getLangOpts().ObjC1) return; const ObjCObjectPointerType *PT = DstType->getAs<ObjCObjectPointerType>(); @@ -9263,7 +9263,7 @@ bool Sema::DiagnoseAssignmentResult(AssignConvertType ConvTy, // expression, rather than a type), which should be done as part // of a larger effort to fix checkPointerTypesForAssignment for // C++ semantics. - if (getLangOptions().CPlusPlus && + if (getLangOpts().CPlusPlus && IsStringLiteralToNonConstPointerConversion(SrcExpr, DstType)) return false; DiagKind = diag::ext_typecheck_convert_discards_qualifiers; @@ -9360,7 +9360,7 @@ ExprResult Sema::VerifyIntegerConstantExpression(Expr *E, llvm::APSInt *Result, PartialDiagnostic FoldDiag) { SourceLocation DiagLoc = E->getLocStart(); - if (getLangOptions().CPlusPlus0x) { + if (getLangOpts().CPlusPlus0x) { // C++11 [expr.const]p5: // If an expression of literal class type is used in a context where an // integral constant expression is required, then that class type shall @@ -9399,7 +9399,7 @@ ExprResult Sema::VerifyIntegerConstantExpression(Expr *E, llvm::APSInt *Result, // Circumvent ICE checking in C++11 to avoid evaluating the expression twice // in the non-ICE case. - if (!getLangOptions().CPlusPlus0x && E->isIntegerConstantExpr(Context)) { + if (!getLangOpts().CPlusPlus0x && E->isIntegerConstantExpr(Context)) { if (Result) *Result = E->EvaluateKnownConstInt(Context); return Owned(E); @@ -9417,7 +9417,7 @@ ExprResult Sema::VerifyIntegerConstantExpression(Expr *E, llvm::APSInt *Result, // In C++11, we can rely on diagnostics being produced for any expression // which is not a constant expression. If no diagnostics were produced, then // this is a constant expression. - if (Folded && getLangOptions().CPlusPlus0x && Notes.empty()) { + if (Folded && getLangOpts().CPlusPlus0x && Notes.empty()) { if (Result) *Result = EvalResult.Val.getInt(); return Owned(E); @@ -9769,7 +9769,7 @@ diagnoseUncapturableValueReference(Sema &S, SourceLocation loc, // For C++, things get a bit more nasty... it would be nice to suppress this // diagnostic for certain cases like using a local variable in an array bound // for a member of a local class, but the correct predicate is not obvious. - if (!S.getLangOptions().CPlusPlus && !S.CurContext->isFunctionOrMethod()) + if (!S.getLangOpts().CPlusPlus && !S.CurContext->isFunctionOrMethod()) return; if (isa<CXXMethodDecl>(VarDC) && @@ -10063,7 +10063,7 @@ bool Sema::tryCaptureVariable(VarDecl *Var, SourceLocation Loc, CaptureType = CaptureType.getNonReferenceType().withConst(); DeclRefType = CaptureType; - if (getLangOptions().CPlusPlus && BuildAndDiagnose) { + if (getLangOpts().CPlusPlus && BuildAndDiagnose) { if (const RecordType *Record = DeclRefType->getAs<RecordType>()) { // The capture logic needs the destructor, so make sure we mark it. // Usually this is unnecessary because most local variables have @@ -10644,7 +10644,7 @@ ExprResult Sema::CheckBooleanCondition(Expr *E, SourceLocation Loc) { E = result.take(); if (!E->isTypeDependent()) { - if (getLangOptions().CPlusPlus) + if (getLangOpts().CPlusPlus) return CheckCXXBooleanCondition(E); // C++ 6.4p4 ExprResult ERes = DefaultFunctionArrayLvalueConversion(E); @@ -10731,7 +10731,7 @@ namespace { E->setType(VD->getType()); assert(E->getValueKind() == VK_RValue); - if (S.getLangOptions().CPlusPlus && + if (S.getLangOpts().CPlusPlus && !(isa<CXXMethodDecl>(VD) && cast<CXXMethodDecl>(VD)->isInstance())) E->setValueKind(VK_LValue); @@ -11002,7 +11002,7 @@ ExprResult RebuildUnknownAnyExpr::resolveDecl(Expr *E, ValueDecl *VD) { } // Function references aren't l-values in C. - if (!S.getLangOptions().CPlusPlus) + if (!S.getLangOpts().CPlusPlus) ValueKind = VK_RValue; // - variables diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp index b56d3ebfb2..ec2332cc3c 100644 --- a/lib/Sema/SemaExprCXX.cpp +++ b/lib/Sema/SemaExprCXX.cpp @@ -541,7 +541,7 @@ Sema::ActOnCXXThrow(Scope *S, SourceLocation OpLoc, Expr *Ex) { ExprResult Sema::BuildCXXThrow(SourceLocation OpLoc, Expr *Ex, bool IsThrownVarInScope) { // Don't report an error if 'throw' is used in system headers. - if (!getLangOptions().CXXExceptions && + if (!getLangOpts().CXXExceptions && !getSourceManager().isInSystemHeader(OpLoc)) Diag(OpLoc, diag::err_exceptions_disabled) << "throw"; @@ -1102,7 +1102,7 @@ Sema::BuildCXXNew(SourceLocation StartLoc, bool UseGlobal, } // In ARC, infer 'retaining' for the allocated - if (getLangOptions().ObjCAutoRefCount && + if (getLangOpts().ObjCAutoRefCount && AllocType.getObjCLifetime() == Qualifiers::OCL_None && AllocType->isObjCLifetimeType()) { AllocType = Context.getLifetimeQualifiedType(AllocType, @@ -1119,14 +1119,14 @@ Sema::BuildCXXNew(SourceLocation StartLoc, bool UseGlobal, if (ArraySize && !ArraySize->isTypeDependent()) { ExprResult ConvertedSize = ConvertToIntegralOrEnumerationType( StartLoc, ArraySize, - PDiag(diag::err_array_size_not_integral) << getLangOptions().CPlusPlus0x, + PDiag(diag::err_array_size_not_integral) << getLangOpts().CPlusPlus0x, PDiag(diag::err_array_size_incomplete_type) << ArraySize->getSourceRange(), PDiag(diag::err_array_size_explicit_conversion), PDiag(diag::note_array_size_conversion), PDiag(diag::err_array_size_ambiguous_conversion), PDiag(diag::note_array_size_conversion), - PDiag(getLangOptions().CPlusPlus0x ? + PDiag(getLangOpts().CPlusPlus0x ? diag::warn_cxx98_compat_array_size_conversion : diag::ext_array_size_conversion), /*AllowScopedEnumerations*/ false); @@ -1156,7 +1156,7 @@ Sema::BuildCXXNew(SourceLocation StartLoc, bool UseGlobal, if (Value < llvm::APSInt( llvm::APInt::getNullValue(Value.getBitWidth()), Value.isUnsigned())) { - if (getLangOptions().CPlusPlus0x) + if (getLangOpts().CPlusPlus0x) Diag(ArraySize->getLocStart(), diag::warn_typecheck_negative_array_new_size) << ArraySize->getSourceRange(); @@ -1168,7 +1168,7 @@ Sema::BuildCXXNew(SourceLocation StartLoc, bool UseGlobal, unsigned ActiveSizeBits = ConstantArrayType::getNumAddressingBits(Context, AllocType, Value); if (ActiveSizeBits > ConstantArrayType::getMaxSizeBits(Context)) { - if (getLangOptions().CPlusPlus0x) + if (getLangOpts().CPlusPlus0x) Diag(ArraySize->getLocStart(), diag::warn_array_new_too_large) << Value.toString(10) @@ -1192,7 +1192,7 @@ Sema::BuildCXXNew(SourceLocation StartLoc, bool UseGlobal, } // ARC: warn about ABI issues. - if (getLangOptions().ObjCAutoRefCount) { + if (getLangOpts().ObjCAutoRefCount) { QualType BaseAllocType = Context.getBaseElementType(AllocType); if (BaseAllocType.hasStrongOrWeakObjCLifetime()) Diag(StartLoc, diag::warn_err_new_delete_object_array) @@ -1381,7 +1381,7 @@ bool Sema::CheckAllocatedType(QualType AllocType, SourceLocation Loc, else if (unsigned AddressSpace = AllocType.getAddressSpace()) return Diag(Loc, diag::err_address_space_qualified_new) << AllocType.getUnqualifiedType() << AddressSpace; - else if (getLangOptions().ObjCAutoRefCount) { + else if (getLangOpts().ObjCAutoRefCount) { if (const ArrayType *AT = Context.getAsArrayType(AllocType)) { QualType BaseAllocType = Context.getBaseElementType(AT); if (BaseAllocType.getObjCLifetime() == Qualifiers::OCL_None && @@ -1469,7 +1469,7 @@ bool Sema::FindAllocationFunctions(SourceLocation StartLoc, SourceRange Range, // We don't need an operator delete if we're running under // -fno-exceptions. - if (!getLangOptions().Exceptions) { + if (!getLangOpts().Exceptions) { OperatorDelete = 0; return false; } @@ -1587,7 +1587,7 @@ bool Sema::FindAllocationFunctions(SourceLocation StartLoc, SourceRange Range, // as a placement deallocation function, would have been // selected as a match for the allocation function, the program // is ill-formed. - if (NumPlaceArgs && getLangOptions().CPlusPlus0x && + if (NumPlaceArgs && getLangOpts().CPlusPlus0x && isNonPlacementDeallocationFunction(OperatorDelete)) { Diag(StartLoc, diag::err_placement_new_non_placement_delete) << SourceRange(PlaceArgs[0]->getLocStart(), @@ -1763,7 +1763,7 @@ void Sema::DeclareGlobalNewDelete() { // lookup. // Note that the C++0x versions of operator delete are deallocation functions, // and thus are implicitly noexcept. - if (!StdBadAlloc && !getLangOptions().CPlusPlus0x) { + if (!StdBadAlloc && !getLangOpts().CPlusPlus0x) { // The "std::bad_alloc" class has not yet been declared, so build it // implicitly. StdBadAlloc = CXXRecordDecl::Create(Context, TTK_Class, @@ -1778,7 +1778,7 @@ void Sema::DeclareGlobalNewDelete() { QualType VoidPtr = Context.getPointerType(Context.VoidTy); QualType SizeT = Context.getSizeType(); - bool AssumeSaneOperatorNew = getLangOptions().AssumeSaneOperatorNew; + bool AssumeSaneOperatorNew = getLangOpts().AssumeSaneOperatorNew; DeclareGlobalAllocationFunction( Context.DeclarationNames.getCXXOperatorName(OO_New), @@ -1826,20 +1826,20 @@ void Sema::DeclareGlobalAllocationFunction(DeclarationName Name, bool HasBadAllocExceptionSpec = (Name.getCXXOverloadedOperator() == OO_New || Name.getCXXOverloadedOperator() == OO_Array_New); - if (HasBadAllocExceptionSpec && !getLangOptions().CPlusPlus0x) { + if (HasBadAllocExceptionSpec && !getLangOpts().CPlusPlus0x) { assert(StdBadAlloc && "Must have std::bad_alloc declared"); BadAllocType = Context.getTypeDeclType(getStdBadAlloc()); } FunctionProtoType::ExtProtoInfo EPI; if (HasBadAllocExceptionSpec) { - if (!getLangOptions().CPlusPlus0x) { + if (!getLangOpts().CPlusPlus0x) { EPI.ExceptionSpecType = EST_Dynamic; EPI.NumExceptions = 1; EPI.Exceptions = &BadAllocType; } } else { - EPI.ExceptionSpecType = getLangOptions().CPlusPlus0x ? + EPI.ExceptionSpecType = getLangOpts().CPlusPlus0x ? EST_BasicNoexcept : EST_DynamicNone; } @@ -2130,7 +2130,7 @@ Sema::ActOnCXXDelete(SourceLocation StartLoc, bool UseGlobal, } } - } else if (getLangOptions().ObjCAutoRefCount && + } else if (getLangOpts().ObjCAutoRefCount && PointeeElem->isObjCLifetimeType() && (PointeeElem.getObjCLifetime() == Qualifiers::OCL_Strong || PointeeElem.getObjCLifetime() == Qualifiers::OCL_Weak) && @@ -2580,7 +2580,7 @@ Sema::PerformImplicitConversion(Expr *From, QualType ToType, ToType->isObjCObjectPointerType()) EmitRelatedResultTypeNote(From); } - else if (getLangOptions().ObjCAutoRefCount && + else if (getLangOpts().ObjCAutoRefCount && !CheckObjCARCUnavailableWeakConversion(ToType, From->getType())) { if (Action == AA_Initializing) @@ -2754,7 +2754,7 @@ Sema::PerformImplicitConversion(Expr *From, QualType ToType, CK_NoOp, VK, /*BasePath=*/0, CCK).take(); if (SCS.DeprecatedStringLiteralToCharPtr && - !getLangOptions().WritableStrings) + !getLangOpts().WritableStrings) Diag(From->getLocStart(), diag::warn_deprecated_string_literal_conversion) << ToType.getNonReferenceType(); @@ -3505,7 +3505,7 @@ ExprResult Sema::BuildBinaryTypeTrait(BinaryTypeTrait BTT, QualType RhsT = RhsTSInfo->getType(); if (BTT == BTT_TypeCompatible) { - if (getLangOptions().CPlusPlus) { + if (getLangOpts().CPlusPlus) { Diag(KWLoc, diag::err_types_compatible_p_in_cplusplus) << SourceRange(KWLoc, RParen); return ExprError(); @@ -4215,7 +4215,7 @@ QualType Sema::FindCompositePointerType(SourceLocation Loc, if (NonStandardCompositeType) *NonStandardCompositeType = false; - assert(getLangOptions().CPlusPlus && "This function assumes C++"); + assert(getLangOpts().CPlusPlus && "This function assumes C++"); QualType T1 = E1->getType(), T2 = E2->getType(); if (!T1->isAnyPointerType() && !T1->isMemberPointerType() && @@ -4425,7 +4425,7 @@ ExprResult Sema::MaybeBindToTemporary(Expr *E) { // In ARC, calls that return a retainable type can return retained, // in which case we have to insert a consuming cast. - if (getLangOptions().ObjCAutoRefCount && + if (getLangOpts().ObjCAutoRefCount && E->getType()->isObjCRetainableType()) { bool ReturnsRetained; @@ -4504,7 +4504,7 @@ ExprResult Sema::MaybeBindToTemporary(Expr *E) { VK_RValue)); } - if (!getLangOptions().CPlusPlus) + if (!getLangOpts().CPlusPlus) return Owned(E); // Search for the base element type (cf. ASTContext::getBaseElementType) with @@ -4855,7 +4855,7 @@ ExprResult Sema::BuildPseudoDestructorExpr(Expr *Base, return ExprError(); if (!ObjectType->isDependentType() && !ObjectType->isScalarType()) { - if (getLangOptions().MicrosoftMode && ObjectType->isVoidType()) + if (getLangOpts().MicrosoftMode && ObjectType->isVoidType()) Diag(OpLoc, diag::ext_pseudo_dtor_on_void) << Base->getSourceRange(); else Diag(OpLoc, diag::err_pseudo_dtor_base_not_scalar) @@ -5186,14 +5186,14 @@ ExprResult Sema::IgnoredValueConversions(Expr *E) { // are r-values, but we still want to do function-to-pointer decay // on them. This is both technically correct and convenient for // some clients. - if (!getLangOptions().CPlusPlus && E->getType()->isFunctionType()) + if (!getLangOpts().CPlusPlus && E->getType()->isFunctionType()) return DefaultFunctionArrayConversion(E); return Owned(E); } // Otherwise, this rule does not apply in C++, at least not for the moment. - if (getLangOptions().CPlusPlus) return Owned(E); + if (getLangOpts().CPlusPlus) return Owned(E); // GCC seems to also exclude expressions of incomplete enum type. if (const EnumType *T = E->getType()->getAs<EnumType>()) { @@ -5225,7 +5225,7 @@ ExprResult Sema::ActOnFinishFullExpr(Expr *FE) { return ExprError(); // Top-level message sends default to 'id' when we're in a debugger. - if (getLangOptions().DebuggerCastResultToId && + if (getLangOpts().DebuggerCastResultToId && FullExpr.get()->getType() == Context.UnknownAnyTy && isa<ObjCMessageExpr>(FullExpr.get())) { FullExpr = forceUnknownAnyToType(FullExpr.take(), Context.getObjCIdType()); diff --git a/lib/Sema/SemaExprMember.cpp b/lib/Sema/SemaExprMember.cpp index 64d5d6012c..180c1aa0f0 100644 --- a/lib/Sema/SemaExprMember.cpp +++ b/lib/Sema/SemaExprMember.cpp @@ -139,7 +139,7 @@ static IMAKind ClassifyImplicitMemberAccess(Sema &SemaRef, return IMA_Static; bool IsCXX11UnevaluatedField = false; - if (SemaRef.getLangOptions().CPlusPlus0x && isField) { + if (SemaRef.getLangOpts().CPlusPlus0x && isField) { // C++11 [expr.prim.general]p12: // An id-expression that denotes a non-static data member or non-static // member function of a class can only be used: @@ -433,7 +433,7 @@ Sema::ActOnDependentMemberExpr(Expr *BaseExpr, QualType BaseType, // allows this, while still reporting an error if T is a struct pointer. if (!IsArrow) { const PointerType *PT = BaseType->getAs<PointerType>(); - if (PT && (!getLangOptions().ObjC1 || + if (PT && (!getLangOpts().ObjC1 || PT->getPointeeType()->isRecordType())) { assert(BaseExpr && "cannot happen with implicit member accesses"); Diag(NameInfo.getLoc(), diag::err_typecheck_member_reference_struct_union) @@ -597,9 +597,9 @@ LookupMemberExprInRecord(Sema &SemaRef, LookupResult &R, R.clear(); if (NamedDecl *ND = Corrected.getCorrectionDecl()) { std::string CorrectedStr( - Corrected.getAsString(SemaRef.getLangOptions())); + Corrected.getAsString(SemaRef.getLangOpts())); std::string CorrectedQuotedStr( - Corrected.getQuoted(SemaRef.getLangOptions())); + Corrected.getQuoted(SemaRef.getLangOpts())); R.setLookupName(Corrected.getCorrection()); R.addDecl(ND); SemaRef.Diag(R.getNameLoc(), diag::err_no_member_suggest) @@ -1104,7 +1104,7 @@ Sema::LookupMemberExpr(LookupResult &R, ExprResult &BaseExpr, // - an interface ObjCInterfaceDecl *IDecl = OTy->getInterface(); if (!IDecl) { - if (getLangOptions().ObjCAutoRefCount && + if (getLangOpts().ObjCAutoRefCount && (OTy->isObjCId() || OTy->isObjCClass())) goto fail; // There's an implicit 'isa' ivar on all objects. @@ -1189,7 +1189,7 @@ Sema::LookupMemberExpr(LookupResult &R, ExprResult &BaseExpr, dyn_cast<ObjCCategoryImplDecl>(ObjCImpDecl)) ClassOfMethodDecl = CatImplClass->getClassInterface(); } - if (!getLangOptions().DebuggerSupport) { + if (!getLangOpts().DebuggerSupport) { if (IV->getAccessControl() == ObjCIvarDecl::Private) { if (!declaresSameEntity(ClassDeclared, IDecl) || !declaresSameEntity(ClassOfMethodDecl, ClassDeclared)) @@ -1201,7 +1201,7 @@ Sema::LookupMemberExpr(LookupResult &R, ExprResult &BaseExpr, << IV->getDeclName(); } } - if (getLangOptions().ObjCAutoRefCount) { + if (getLangOpts().ObjCAutoRefCount) { Expr *BaseExp = BaseExpr.get()->IgnoreParenImpCasts(); if (UnaryOperator *UO = dyn_cast<UnaryOperator>(BaseExp)) if (UO->getOpcode() == UO_Deref) @@ -1439,7 +1439,7 @@ ExprResult Sema::ActOnMemberAccessExpr(Scope *S, Expr *Base, return ExprError(); // Warn about the explicit constructor calls Microsoft extension. - if (getLangOptions().MicrosoftExt && + if (getLangOpts().MicrosoftExt && Id.getKind() == UnqualifiedId::IK_ConstructorName) Diag(Id.getSourceRange().getBegin(), diag::ext_ms_explicit_constructor_call); diff --git a/lib/Sema/SemaExprObjC.cpp b/lib/Sema/SemaExprObjC.cpp index 0eae2e2692..448f145964 100644 --- a/lib/Sema/SemaExprObjC.cpp +++ b/lib/Sema/SemaExprObjC.cpp @@ -88,9 +88,9 @@ ExprResult Sema::BuildObjCStringLiteral(SourceLocation AtLoc, StringLiteral *S){ QualType Ty = Context.getObjCConstantStringInterface(); if (!Ty.isNull()) { Ty = Context.getObjCObjectPointerType(Ty); - } else if (getLangOptions().NoConstantCFStrings) { + } else if (getLangOpts().NoConstantCFStrings) { IdentifierInfo *NSIdent=0; - std::string StringClass(getLangOptions().ObjCConstantStringClass); + std::string StringClass(getLangOpts().ObjCConstantStringClass); if (StringClass.empty()) NSIdent = &Context.Idents.get("NSConstantString"); @@ -163,7 +163,7 @@ static ObjCMethodDecl *getNSNumberFactoryMethod(Sema &S, SourceLocation Loc, // Look for the appropriate method within NSNumber. ObjCMethodDecl *Method = S.NSNumberDecl->lookupClassMethod(Sel);; - if (!Method && S.getLangOptions().DebuggerObjCLiteral) { + if (!Method && S.getLangOpts().DebuggerObjCLiteral) { TypeSourceInfo *ResultTInfo = 0; Method = ObjCMethodDecl::Create(S.Context, SourceLocation(), SourceLocation(), Sel, ReturnType, @@ -213,7 +213,7 @@ ExprResult Sema::BuildObjCNumericLiteral(SourceLocation AtLoc, Expr *Number) { AtLoc, LookupOrdinaryName); NSNumberDecl = dyn_cast_or_null<ObjCInterfaceDecl>(IF); - if (!NSNumberDecl && getLangOptions().DebuggerObjCLiteral) + if (!NSNumberDecl && getLangOpts().DebuggerObjCLiteral) NSNumberDecl = ObjCInterfaceDecl::Create (Context, Context.getTranslationUnitDecl(), SourceLocation(), @@ -278,7 +278,7 @@ ExprResult Sema::ActOnObjCBoolLiteral(SourceLocation AtLoc, SourceLocation ValueLoc, bool Value) { ExprResult Inner; - if (getLangOptions().CPlusPlus) { + if (getLangOpts().CPlusPlus) { Inner = ActOnCXXBoolLiteral(ValueLoc, Value? tok::kw_true : tok::kw_false); } else { // C doesn't actually have a way to represent literal values of type @@ -306,7 +306,7 @@ static ExprResult CheckObjCCollectionLiteralElement(Sema &S, Expr *Element, // In C++, check for an implicit conversion to an Objective-C object pointer // type. - if (S.getLangOptions().CPlusPlus && Element->getType()->isRecordType()) { + if (S.getLangOpts().CPlusPlus && Element->getType()->isRecordType()) { InitializedEntity Entity = InitializedEntity::InitializeParameter(S.Context, T, /*Consumed=*/false); InitializationKind Kind @@ -422,7 +422,7 @@ ExprResult Sema::BuildObjCArrayLiteral(SourceRange SR, MultiExprArg Elements) { SR.getBegin(), LookupOrdinaryName); NSArrayDecl = dyn_cast_or_null<ObjCInterfaceDecl>(IF); - if (!NSArrayDecl && getLangOptions().DebuggerObjCLiteral) + if (!NSArrayDecl && getLangOpts().DebuggerObjCLiteral) NSArrayDecl = ObjCInterfaceDecl::Create (Context, Context.getTranslationUnitDecl(), SourceLocation(), @@ -441,7 +441,7 @@ ExprResult Sema::BuildObjCArrayLiteral(SourceRange SR, MultiExprArg Elements) { Selector Sel = NSAPIObj->getNSArraySelector(NSAPI::NSArr_arrayWithObjectsCount); ArrayWithObjectsMethod = NSArrayDecl->lookupClassMethod(Sel); - if (!ArrayWithObjectsMethod && getLangOptions().DebuggerObjCLiteral) { + if (!ArrayWithObjectsMethod && getLangOpts().DebuggerObjCLiteral) { TypeSourceInfo *ResultTInfo = 0; ArrayWithObjectsMethod = ObjCMethodDecl::Create(Context, @@ -555,7 +555,7 @@ ExprResult Sema::BuildObjCDictionaryLiteral(SourceRange SR, NSAPIObj->getNSClassId(NSAPI::ClassId_NSDictionary), SR.getBegin(), LookupOrdinaryName); NSDictionaryDecl = dyn_cast_or_null<ObjCInterfaceDecl>(IF); - if (!NSDictionaryDecl && getLangOptions().DebuggerObjCLiteral) + if (!NSDictionaryDecl && getLangOpts().DebuggerObjCLiteral) NSDictionaryDecl = ObjCInterfaceDecl::Create (Context, Context.getTranslationUnitDecl(), SourceLocation(), @@ -575,7 +575,7 @@ ExprResult Sema::BuildObjCDictionaryLiteral(SourceRange SR, Selector Sel = NSAPIObj->getNSDictionarySelector( NSAPI::NSDict_dictionaryWithObjectsForKeysCount); DictionaryWithObjectsMethod = NSDictionaryDecl->lookupClassMethod(Sel); - if (!DictionaryWithObjectsMethod && getLangOptions().DebuggerObjCLiteral) { + if (!DictionaryWithObjectsMethod && getLangOpts().DebuggerObjCLiteral) { DictionaryWithObjectsMethod = ObjCMethodDecl::Create(Context, SourceLocation(), SourceLocation(), Sel, @@ -768,7 +768,7 @@ ExprResult Sema::BuildObjCEncodeExpression(SourceLocation AtLoc, // which is an array type. StrTy = Context.CharTy; // A C++ string literal has a const-qualified element type (C++ 2.13.4p1). - if (getLangOptions().CPlusPlus || getLangOptions().ConstStrings) + if (getLangOpts().CPlusPlus || getLangOpts().ConstStrings) StrTy.addConst(); StrTy = Context.getConstantArrayType(StrTy, llvm::APInt(32, Str.size()+1), ArrayType::Normal, 0); @@ -815,7 +815,7 @@ ExprResult Sema::ParseObjCSelectorExpression(Selector Sel, // In ARC, forbid the user from using @selector for // retain/release/autorelease/dealloc/retainCount. - if (getLangOptions().ObjCAutoRefCount) { + if (getLangOpts().ObjCAutoRefCount) { switch (Sel.getMethodFamily()) { case OMF_retain: case OMF_release: @@ -968,18 +968,18 @@ bool Sema::CheckMessageArgumentTypes(QualType ReceiverType, } unsigned DiagID; - if (getLangOptions().ObjCAutoRefCount) + if (getLangOpts().ObjCAutoRefCount) DiagID = diag::err_arc_method_not_found; else DiagID = isClassMessage ? diag::warn_class_method_not_found : diag::warn_inst_method_not_found; - if (!getLangOptions().DebuggerSupport) + if (!getLangOpts().DebuggerSupport) Diag(lbrac, DiagID) << Sel << isClassMessage << SourceRange(lbrac, rbrac); // In debuggers, we want to use __unknown_anytype for these // results so that clients can cast them. - if (getLangOptions().DebuggerSupport) { + if (getLangOpts().DebuggerSupport) { ReturnType = Context.UnknownAnyTy; } else { ReturnType = Context.getObjCIdType(); @@ -1755,7 +1755,7 @@ ExprResult Sema::BuildClassMessage(TypeSourceInfo *ReceiverTypeInfo, } assert(Class && "We don't know which class we're messaging?"); // objc++ diagnoses during typename annotation. - if (!getLangOptions().CPlusPlus) + if (!getLangOpts().CPlusPlus) (void)DiagnoseUseOfDecl(Class, Loc); // Find the method we are messaging. if (!Method) { @@ -1763,14 +1763,14 @@ ExprResult Sema::BuildClassMessage(TypeSourceInfo *ReceiverTypeInfo, = SuperLoc.isValid()? SourceRange(SuperLoc) : ReceiverTypeInfo->getTypeLoc().getSourceRange(); if (RequireCompleteType(Loc, Context.getObjCInterfaceType(Class), - (getLangOptions().ObjCAutoRefCount + (getLangOpts().ObjCAutoRefCount ? PDiag(diag::err_arc_receiver_forward_class) : PDiag(diag::warn_receiver_forward_class)) << TypeRange)) { // A forward class used in messaging is treated as a 'Class' Method = LookupFactoryMethodInGlobalPool(Sel, SourceRange(LBracLoc, RBracLoc)); - if (Method && !getLangOptions().ObjCAutoRefCount) + if (Method && !getLangOpts().ObjCAutoRefCount) Diag(Method->getLocation(), diag::note_method_sent_forward_class) << Method->getDeclName(); } @@ -2024,14 +2024,14 @@ ExprResult Sema::BuildInstanceMessage(Expr *Receiver, // we don't try to recover. const ObjCInterfaceDecl *forwardClass = 0; if (RequireCompleteType(Loc, OCIType->getPointeeType(), - getLangOptions().ObjCAutoRefCount + getLangOpts().ObjCAutoRefCount ? PDiag(diag::err_arc_receiver_forward_instance) << (Receiver ? Receiver->getSourceRange() : SourceRange(SuperLoc)) : PDiag(diag::warn_receiver_forward_instance) << (Receiver ? Receiver->getSourceRange() : SourceRange(SuperLoc)))) { - if (getLangOptions().ObjCAutoRefCount) + if (getLangOpts().ObjCAutoRefCount) return ExprError(); forwardClass = OCIType->getInterfaceDecl(); @@ -2050,7 +2050,7 @@ ExprResult Sema::BuildInstanceMessage(Expr *Receiver, // If we have implementations in scope, check "private" methods. Method = LookupPrivateInstanceMethod(Sel, ClassDecl); - if (!Method && getLangOptions().ObjCAutoRefCount) { + if (!Method && getLangOpts().ObjCAutoRefCount) { Diag(Loc, diag::err_arc_may_not_respond) << OCIType->getPointeeType() << Sel; return ExprError(); @@ -2071,7 +2071,7 @@ ExprResult Sema::BuildInstanceMessage(Expr *Receiver, } if (Method && DiagnoseUseOfDecl(Method, Loc, forwardClass)) return ExprError(); - } else if (!getLangOptions().ObjCAutoRefCount && + } else if (!getLangOpts().ObjCAutoRefCount && !Context.getObjCIdType().isNull() && (ReceiverType->isPointerType() || ReceiverType->isIntegerType())) { @@ -2093,7 +2093,7 @@ ExprResult Sema::BuildInstanceMessage(Expr *Receiver, ReceiverType = Receiver->getType(); } else { ExprResult ReceiverRes; - if (getLangOptions().CPlusPlus) + if (getLangOpts().CPlusPlus) ReceiverRes = PerformContextuallyConvertToObjCPointer(Receiver); if (ReceiverRes.isUsable()) { Receiver = ReceiverRes.take(); @@ -2137,7 +2137,7 @@ ExprResult Sema::BuildInstanceMessage(Expr *Receiver, // In ARC, forbid the user from sending messages to // retain/release/autorelease/dealloc/retainCount explicitly. - if (getLangOptions().ObjCAutoRefCount) { + if (getLangOpts().ObjCAutoRefCount) { ObjCMethodFamily family = (Method ? Method->getMethodFamily() : Sel.getMethodFamily()); switch (family) { @@ -2231,7 +2231,7 @@ ExprResult Sema::BuildInstanceMessage(Expr *Receiver, checkCocoaAPI(*this, Result); } - if (getLangOptions().ObjCAutoRefCount) { + if (getLangOpts().ObjCAutoRefCount) { // In ARC, annotate delegate init calls. if (Result->getMethodFamily() == OMF_init && (SuperLoc.isValid() || isSelfExpr(Receiver))) { diff --git a/lib/Sema/SemaInit.cpp b/lib/Sema/SemaInit.cpp index 5de785207f..78a9f89d59 100644 --- a/lib/Sema/SemaInit.cpp +++ b/lib/Sema/SemaInit.cpp @@ -106,7 +106,7 @@ static void CheckStringInit(Expr *Str, QualType &DeclT, const ArrayType *AT, // We have an array of character type with known size. However, // the size may be smaller or larger than the string we are initializing. // FIXME: Avoid truncation for 64-bit length strings. - if (S.getLangOptions().CPlusPlus) { + if (S.getLangOpts().CPlusPlus) { if (StringLiteral *SL = dyn_cast<StringLiteral>(Str)) { // For Pascal strings it's OK to strip off the terminating null character, // so the example below is valid: @@ -616,8 +616,8 @@ void InitListChecker::CheckExplicitInitList(const InitializedEntity &Entity, if (Index < IList->getNumInits()) { // We have leftover initializers if (VerifyOnly) { - if (SemaRef.getLangOptions().CPlusPlus || - (SemaRef.getLangOptions().OpenCL && + if (SemaRef.getLangOpts().CPlusPlus || + (SemaRef.getLangOpts().OpenCL && IList->getType()->isVectorType())) { hadError = true; } @@ -627,7 +627,7 @@ void InitListChecker::CheckExplicitInitList(const InitializedEntity &Entity, if (StructuredIndex == 1 && IsStringInit(StructuredList->getInit(0), T, SemaRef.Context)) { unsigned DK = diag::warn_excess_initializers_in_char_array_initializer; - if (SemaRef.getLangOptions().CPlusPlus) { + if (SemaRef.getLangOpts().CPlusPlus) { DK = diag::err_excess_initializers_in_char_array_initializer; hadError = true; } @@ -646,11 +646,11 @@ void InitListChecker::CheckExplicitInitList(const InitializedEntity &Entity, 4; unsigned DK = diag::warn_excess_initializers; - if (SemaRef.getLangOptions().CPlusPlus) { + if (SemaRef.getLangOpts().CPlusPlus) { DK = diag::err_excess_initializers; hadError = true; } - if (SemaRef.getLangOptions().OpenCL && initKind == 1) { + if (SemaRef.getLangOpts().OpenCL && initKind == 1) { DK = diag::err_excess_initializers; hadError = true; } @@ -782,7 +782,7 @@ void InitListChecker::CheckSubElementType(const InitializedEntity &Entity, // Fall through for subaggregate initialization. - } else if (SemaRef.getLangOptions().CPlusPlus) { + } else if (SemaRef.getLangOpts().CPlusPlus) { // C++ [dcl.init.aggr]p12: // All implicit type conversions (clause 4) are considered when // initializing the aggregate member with an initializer from @@ -845,7 +845,7 @@ void InitListChecker::CheckSubElementType(const InitializedEntity &Entity, // subaggregate, brace elision is assumed and the initializer is // considered for the initialization of the first member of // the subaggregate. - if (!SemaRef.getLangOptions().OpenCL && + if (!SemaRef.getLangOpts().OpenCL && (ElemType->isAggregateType() || ElemType->isVectorType())) { CheckImplicitInitList(Entity, IList, ElemType, Index, StructuredList, StructuredIndex); @@ -884,7 +884,7 @@ void InitListChecker::CheckComplexType(const InitializedEntity &Entity, // This is an extension in C. (The builtin _Complex type does not exist // in the C++ standard.) - if (!SemaRef.getLangOptions().CPlusPlus && !VerifyOnly) + if (!SemaRef.getLangOpts().CPlusPlus && !VerifyOnly) SemaRef.Diag(IList->getLocStart(), diag::ext_complex_component_init) << IList->getSourceRange(); @@ -909,11 +909,11 @@ void InitListChecker::CheckScalarType(const InitializedEntity &Entity, if (Index >= IList->getNumInits()) { if (!VerifyOnly) SemaRef.Diag(IList->getLocStart(), - SemaRef.getLangOptions().CPlusPlus0x ? + SemaRef.getLangOpts().CPlusPlus0x ? diag::warn_cxx98_compat_empty_scalar_initializer : diag::err_empty_scalar_initializer) << IList->getSourceRange(); - hadError = !SemaRef.getLangOptions().CPlusPlus0x; + hadError = !SemaRef.getLangOpts().CPlusPlus0x; ++Index; ++StructuredIndex; return; @@ -993,7 +993,7 @@ void InitListChecker::CheckReferenceType(const InitializedEntity &Entity, } Expr *expr = IList->getInit(Index); - if (isa<InitListExpr>(expr) && !SemaRef.getLangOptions().CPlusPlus0x) { + if (isa<InitListExpr>(expr) && !SemaRef.getLangOpts().CPlusPlus0x) { if (!VerifyOnly) SemaRef.Diag(IList->getLocStart(), diag::err_init_non_aggr_init_list) << DeclType << IList->getSourceRange(); @@ -1046,7 +1046,7 @@ void InitListChecker::CheckVectorType(const InitializedEntity &Entity, return; } - if (!SemaRef.getLangOptions().OpenCL) { + if (!SemaRef.getLangOpts().OpenCL) { // If the initializing element is a vector, try to copy-initialize // instead of breaking it apart (which is doomed to failure anyway). Expr *Init = IList->getInit(Index); @@ -1281,7 +1281,7 @@ bool InitListChecker::CheckFlexibleArrayInit(const InitializedEntity &Entity, cast<InitListExpr>(InitExpr)->getNumInits() == 0) { // Empty flexible array init always allowed as an extension FlexArrayDiag = diag::ext_flexible_array_init; - } else if (SemaRef.getLangOptions().CPlusPlus) { + } else if (SemaRef.getLangOpts().CPlusPlus) { // Disallow flexible array init in C++; it is not required for gcc // compatibility, and it needs work to IRGen correctly in general. FlexArrayDiag = diag::err_flexible_array_init; @@ -1657,7 +1657,7 @@ InitListChecker::CheckDesignatedInitializer(const InitializedEntity &Entity, Loc = D->getFieldLoc(); if (!VerifyOnly) SemaRef.Diag(Loc, diag::err_field_designator_non_aggr) - << SemaRef.getLangOptions().CPlusPlus << CurrentObjectType; + << SemaRef.getLangOpts().CPlusPlus << CurrentObjectType; ++Index; return true; } @@ -1719,9 +1719,9 @@ InitListChecker::CheckDesignatedInitializer(const InitializedEntity &Entity, RT->getDecl()); if (Corrected) { std::string CorrectedStr( - Corrected.getAsString(SemaRef.getLangOptions())); + Corrected.getAsString(SemaRef.getLangOpts())); std::string CorrectedQuotedStr( - Corrected.getQuoted(SemaRef.getLangOptions())); + Corrected.getQuoted(SemaRef.getLangOpts())); ReplacementField = Corrected.getCorrectionDeclAs<FieldDecl>(); SemaRef.Diag(D->getFieldLoc(), diag::err_field_designator_unknown_suggest) @@ -2272,7 +2272,7 @@ ExprResult Sema::ActOnDesignatedInitializer(Designation &Desig, InitExpressions.data(), InitExpressions.size(), Loc, GNUSyntax, Init.takeAs<Expr>()); - if (!getLangOptions().C99) + if (!getLangOpts().C99) Diag(DIE->getLocStart(), diag::ext_designated_init) << DIE->getSourceRange(); @@ -2683,7 +2683,7 @@ void InitializationSequence::SetOverloadFailure(FailureKind Failure, static void MaybeProduceObjCObject(Sema &S, InitializationSequence &Sequence, const InitializedEntity &Entity) { - if (!S.getLangOptions().ObjCAutoRefCount) return; + if (!S.getLangOpts().ObjCAutoRefCount) return; /// When initializing a parameter, produce the value if it's marked /// __attribute__((ns_consumed)). @@ -3023,7 +3023,7 @@ static void TryReferenceListInitialization(Sema &S, InitializationSequence &Sequence) { // First, catch C++03 where this isn't possible. - if (!S.getLangOptions().CPlusPlus0x) { + if (!S.getLangOpts().CPlusPlus0x) { Sequence.SetFailed(InitializationSequence::FK_ReferenceBindingToInitList); return; } @@ -3089,7 +3089,7 @@ static void TryListInitialization(Sema &S, // C++ doesn't allow scalar initialization with more than one argument. // But C99 complex numbers are scalars and it makes sense there. - if (S.getLangOptions().CPlusPlus && DestType->isScalarType() && + if (S.getLangOpts().CPlusPlus && DestType->isScalarType() && !DestType->isAnyComplexType() && InitList->getNumInits() > 1) { Sequence.SetFailed(InitializationSequence::FK_TooManyInitsForScalar); return; @@ -3105,7 +3105,7 @@ static void TryListInitialization(Sema &S, } if (!DestType->isAggregateType()) { - if (S.getLangOptions().CPlusPlus0x) { + if (S.getLangOpts().CPlusPlus0x) { Expr *Arg = InitList; // A direct-initializer is not list-syntax, i.e. there's no special // treatment of "A a({1, 2});". @@ -3122,7 +3122,7 @@ static void TryListInitialization(Sema &S, InitListChecker CheckInitList(S, Entity, InitList, DestType, /*VerifyOnly=*/true, Kind.getKind() != InitializationKind::IK_DirectList || - !S.getLangOptions().CPlusPlus0x); + !S.getLangOpts().CPlusPlus0x); if (CheckInitList.HadError()) { Sequence.SetFailed(InitializationSequence::FK_ListInitializationFailed); return; @@ -3479,9 +3479,9 @@ static void TryReferenceInitializationCore(Sema &S, // // The constructor that would be used to make the copy shall // be callable whether or not the copy is actually done. - if (!S.getLangOptions().CPlusPlus0x && !S.getLangOptions().MicrosoftExt) + if (!S.getLangOpts().CPlusPlus0x && !S.getLangOpts().MicrosoftExt) Sequence.AddExtraneousCopyToTemporary(cv2T2); - else if (S.getLangOptions().CPlusPlus0x) + else if (S.getLangOpts().CPlusPlus0x) CheckCXX98CompatAccessibleCopy(S, Entity, Initializer); } @@ -3612,7 +3612,7 @@ static void TryValueInitialization(Sema &S, // constructor (12.1), then the default constructor for T is // called (and the initialization is ill-formed if T has no // accessible default constructor); - if (!S.getLangOptions().CPlusPlus0x) { + if (!S.getLangOpts().CPlusPlus0x) { if (ClassDecl->hasUserDeclaredConstructor()) // FIXME: we really want to refer to a single subobject of the array, // but Entity doesn't have a way to capture that (yet). @@ -3659,7 +3659,7 @@ static void TryDefaultInitialization(Sema &S, // - if T is a (possibly cv-qualified) class type (Clause 9), the default // constructor for T is called (and the initialization is ill-formed if // T has no accessible default constructor); - if (DestType->isRecordType() && S.getLangOptions().CPlusPlus) { + if (DestType->isRecordType() && S.getLangOpts().CPlusPlus) { TryConstructorInitialization(S, Entity, Kind, 0, 0, DestType, Sequence); return; } @@ -3669,7 +3669,7 @@ static void TryDefaultInitialization(Sema &S, // If a program calls for the default initialization of an object of // a const-qualified type T, T shall be a class type with a user-provided // default constructor. - if (DestType.isConstQualified() && S.getLangOptions().CPlusPlus) { + if (DestType.isConstQualified() && S.getLangOpts().CPlusPlus) { Sequence.SetFailed(InitializationSequence::FK_DefaultInitOfConst); return; } @@ -4079,7 +4079,7 @@ InitializationSequence::InitializationSequence(Sema &S, // Note: as an GNU C extension, we allow initialization of an // array from a compound literal that creates an array of the same // type, so long as the initializer has no side effects. - if (!S.getLangOptions().CPlusPlus && Initializer && + if (!S.getLangOpts().CPlusPlus && Initializer && isa<CompoundLiteralExpr>(Initializer->IgnoreParens()) && Initializer->getType()->isArrayType()) { const ArrayType *SourceAT @@ -4094,7 +4094,7 @@ InitializationSequence::InitializationSequence(Sema &S, } // Note: as a GNU C++ extension, we allow initialization of a // class member from a parenthesized initializer list. - else if (S.getLangOptions().CPlusPlus && + else if (S.getLangOpts().CPlusPlus && Entity.getKind() == InitializedEntity::EK_Member && Initializer && isa<InitListExpr>(Initializer)) { TryListInitialization(S, Entity, Kind, cast<InitListExpr>(Initializer), @@ -4110,12 +4110,12 @@ InitializationSequence::InitializationSequence(Sema &S, // Determine whether we should consider writeback conversions for // Objective-C ARC. - bool allowObjCWritebackConversion = S.getLangOptions().ObjCAutoRefCount && + bool allowObjCWritebackConversion = S.getLangOpts().ObjCAutoRefCount && Entity.getKind() == InitializedEntity::EK_Parameter; // We're at the end of the line for C: it's either a write-back conversion // or it's a C assignment. There's no need to check anything else. - if (!S.getLangOptions().CPlusPlus) { + if (!S.getLangOpts().CPlusPlus) { // If allowed, check whether this is an Objective-C writeback conversion. if (allowObjCWritebackConversion && tryObjCWritebackConversion(S, *this, Entity, Initializer)) { @@ -4128,7 +4128,7 @@ InitializationSequence::InitializationSequence(Sema &S, return; } - assert(S.getLangOptions().CPlusPlus); + assert(S.getLangOpts().CPlusPlus); // - If the destination type is a (possibly cv-qualified) class type: if (DestType->isRecordType()) { @@ -4549,7 +4549,7 @@ static ExprResult CopyObject(Sema &S, static void CheckCXX98CompatAccessibleCopy(Sema &S, const InitializedEntity &Entity, Expr *CurInitExpr) { - assert(S.getLangOptions().CPlusPlus0x); + assert(S.getLangOpts().CPlusPlus0x); const RecordType *Record = CurInitExpr->getType()->getAs<RecordType>(); if (!Record) @@ -4959,7 +4959,7 @@ InitializationSequence::Perform(Sema &S, // If we're binding to an Objective-C object that has lifetime, we // need cleanups. - if (S.getLangOptions().ObjCAutoRefCount && + if (S.getLangOpts().ObjCAutoRefCount && CurInit.get()->getType()->isObjCLifetimeType()) S.ExprNeedsCleanups = true; @@ -5114,7 +5114,7 @@ InitializationSequence::Perform(Sema &S, InitListChecker PerformInitList(S, IsTemporary ? TempEntity : Entity, InitList, Ty, /*VerifyOnly=*/false, Kind.getKind() != InitializationKind::IK_DirectList || - !S.getLangOptions().CPlusPlus0x); + !S.getLangOpts().CPlusPlus0x); if (PerformInitList.HadError()) return ExprError(); @@ -5195,7 +5195,7 @@ InitializationSequence::Perform(Sema &S, // the call to the object's constructor within the next step. ConstructorInitRequiresZeroInit = true; } else if (Kind.getKind() == InitializationKind::IK_Value && - S.getLangOptions().CPlusPlus && + S.getLangOpts().CPlusPlus && !Kind.isImplicitValueInit()) { TypeSourceInfo *TSInfo = Entity.getTypeSourceInfo(); if (!TSInfo) @@ -5716,7 +5716,7 @@ bool InitializationSequence::Diagnose(Sema &S, InitListChecker DiagnoseInitList(S, Entity, InitList, DestType, /*VerifyOnly=*/false, Kind.getKind() != InitializationKind::IK_DirectList || - !S.getLangOptions().CPlusPlus0x); + !S.getLangOpts().CPlusPlus0x); assert(DiagnoseInitList.HadError() && "Inconsistent init list check result."); break; @@ -6055,7 +6055,7 @@ static void DiagnoseNarrowingInInitList(Sema &S, InitializationSequence &Seq, // narrowing conversion even if the value is a constant and can be // represented exactly as an integer. S.Diag(PostInit->getLocStart(), - S.getLangOptions().MicrosoftExt || !S.getLangOptions().CPlusPlus0x? + S.getLangOpts().MicrosoftExt || !S.getLangOpts().CPlusPlus0x? diag::warn_init_list_type_narrowing : S.isSFINAEContext()? diag::err_init_list_type_narrowing_sfinae @@ -6068,7 +6068,7 @@ static void DiagnoseNarrowingInInitList(Sema &S, InitializationSequence &Seq, case NK_Constant_Narrowing: // A constant value was narrowed. S.Diag(PostInit->getLocStart(), - S.getLangOptions().MicrosoftExt || !S.getLangOptions().CPlusPlus0x? + S.getLangOpts().MicrosoftExt || !S.getLangOpts().CPlusPlus0x? diag::warn_init_list_constant_narrowing : S.isSFINAEContext()? diag::err_init_list_constant_narrowing_sfinae @@ -6081,7 +6081,7 @@ static void DiagnoseNarrowingInInitList(Sema &S, InitializationSequence &Seq, case NK_Variable_Narrowing: // A variable's value may have been narrowed. S.Diag(PostInit->getLocStart(), - S.getLangOptions().MicrosoftExt || !S.getLangOptions().CPlusPlus0x? + S.getLangOpts().MicrosoftExt || !S.getLangOpts().CPlusPlus0x? diag::warn_init_list_variable_narrowing : S.isSFINAEContext()? diag::err_init_list_variable_narrowing_sfinae @@ -6103,7 +6103,7 @@ static void DiagnoseNarrowingInInitList(Sema &S, InitializationSequence &Seq, // getQualifiedNameAsString() includes non-machine-parsable components. OS << *TT->getDecl(); } else if (const BuiltinType *BT = EntityType->getAs<BuiltinType>()) - OS << BT->getName(S.getLangOptions()); + OS << BT->getName(S.getLangOpts()); else { // Oops, we didn't find the actual type of the variable. Don't emit a fixit // with a broken cast. diff --git a/lib/Sema/SemaLambda.cpp b/lib/Sema/SemaLambda.cpp index 3611350de0..2a09da0f94 100644 --- a/lib/Sema/SemaLambda.cpp +++ b/lib/Sema/SemaLambda.cpp @@ -643,7 +643,7 @@ ExprResult Sema::ActOnLambdaExpr(SourceLocation StartLoc, Stmt *Body, // non-explicit const conversion function to a block pointer having the // same parameter and return types as the closure type's function call // operator. - if (getLangOptions().Blocks && getLangOptions().ObjC1) + if (getLangOpts().Blocks && getLangOpts().ObjC1) addBlockPointerConversion(*this, IntroducerRange, Class, CallOperator); // Finalize the lambda class. diff --git a/lib/Sema/SemaLookup.cpp b/lib/Sema/SemaLookup.cpp index ea92b9dcd5..f1eb522415 100644 --- a/lib/Sema/SemaLookup.cpp +++ b/lib/Sema/SemaLookup.cpp @@ -281,7 +281,7 @@ static inline unsigned getIDNS(Sema::LookupNameKind NameKind, } void LookupResult::configure() { - IDNS = getIDNS(LookupKind, SemaRef.getLangOptions().CPlusPlus, + IDNS = getIDNS(LookupKind, SemaRef.getLangOpts().CPlusPlus, isForRedeclaration()); // If we're looking for one of the allocation or deallocation @@ -497,7 +497,7 @@ static bool LookupBuiltin(Sema &S, LookupResult &R) { if (unsigned BuiltinID = II->getBuiltinID()) { // In C++, we don't have any predefined library functions like // 'malloc'. Instead, we'll just error. - if (S.getLangOptions().CPlusPlus && + if (S.getLangOpts().CPlusPlus && S.Context.BuiltinInfo.isPredefinedLibFunction(BuiltinID)) return false; @@ -555,7 +555,7 @@ void Sema::ForceDeclarationOfImplicitMembers(CXXRecordDecl *Class) { if (!Class->hasDeclaredCopyAssignment()) DeclareImplicitCopyAssignment(Class); - if (getLangOptions().CPlusPlus0x) { + if (getLangOpts().CPlusPlus0x) { // If the move constructor has not yet been declared, do so now. if (Class->needsImplicitMoveConstructor()) DeclareImplicitMoveConstructor(Class); // might not actually do it @@ -606,7 +606,7 @@ static void DeclareImplicitMemberFunctionsWithName(Sema &S, S.DeclareImplicitDefaultConstructor(Class); if (!Record->hasDeclaredCopyConstructor()) S.DeclareImplicitCopyConstructor(Class); - if (S.getLangOptions().CPlusPlus0x && + if (S.getLangOpts().CPlusPlus0x && Record->needsImplicitMoveConstructor()) S.DeclareImplicitMoveConstructor(Class); } @@ -629,7 +629,7 @@ static void DeclareImplicitMemberFunctionsWithName(Sema &S, CXXRecordDecl *Class = const_cast<CXXRecordDecl *>(Record); if (!Record->hasDeclaredCopyAssignment()) S.DeclareImplicitCopyAssignment(Class); - if (S.getLangOptions().CPlusPlus0x && + if (S.getLangOpts().CPlusPlus0x && Record->needsImplicitMoveAssignment()) S.DeclareImplicitMoveAssignment(Class); } @@ -647,7 +647,7 @@ static bool LookupDirect(Sema &S, LookupResult &R, const DeclContext *DC) { bool Found = false; // Lazily declare C++ special member functions. - if (S.getLangOptions().CPlusPlus) + if (S.getLangOpts().CPlusPlus) DeclareImplicitMemberFunctionsWithName(S, R.getLookupName(), DC); // Perform lookup into this declaration context. @@ -835,7 +835,7 @@ static std::pair<DeclContext *, bool> findOuterContext(Scope *S) { } bool Sema::CppLookupName(LookupResult &R, Scope *S) { - assert(getLangOptions().CPlusPlus && "Can perform only C++ lookup"); + assert(getLangOpts().CPlusPlus && "Can perform only C++ lookup"); DeclarationName Name = R.getLookupName(); @@ -1112,7 +1112,7 @@ bool Sema::LookupName(LookupResult &R, Scope *S, bool AllowBuiltinCreation) { LookupNameKind NameKind = R.getLookupKind(); - if (!getLangOptions().CPlusPlus) { + if (!getLangOpts().CPlusPlus) { // Unqualified name lookup in C/Objective-C is purely lexical, so // search in the declarations attached to the name. if (NameKind == Sema::LookupRedeclarationWithLinkage) { @@ -2295,13 +2295,13 @@ Sema::SpecialMemberOverloadResult *Sema::LookupSpecialMember(CXXRecordDecl *RD, Name = Context.DeclarationNames.getCXXConstructorName(CanTy); if (!RD->hasDeclaredCopyConstructor()) DeclareImplicitCopyConstructor(RD); - if (getLangOptions().CPlusPlus0x && RD->needsImplicitMoveConstructor()) + if (getLangOpts().CPlusPlus0x && RD->needsImplicitMoveConstructor()) DeclareImplicitMoveConstructor(RD); } else { Name = Context.DeclarationNames.getCXXOperatorName(OO_Equal); if (!RD->hasDeclaredCopyAssignment()) DeclareImplicitCopyAssignment(RD); - if (getLangOptions().CPlusPlus0x && RD->needsImplicitMoveAssignment()) + if (getLangOpts().CPlusPlus0x && RD->needsImplicitMoveAssignment()) DeclareImplicitMoveAssignment(RD); } @@ -2465,7 +2465,7 @@ DeclContext::lookup_result Sema::LookupConstructors(CXXRecordDecl *Class) { DeclareImplicitDefaultConstructor(Class); if (!Class->hasDeclaredCopyConstructor()) DeclareImplicitCopyConstructor(Class); - if (getLangOptions().CPlusPlus0x && Class->needsImplicitMoveConstructor()) + if (getLangOpts().CPlusPlus0x && Class->needsImplicitMoveConstructor()) DeclareImplicitMoveConstructor(Class); } @@ -3097,7 +3097,7 @@ void Sema::LookupVisibleDecls(Scope *S, LookupNameKind Kind, // unqualified name lookup. Scope *Initial = S; UnqualUsingDirectiveSet UDirs; - if (getLangOptions().CPlusPlus) { + if (getLangOpts().CPlusPlus) { // Find the first namespace or translation-unit scope. while (S && !isNamespaceOrTranslationUnitScope(S)) S = S->getParent(); @@ -3287,8 +3287,8 @@ void TypoCorrectionConsumer::addCorrection(TypoCorrection Correction) { // FIXME: The following should be rolled up into an operator< on // TypoCorrection with a more principled definition. CurrentCorrection.isKeyword() < Correction.isKeyword() || - Correction.getAsString(SemaRef.getLangOptions()) < - CurrentCorrection.getAsString(SemaRef.getLangOptions())) + Correction.getAsString(SemaRef.getLangOpts()) < + CurrentCorrection.getAsString(SemaRef.getLangOpts())) CurrentCorrection = Correction; while (BestResults.size() > MaxTypoDistanceResultSets) { @@ -3566,19 +3566,19 @@ static void AddKeywordsToConsumer(Sema &SemaRef, for (unsigned I = 0; I != NumCTypeSpecs; ++I) Consumer.addKeywordResult(CTypeSpecs[I]); - if (SemaRef.getLangOptions().C99) + if (SemaRef.getLangOpts().C99) Consumer.addKeywordResult("restrict"); - if (SemaRef.getLangOptions().Bool || SemaRef.getLangOptions().CPlusPlus) + if (SemaRef.getLangOpts().Bool || SemaRef.getLangOpts().CPlusPlus) Consumer.addKeywordResult("bool"); - else if (SemaRef.getLangOptions().C99) + else if (SemaRef.getLangOpts().C99) Consumer.addKeywordResult("_Bool"); - if (SemaRef.getLangOptions().CPlusPlus) { + if (SemaRef.getLangOpts().CPlusPlus) { Consumer.addKeywordResult("class"); Consumer.addKeywordResult("typename"); Consumer.addKeywordResult("wchar_t"); - if (SemaRef.getLangOptions().CPlusPlus0x) { + if (SemaRef.getLangOpts().CPlusPlus0x) { Consumer.addKeywordResult("char16_t"); Consumer.addKeywordResult("char32_t"); Consumer.addKeywordResult("constexpr"); @@ -3587,11 +3587,11 @@ static void AddKeywordsToConsumer(Sema &SemaRef, } } - if (SemaRef.getLangOptions().GNUMode) + if (SemaRef.getLangOpts().GNUMode) Consumer.addKeywordResult("typeof"); } - if (CCC.WantCXXNamedCasts && SemaRef.getLangOptions().CPlusPlus) { + if (CCC.WantCXXNamedCasts && SemaRef.getLangOpts().CPlusPlus) { Consumer.addKeywordResult("const_cast"); Consumer.addKeywordResult("dynamic_cast"); Consumer.addKeywordResult("reinterpret_cast"); @@ -3600,12 +3600,12 @@ static void AddKeywordsToConsumer(Sema &SemaRef, if (CCC.WantExpressionKeywords) { Consumer.addKeywordResult("sizeof"); - if (SemaRef.getLangOptions().Bool || SemaRef.getLangOptions().CPlusPlus) { + if (SemaRef.getLangOpts().Bool || SemaRef.getLangOpts().CPlusPlus) { Consumer.addKeywordResult("false"); Consumer.addKeywordResult("true"); } - if (SemaRef.getLangOptions().CPlusPlus) { + if (SemaRef.getLangOpts().CPlusPlus) { const char *CXXExprs[] = { "delete", "new", "operator", "throw", "typeid" }; @@ -3617,7 +3617,7 @@ static void AddKeywordsToConsumer(Sema &SemaRef, cast<CXXMethodDecl>(SemaRef.CurContext)->isInstance()) Consumer.addKeywordResult("this"); - if (SemaRef.getLangOptions().CPlusPlus0x) { + if (SemaRef.getLangOpts().CPlusPlus0x) { Consumer.addKeywordResult("alignof"); Consumer.addKeywordResult("nullptr"); } @@ -3633,7 +3633,7 @@ static void AddKeywordsToConsumer(Sema &SemaRef, for (unsigned I = 0; I != NumCStmts; ++I) Consumer.addKeywordResult(CStmts[I]); - if (SemaRef.getLangOptions().CPlusPlus) { + if (SemaRef.getLangOpts().CPlusPlus) { Consumer.addKeywordResult("catch"); Consumer.addKeywordResult("try"); } @@ -3649,7 +3649,7 @@ static void AddKeywordsToConsumer(Sema &SemaRef, Consumer.addKeywordResult("default"); } } else { - if (SemaRef.getLangOptions().CPlusPlus) { + if (SemaRef.getLangOpts().CPlusPlus) { Consumer.addKeywordResult("namespace"); Consumer.addKeywordResult("template"); } @@ -3665,10 +3665,10 @@ static void AddKeywordsToConsumer(Sema &SemaRef, } } - if (SemaRef.getLangOptions().CPlusPlus) { + if (SemaRef.getLangOpts().CPlusPlus) { Consumer.addKeywordResult("using"); - if (SemaRef.getLangOptions().CPlusPlus0x) + if (SemaRef.getLangOpts().CPlusPlus0x) Consumer.addKeywordResult("static_assert"); } } @@ -3718,13 +3718,13 @@ TypoCorrection Sema::CorrectTypo(const DeclarationNameInfo &TypoName, DeclContext *MemberContext, bool EnteringContext, const ObjCObjectPointerType *OPT) { - if (Diags.hasFatalErrorOccurred() || !getLangOptions().SpellChecking) + if (Diags.hasFatalErrorOccurred() || !getLangOpts().SpellChecking) return TypoCorrection(); // In Microsoft mode, don't perform typo correction in a template member // function dependent context because it interferes with the "lookup into // dependent bases of class templates" feature. - if (getLangOptions().MicrosoftMode && CurContext->isDependentContext() && + if (getLangOpts().MicrosoftMode && CurContext->isDependentContext() && isa<CXXMethodDecl>(CurContext)) return TypoCorrection(); @@ -3852,7 +3852,7 @@ TypoCorrection Sema::CorrectTypo(const DeclarationNameInfo &TypoName, } // Build the NestedNameSpecifiers for the KnownNamespaces - if (getLangOptions().CPlusPlus) { + if (getLangOpts().CPlusPlus) { // Load any externally-known namespaces. if (ExternalSource && !LoadedExternalKnownNamespaces) { SmallVector<NamespaceDecl *, 4> ExternalKnownNamespaces; @@ -3942,12 +3942,12 @@ TypoCorrection Sema::CorrectTypo(const DeclarationNameInfo &TypoName, if (DI->second->empty()) Consumer.erase(DI); - else if (!getLangOptions().CPlusPlus || QualifiedResults.empty() || !ED) + else if (!getLangOpts().CPlusPlus || QualifiedResults.empty() || !ED) // If there are results in the closest possible bucket, stop break; // Only perform the qualified lookups for C++ - if (getLangOptions().CPlusPlus) { + if (getLangOpts().CPlusPlus) { TmpRes.suppressDiagnostics(); for (llvm::SmallVector<TypoCorrection, 16>::iterator QRI = QualifiedResults.begin(), diff --git a/lib/Sema/SemaObjCProperty.cpp b/lib/Sema/SemaObjCProperty.cpp index 617460d492..5c28db4c5e 100644 --- a/lib/Sema/SemaObjCProperty.cpp +++ b/lib/Sema/SemaObjCProperty.cpp @@ -112,9 +112,9 @@ Decl *Sema::ActOnProperty(Scope *S, SourceLocation AtLoc, unsigned Attributes = ODS.getPropertyAttributes(); TypeSourceInfo *TSI = GetTypeForDeclarator(FD.D, S); QualType T = TSI->getType(); - if ((getLangOptions().getGC() != LangOptions::NonGC && + if ((getLangOpts().getGC() != LangOptions::NonGC && T.isObjCGCWeak()) || - (getLangOptions().ObjCAutoRefCount && + (getLangOpts().ObjCAutoRefCount && T.getObjCLifetime() == Qualifiers::OCL_Weak)) Attributes |= ObjCDeclSpec::DQ_PR_weak; @@ -145,7 +145,7 @@ Decl *Sema::ActOnProperty(Scope *S, SourceLocation AtLoc, MethodImplKind); if (Res) { CheckObjCPropertyAttributes(Res, AtLoc, Attributes); - if (getLangOptions().ObjCAutoRefCount) + if (getLangOpts().ObjCAutoRefCount) checkARCPropertyDecl(*this, cast<ObjCPropertyDecl>(Res)); } return Res; @@ -163,7 +163,7 @@ Decl *Sema::ActOnProperty(Scope *S, SourceLocation AtLoc, // Validate the attributes on the @property. CheckObjCPropertyAttributes(Res, AtLoc, Attributes); - if (getLangOptions().ObjCAutoRefCount) + if (getLangOpts().ObjCAutoRefCount) checkARCPropertyDecl(*this, Res); return Res; @@ -391,7 +391,7 @@ ObjCPropertyDecl *Sema::CreatePropertyDecl(Scope *S, // Issue a warning if property is 'assign' as default and its object, which is // gc'able conforms to NSCopying protocol - if (getLangOptions().getGC() != LangOptions::NonGC && + if (getLangOpts().getGC() != LangOptions::NonGC && isAssign && !(Attributes & ObjCDeclSpec::DQ_PR_assign)) if (const ObjCObjectPointerType *ObjPtrTy = T->getAs<ObjCObjectPointerType>()) { @@ -665,7 +665,7 @@ Decl *Sema::ActOnPropertyImplDecl(Scope *S, QualType PropType = property->getType(); QualType PropertyIvarType = PropType.getNonReferenceType(); - if (getLangOptions().ObjCAutoRefCount && + if (getLangOpts().ObjCAutoRefCount && (property->getPropertyAttributesAsWritten() & ObjCPropertyDecl::OBJC_PR_readonly) && PropertyIvarType->isObjCRetainableType()) { @@ -677,8 +677,8 @@ Decl *Sema::ActOnPropertyImplDecl(Scope *S, // Add GC __weak to the ivar type if the property is weak. if ((kind & ObjCPropertyDecl::OBJC_PR_weak) && - getLangOptions().getGC() != LangOptions::NonGC) { - assert(!getLangOptions().ObjCAutoRefCount); + getLangOpts().getGC() != LangOptions::NonGC) { + assert(!getLangOpts().ObjCAutoRefCount); if (PropertyIvarType.isObjCGCStrong()) { Diag(PropertyLoc, diag::err_gc_weak_property_strong_type); Diag(property->getLocation(), diag::note_property_declare); @@ -691,7 +691,7 @@ Decl *Sema::ActOnPropertyImplDecl(Scope *S, if (!Ivar) { // In ARC, give the ivar a lifetime qualifier based on the // property attributes. - if (getLangOptions().ObjCAutoRefCount && + if (getLangOpts().ObjCAutoRefCount && !PropertyIvarType.getObjCLifetime() && PropertyIvarType->isObjCRetainableType()) { @@ -715,7 +715,7 @@ Decl *Sema::ActOnPropertyImplDecl(Scope *S, Diag(property->getLocation(), diag::note_property_declare); err = true; } - if (!err && !getLangOptions().ObjCRuntimeHasWeak) { + if (!err && !getLangOpts().ObjCRuntimeHasWeak) { Diag(PropertyLoc, diag::err_arc_weak_no_runtime); Diag(property->getLocation(), diag::note_property_declare); } @@ -728,8 +728,8 @@ Decl *Sema::ActOnPropertyImplDecl(Scope *S, } if (kind & ObjCPropertyDecl::OBJC_PR_weak && - !getLangOptions().ObjCAutoRefCount && - getLangOptions().getGC() == LangOptions::NonGC) { + !getLangOpts().ObjCAutoRefCount && + getLangOpts().getGC() == LangOptions::NonGC) { Diag(PropertyLoc, diag::error_synthesize_weak_non_arc_or_gc); Diag(property->getLocation(), diag::note_property_declare); } @@ -743,11 +743,11 @@ Decl *Sema::ActOnPropertyImplDecl(Scope *S, IDecl->makeDeclVisibleInContext(Ivar, false); property->setPropertyIvarDecl(Ivar); - if (!getLangOptions().ObjCNonFragileABI) + if (!getLangOpts().ObjCNonFragileABI) Diag(PropertyLoc, diag::error_missing_property_ivar_decl) << PropertyId; // Note! I deliberately want it to fall thru so, we have a // a property implementation and to avoid future warnings. - } else if (getLangOptions().ObjCNonFragileABI && + } else if (getLangOpts().ObjCNonFragileABI && !declaresSameEntity(ClassDeclared, IDecl)) { Diag(PropertyLoc, diag::error_ivar_in_superclass_use) << property->getDeclName() << Ivar->getDeclName() @@ -796,7 +796,7 @@ Decl *Sema::ActOnPropertyImplDecl(Scope *S, } // __weak is explicit. So it works on Canonical type. if ((PropType.isObjCGCWeak() && !IvarType.isObjCGCWeak() && - getLangOptions().getGC() != LangOptions::NonGC)) { + getLangOpts().getGC() != LangOptions::NonGC)) { Diag(PropertyLoc, diag::error_weak_property) << property->getDeclName() << Ivar->getDeclName(); Diag(Ivar->getLocation(), diag::note_ivar_decl); @@ -805,13 +805,13 @@ Decl *Sema::ActOnPropertyImplDecl(Scope *S, // Fall thru - see previous comment if ((property->getType()->isObjCObjectPointerType() || PropType.isObjCGCStrong()) && IvarType.isObjCGCWeak() && - getLangOptions().getGC() != LangOptions::NonGC) { + getLangOpts().getGC() != LangOptions::NonGC) { Diag(PropertyLoc, diag::error_strong_property) << property->getDeclName() << Ivar->getDeclName(); // Fall thru - see previous comment } } - if (getLangOptions().ObjCAutoRefCount) + if (getLangOpts().ObjCAutoRefCount) checkARCPropertyImpl(*this, PropertyLoc, property, Ivar); } else if (PropertyIvar) // @dynamic @@ -827,7 +827,7 @@ Decl *Sema::ActOnPropertyImplDecl(Scope *S, Ivar, PropertyIvarLoc); if (ObjCMethodDecl *getterMethod = property->getGetterMethodDecl()) { getterMethod->createImplicitParams(Context, IDecl); - if (getLangOptions().CPlusPlus && Synthesize && + if (getLangOpts().CPlusPlus && Synthesize && Ivar->getType()->isRecordType()) { // For Objective-C++, need to synthesize the AST for the IVAR object to be // returned by the getter as it must conform to C++'s copy-return rules. @@ -862,7 +862,7 @@ Decl *Sema::ActOnPropertyImplDecl(Scope *S, } if (ObjCMethodDecl *setterMethod = property->getSetterMethodDecl()) { setterMethod->createImplicitParams(Context, IDecl); - if (getLangOptions().CPlusPlus && Synthesize + if (getLangOpts().CPlusPlus && Synthesize && Ivar->getType()->isRecordType()) { // FIXME. Eventually we want to do this for Objective-C as well. ImplicitParamDecl *SelfDecl = setterMethod->getSelfDecl(); @@ -915,8 +915,8 @@ Decl *Sema::ActOnPropertyImplDecl(Scope *S, return 0; } IC->addPropertyImplementation(PIDecl); - if (getLangOptions().ObjCDefaultSynthProperties && - getLangOptions().ObjCNonFragileABI2 && + if (getLangOpts().ObjCDefaultSynthProperties && + getLangOpts().ObjCNonFragileABI2 && !IDecl->isObjCRequiresPropertyDefs()) { // Diagnose if an ivar was lazily synthesdized due to a previous // use and if 1) property is @dynamic or 2) property is synthesized @@ -1482,7 +1482,7 @@ void Sema::AtomicPropertySetterGetterRules (ObjCImplDecl* IMPDecl, ObjCContainerDecl* IDecl) { // Rules apply in non-GC mode only - if (getLangOptions().getGC() != LangOptions::NonGC) + if (getLangOpts().getGC() != LangOptions::NonGC) return; for (ObjCContainerDecl::prop_iterator I = IDecl->prop_begin(), E = IDecl->prop_end(); @@ -1569,7 +1569,7 @@ Sema::AtomicPropertySetterGetterRules (ObjCImplDecl* IMPDecl, } void Sema::DiagnoseOwningPropertyGetterSynthesis(const ObjCImplementationDecl *D) { - if (getLangOptions().getGC() == LangOptions::GCOnly) + if (getLangOpts().getGC() == LangOptions::GCOnly) return; for (ObjCImplementationDecl::propimpl_iterator @@ -1587,7 +1587,7 @@ void Sema::DiagnoseOwningPropertyGetterSynthesis(const ObjCImplementationDecl *D ObjCMethodFamily family = method->getMethodFamily(); if (family == OMF_alloc || family == OMF_copy || family == OMF_mutableCopy || family == OMF_new) { - if (getLangOptions().ObjCAutoRefCount) + if (getLangOpts().ObjCAutoRefCount) Diag(PID->getLocation(), diag::err_ownin_getter_rule); else Diag(PID->getLocation(), diag::warn_owning_getter_rule); @@ -1765,7 +1765,7 @@ void Sema::CheckObjCPropertyAttributes(Decl *PDecl, ObjCPropertyDecl *PropertyDecl = cast<ObjCPropertyDecl>(PDecl); QualType PropertyTy = PropertyDecl->getType(); - if (getLangOptions().ObjCAutoRefCount && + if (getLangOpts().ObjCAutoRefCount && (Attributes & ObjCDeclSpec::DQ_PR_readonly) && PropertyTy->isObjCRetainableType()) { // 'readonly' property with no obvious lifetime. @@ -1833,7 +1833,7 @@ void Sema::CheckObjCPropertyAttributes(Decl *PDecl, << "assign" << "strong"; Attributes &= ~ObjCDeclSpec::DQ_PR_strong; } - if (getLangOptions().ObjCAutoRefCount && + if (getLangOpts().ObjCAutoRefCount && (Attributes & ObjCDeclSpec::DQ_PR_weak)) { Diag(Loc, diag::err_objc_property_attr_mutually_exclusive) << "assign" << "weak"; @@ -1855,7 +1855,7 @@ void Sema::CheckObjCPropertyAttributes(Decl *PDecl, << "unsafe_unretained" << "strong"; Attributes &= ~ObjCDeclSpec::DQ_PR_strong; } - if (getLangOptions().ObjCAutoRefCount && + if (getLangOpts().ObjCAutoRefCount && (Attributes & ObjCDeclSpec::DQ_PR_weak)) { Diag(Loc, diag::err_objc_property_attr_mutually_exclusive) << "unsafe_unretained" << "weak"; @@ -1905,7 +1905,7 @@ void Sema::CheckObjCPropertyAttributes(Decl *PDecl, ObjCDeclSpec::DQ_PR_retain | ObjCDeclSpec::DQ_PR_strong | ObjCDeclSpec::DQ_PR_weak)) && PropertyTy->isObjCObjectPointerType()) { - if (getLangOptions().ObjCAutoRefCount) + if (getLangOpts().ObjCAutoRefCount) // With arc, @property definitions should default to (strong) when // not specified; including when property is 'readonly'. PropertyDecl->setPropertyAttributes(ObjCPropertyDecl::OBJC_PR_strong); @@ -1915,15 +1915,15 @@ void Sema::CheckObjCPropertyAttributes(Decl *PDecl, PropertyTy->isObjCQualifiedClassType()); // In non-gc, non-arc mode, 'Class' is treated as a 'void *' no need to // issue any warning. - if (isAnyClassTy && getLangOptions().getGC() == LangOptions::NonGC) + if (isAnyClassTy && getLangOpts().getGC() == LangOptions::NonGC) ; else { // Skip this warning in gc-only mode. - if (getLangOptions().getGC() != LangOptions::GCOnly) + if (getLangOpts().getGC() != LangOptions::GCOnly) Diag(Loc, diag::warn_objc_property_no_assignment_attribute); // If non-gc code warn that this is likely inappropriate. - if (getLangOptions().getGC() == LangOptions::NonGC) + if (getLangOpts().getGC() == LangOptions::NonGC) Diag(Loc, diag::warn_objc_property_default_assign_on_object); } } @@ -1936,10 +1936,10 @@ void Sema::CheckObjCPropertyAttributes(Decl *PDecl, if (!(Attributes & ObjCDeclSpec::DQ_PR_copy) &&!(Attributes & ObjCDeclSpec::DQ_PR_readonly) - && getLangOptions().getGC() == LangOptions::GCOnly + && getLangOpts().getGC() == LangOptions::GCOnly && PropertyTy->isBlockPointerType()) Diag(Loc, diag::warn_objc_property_copy_missing_on_block); - else if (getLangOptions().ObjCAutoRefCount && + else if (getLangOpts().ObjCAutoRefCount && (Attributes & ObjCDeclSpec::DQ_PR_retain) && !(Attributes & ObjCDeclSpec::DQ_PR_readonly) && !(Attributes & ObjCDeclSpec::DQ_PR_strong) && diff --git a/lib/Sema/SemaOverload.cpp b/lib/Sema/SemaOverload.cpp index 49301c2dc2..fe999b1599 100644 --- a/lib/Sema/SemaOverload.cpp +++ b/lib/Sema/SemaOverload.cpp @@ -292,7 +292,7 @@ NarrowingKind StandardConversionSequence::getNarrowingKind(ASTContext &Ctx, const Expr *Converted, APValue &ConstantValue) const { - assert(Ctx.getLangOptions().CPlusPlus && "narrowing check outside C++"); + assert(Ctx.getLangOpts().CPlusPlus && "narrowing check outside C++"); // C++11 [dcl.init.list]p7: // A narrowing conversion is an implicit conversion ... @@ -1107,7 +1107,7 @@ TryImplicitConversion(Sema &S, Expr *From, QualType ToType, return ICS; } - if (!S.getLangOptions().CPlusPlus) { + if (!S.getLangOpts().CPlusPlus) { ICS.setBad(BadConversionSequence::no_conversion, From, ToType); return ICS; } @@ -1180,7 +1180,7 @@ Sema::PerformImplicitConversion(Expr *From, QualType ToType, // Objective-C ARC: Determine whether we will allow the writeback conversion. bool AllowObjCWritebackConversion - = getLangOptions().ObjCAutoRefCount && + = getLangOpts().ObjCAutoRefCount && (Action == AA_Passing || Action == AA_Sending); ICS = clang::TryImplicitConversion(*this, From, ToType, @@ -1276,7 +1276,7 @@ static bool IsVectorConversion(ASTContext &Context, QualType FromType, // same size if (ToType->isVectorType() && FromType->isVectorType()) { if (Context.areCompatibleVectorTypes(FromType, ToType) || - (Context.getLangOptions().LaxVectorConversions && + (Context.getLangOpts().LaxVectorConversions && (Context.getTypeSize(FromType) == Context.getTypeSize(ToType)))) { ICK = ICK_Vector_Conversion; return true; @@ -1311,7 +1311,7 @@ static bool IsStandardConversion(Sema &S, Expr* From, QualType ToType, // There are no standard conversions for class types in C++, so // abort early. When overloading in C, however, we do permit if (FromType->isRecordType() || ToType->isRecordType()) { - if (S.getLangOptions().CPlusPlus) + if (S.getLangOpts().CPlusPlus) return false; // When we're overloading in C, we allow, as standard conversions, @@ -1499,7 +1499,7 @@ static bool IsStandardConversion(Sema &S, Expr* From, QualType ToType, } else if (IsVectorConversion(S.Context, FromType, ToType, SecondICK)) { SCS.Second = SecondICK; FromType = ToType.getUnqualifiedType(); - } else if (!S.getLangOptions().CPlusPlus && + } else if (!S.getLangOpts().CPlusPlus && S.Context.typesAreCompatible(ToType, FromType)) { // Compatible conversions (Clang extension for C function overloading) SCS.Second = ICK_Compatible_Conversion; @@ -1732,7 +1732,7 @@ bool Sema::IsFloatingPointPromotion(QualType FromType, QualType ToType) { // C99 6.3.1.5p1: // When a float is promoted to double or long double, or a // double is promoted to long double [...]. - if (!getLangOptions().CPlusPlus && + if (!getLangOpts().CPlusPlus && (FromBuiltin->getKind() == BuiltinType::Float || FromBuiltin->getKind() == BuiltinType::Double) && (ToBuiltin->getKind() == BuiltinType::LongDouble)) @@ -1898,7 +1898,7 @@ bool Sema::IsPointerConversion(Expr *From, QualType FromType, QualType ToType, // , including objective-c pointers. QualType ToPointeeType = ToTypePtr->getPointeeType(); if (FromType->isObjCObjectPointerType() && ToPointeeType->isVoidType() && - !getLangOptions().ObjCAutoRefCount) { + !getLangOpts().ObjCAutoRefCount) { ConvertedType = BuildSimilarlyQualifiedPointerType( FromType->getAs<ObjCObjectPointerType>(), ToPointeeType, @@ -1929,7 +1929,7 @@ bool Sema::IsPointerConversion(Expr *From, QualType FromType, QualType ToType, } // MSVC allows implicit function to void* type conversion. - if (getLangOptions().MicrosoftExt && FromPointeeType->isFunctionType() && + if (getLangOpts().MicrosoftExt && FromPointeeType->isFunctionType() && ToPointeeType->isVoidType()) { ConvertedType = BuildSimilarlyQualifiedPointerType(FromTypePtr, ToPointeeType, @@ -1939,7 +1939,7 @@ bool Sema::IsPointerConversion(Expr *From, QualType FromType, QualType ToType, // When we're overloading in C, we allow a special kind of pointer // conversion for compatible-but-not-identical pointee types. - if (!getLangOptions().CPlusPlus && + if (!getLangOpts().CPlusPlus && Context.typesAreCompatible(FromPointeeType, ToPointeeType)) { ConvertedType = BuildSimilarlyQualifiedPointerType(FromTypePtr, ToPointeeType, @@ -1960,7 +1960,7 @@ bool Sema::IsPointerConversion(Expr *From, QualType FromType, QualType ToType, // // Note that we do not check for ambiguity or inaccessibility // here. That is handled by CheckPointerConversion. - if (getLangOptions().CPlusPlus && + if (getLangOpts().CPlusPlus && FromPointeeType->isRecordType() && ToPointeeType->isRecordType() && !Context.hasSameUnqualifiedType(FromPointeeType, ToPointeeType) && !RequireCompleteType(From->getLocStart(), FromPointeeType, PDiag()) && @@ -2002,7 +2002,7 @@ static QualType AdoptQualifiers(ASTContext &Context, QualType T, Qualifiers Qs){ bool Sema::isObjCPointerConversion(QualType FromType, QualType ToType, QualType& ConvertedType, bool &IncompatibleObjC) { - if (!getLangOptions().ObjC1) + if (!getLangOpts().ObjC1) return false; // The set of qualifiers on the type we're converting from. @@ -2041,7 +2041,7 @@ bool Sema::isObjCPointerConversion(QualType FromType, QualType ToType, if (Context.canAssignObjCInterfaces(ToObjCPtr, FromObjCPtr)) { const ObjCInterfaceType* LHS = ToObjCPtr->getInterfaceType(); const ObjCInterfaceType* RHS = FromObjCPtr->getInterfaceType(); - if (getLangOptions().CPlusPlus && LHS && RHS && + if (getLangOpts().CPlusPlus && LHS && RHS && !ToObjCPtr->getPointeeType().isAtLeastAsQualifiedAs( FromObjCPtr->getPointeeType())) return false; @@ -2197,7 +2197,7 @@ bool Sema::isObjCPointerConversion(QualType FromType, QualType ToType, /// this conversion. bool Sema::isObjCWritebackConversion(QualType FromType, QualType ToType, QualType &ConvertedType) { - if (!getLangOptions().ObjCAutoRefCount || + if (!getLangOpts().ObjCAutoRefCount || Context.hasSameUnqualifiedType(FromType, ToType)) return false; @@ -2301,7 +2301,7 @@ bool Sema::IsBlockPointerConversion(QualType FromType, QualType ToType, } else { QualType RHS = FromFunctionType->getResultType(); QualType LHS = ToFunctionType->getResultType(); - if ((!getLangOptions().CPlusPlus || !RHS->isRecordType()) && + if ((!getLangOpts().CPlusPlus || !RHS->isRecordType()) && !RHS.hasQualifiers() && LHS.hasQualifiers()) LHS = LHS.getUnqualifiedType(); @@ -2450,7 +2450,7 @@ void Sema::HandleFunctionTypeMismatch(PartialDiagnostic &PDiag, bool Sema::FunctionArgTypesAreEqual(const FunctionProtoType *OldType, const FunctionProtoType *NewType, unsigned *ArgPos) { - if (!getLangOptions().ObjC1) { + if (!getLangOpts().ObjC1) { for (FunctionProtoType::arg_type_iterator O = OldType->arg_type_begin(), N = NewType->arg_type_begin(), E = OldType->arg_type_end(); O && (O != E); ++O, ++N) { @@ -3072,7 +3072,7 @@ static ImplicitConversionSequence::CompareKind compareConversionFunctions(Sema &S, FunctionDecl *Function1, FunctionDecl *Function2) { - if (!S.getLangOptions().ObjC1 || !S.getLangOptions().CPlusPlus0x) + if (!S.getLangOpts().ObjC1 || !S.getLangOpts().CPlusPlus0x) return ImplicitConversionSequence::Indistinguishable; // Objective-C++: @@ -3422,7 +3422,7 @@ CompareStandardConversionSequences(Sema &S, // } // Here, MSVC will call f(int) instead of generating a compile error // as clang will do in standard mode. - if (S.getLangOptions().MicrosoftMode && + if (S.getLangOpts().MicrosoftMode && SCS1.Second == ICK_Integral_Conversion && SCS2.Second == ICK_Floating_Integral && S.Context.getTypeSize(SCS1.getFromType()) == @@ -4089,7 +4089,7 @@ TryReferenceInit(Sema &S, Expr *Init, QualType DeclType, // allow the use of rvalue references in C++98/03 for the benefit of // standard library implementors; therefore, we need the xvalue check here. ICS.Standard.DirectBinding = - S.getLangOptions().CPlusPlus0x || + S.getLangOpts().CPlusPlus0x || (InitCategory.isPRValue() && !T2->isRecordType()); ICS.Standard.IsLvalueReference = !isRValRef; ICS.Standard.BindsToFunctionLvalue = T2->isFunctionType(); @@ -4970,7 +4970,7 @@ Sema::ConvertToIntegralOrEnumerationType(SourceLocation Loc, Expr *From, // If we don't have a class type in C++, there's no way we can get an // expression of integral or enumeration type. const RecordType *RecordTy = T->getAs<RecordType>(); - if (!RecordTy || !getLangOptions().CPlusPlus) { + if (!RecordTy || !getLangOpts().CPlusPlus) { if (NotIntDiag.getDiagID()) Diag(Loc, NotIntDiag) << T << From->getSourceRange(); return Owned(From); @@ -5193,7 +5193,7 @@ Sema::AddOverloadCandidate(FunctionDecl *Function, } // (CUDA B.1): Check for invalid calls between targets. - if (getLangOptions().CUDA) + if (getLangOpts().CUDA) if (const FunctionDecl *Caller = dyn_cast<FunctionDecl>(CurContext)) if (CheckCUDATarget(Caller, Function)) { Candidate.Viable = false; @@ -5215,7 +5215,7 @@ Sema::AddOverloadCandidate(FunctionDecl *Function, SuppressUserConversions, /*InOverloadResolution=*/true, /*AllowObjCWritebackConversion=*/ - getLangOptions().ObjCAutoRefCount, + getLangOpts().ObjCAutoRefCount, AllowExplicit); if (Candidate.Conversions[ArgIdx].isBad()) { Candidate.Viable = false; @@ -5388,7 +5388,7 @@ Sema::AddMethodCandidate(CXXMethodDecl *Method, DeclAccessPair FoundDecl, SuppressUserConversions, /*InOverloadResolution=*/true, /*AllowObjCWritebackConversion=*/ - getLangOptions().ObjCAutoRefCount); + getLangOpts().ObjCAutoRefCount); if (Candidate.Conversions[ArgIdx + 1].isBad()) { Candidate.Viable = false; Candidate.FailureKind = ovl_fail_bad_conversion; @@ -5775,7 +5775,7 @@ void Sema::AddSurrogateCandidate(CXXConversionDecl *Conversion, /*SuppressUserConversions=*/false, /*InOverloadResolution=*/false, /*AllowObjCWritebackConversion=*/ - getLangOptions().ObjCAutoRefCount); + getLangOpts().ObjCAutoRefCount); if (Candidate.Conversions[ArgIdx + 1].isBad()) { Candidate.Viable = false; Candidate.FailureKind = ovl_fail_bad_conversion; @@ -5893,7 +5893,7 @@ void Sema::AddBuiltinCandidate(QualType ResultTy, QualType *ParamTys, ArgIdx == 0 && IsAssignmentOperator, /*InOverloadResolution=*/false, /*AllowObjCWritebackConversion=*/ - getLangOptions().ObjCAutoRefCount); + getLangOpts().ObjCAutoRefCount); } if (Candidate.Conversions[ArgIdx].isBad()) { Candidate.Viable = false; @@ -7238,7 +7238,7 @@ public: S.AddBuiltinCandidate(*MemPtr, ParamTypes, Args, 2, CandidateSet); } - if (S.getLangOptions().CPlusPlus0x) { + if (S.getLangOpts().CPlusPlus0x) { for (BuiltinCandidateTypeSet::iterator Enum = CandidateTypes[ArgIdx].enumeration_begin(), EnumEnd = CandidateTypes[ArgIdx].enumeration_end(); @@ -8520,7 +8520,7 @@ void CompleteNonViableCandidate(Sema &S, OverloadCandidate *Cand, SuppressUserConversions, /*InOverloadResolution*/ true, /*AllowObjCWritebackConversion=*/ - S.getLangOptions().ObjCAutoRefCount); + S.getLangOpts().ObjCAutoRefCount); return; } @@ -8533,7 +8533,7 @@ void CompleteNonViableCandidate(Sema &S, OverloadCandidate *Cand, SuppressUserConversions, /*InOverloadResolution=*/true, /*AllowObjCWritebackConversion=*/ - S.getLangOptions().ObjCAutoRefCount); + S.getLangOpts().ObjCAutoRefCount); // Store the FixIt in the candidate if it exists. if (!Unfixable && Cand->Conversions[ConvIdx].isBad()) Unfixable = !Cand->TryToFixBadConversion(ConvIdx, S); @@ -8779,7 +8779,7 @@ private: return false; if (FunctionDecl *FunDecl = dyn_cast<FunctionDecl>(Fn)) { - if (S.getLangOptions().CUDA) + if (S.getLangOpts().CUDA) if (FunctionDecl *Caller = dyn_cast<FunctionDecl>(S.CurContext)) if (S.CheckCUDATarget(Caller, FunDecl)) return false; @@ -9344,7 +9344,7 @@ class RecoveryCallCCC : public CorrectionCandidateCallback { public: RecoveryCallCCC(Sema &SemaRef, unsigned NumArgs, bool HasExplicitTemplateArgs) : NumArgs(NumArgs), HasExplicitTemplateArgs(HasExplicitTemplateArgs) { - WantTypeSpecifiers = SemaRef.getLangOptions().CPlusPlus; + WantTypeSpecifiers = SemaRef.getLangOpts().CPlusPlus; WantRemainingKeywords = false; } @@ -9488,7 +9488,7 @@ Sema::BuildOverloadedCallExpr(Scope *S, Expr *Fn, UnresolvedLookupExpr *ULE, llvm_unreachable("performing ADL for builtin"); // We don't perform ADL in C. - assert(getLangOptions().CPlusPlus && "ADL enabled in C"); + assert(getLangOpts().CPlusPlus && "ADL enabled in C"); } else assert(!ULE->isStdAssociatedNamespace() && "std is associated namespace but not doing ADL"); @@ -9513,7 +9513,7 @@ Sema::BuildOverloadedCallExpr(Scope *S, Expr *Fn, UnresolvedLookupExpr *ULE, // create a type dependent CallExpr. The goal is to postpone name lookup // to instantiation time to be able to search into type dependent base // classes. - if (getLangOptions().MicrosoftMode && CurContext->isDependentContext() && + if (getLangOpts().MicrosoftMode && CurContext->isDependentContext() && (isa<FunctionDecl>(CurContext) || isa<CXXRecordDecl>(CurContext))) { CallExpr *CE = new (Context) CallExpr(Context, Fn, Args, NumArgs, Context.DependentTy, VK_RValue, @@ -10354,7 +10354,7 @@ Sema::BuildCallToMemberFunction(Scope *S, Expr *MemExprE, // Microsoft supports direct constructor calls. - if (getLangOptions().MicrosoftExt && isa<CXXConstructorDecl>(Func)) { + if (getLangOpts().MicrosoftExt && isa<CXXConstructorDecl>(Func)) { AddOverloadCandidate(cast<CXXConstructorDecl>(Func), I.getPair(), llvm::makeArrayRef(Args, NumArgs), CandidateSet); } else if ((Method = dyn_cast<CXXMethodDecl>(Func))) { diff --git a/lib/Sema/SemaPseudoObject.cpp b/lib/Sema/SemaPseudoObject.cpp index c51eb3f495..effb372303 100644 --- a/lib/Sema/SemaPseudoObject.cpp +++ b/lib/Sema/SemaPseudoObject.cpp @@ -594,9 +594,9 @@ ExprResult ObjCPropertyOpBuilder::buildSet(Expr *op, SourceLocation opcLoc, // Use assignment constraints when possible; they give us better // diagnostics. "When possible" basically means anything except a // C++ class type. - if (!S.getLangOptions().CPlusPlus || !op->getType()->isRecordType()) { + if (!S.getLangOpts().CPlusPlus || !op->getType()->isRecordType()) { QualType paramType = (*Setter->param_begin())->getType(); - if (!S.getLangOptions().CPlusPlus || !paramType->isRecordType()) { + if (!S.getLangOpts().CPlusPlus || !paramType->isRecordType()) { ExprResult opResult = op; Sema::AssignConvertType assignResult = S.CheckSingleAssignmentConstraints(paramType, opResult); @@ -675,7 +675,7 @@ ExprResult ObjCPropertyOpBuilder::buildRValueOperation(Expr *op) { /// succeeded bool ObjCPropertyOpBuilder::tryBuildGetOfReference(Expr *op, ExprResult &result) { - if (!S.getLangOptions().CPlusPlus) return false; + if (!S.getLangOpts().CPlusPlus) return false; findGetter(); assert(Getter && "property has no setter and no getter!"); @@ -727,7 +727,7 @@ ObjCPropertyOpBuilder::buildAssignmentOperation(Scope *Sc, if (result.isInvalid()) return ExprError(); // Various warnings about property assignments in ARC. - if (S.getLangOptions().ObjCAutoRefCount && InstanceReceiver) { + if (S.getLangOpts().ObjCAutoRefCount && InstanceReceiver) { S.checkRetainCycles(InstanceReceiver->getSourceExpr(), RHS); S.checkUnsafeExprAssigns(opcLoc, LHS, RHS); } @@ -806,7 +806,7 @@ ObjCSubscriptOpBuilder::buildAssignmentOperation(Scope *Sc, if (result.isInvalid()) return ExprError(); // Various warnings about objc Index'ed assignments in ARC. - if (S.getLangOptions().ObjCAutoRefCount && InstanceBase) { + if (S.getLangOpts().ObjCAutoRefCount && InstanceBase) { S.checkRetainCycles(InstanceBase->getSourceExpr(), RHS); S.checkUnsafeExprAssigns(opcLoc, LHS, RHS); } @@ -846,7 +846,7 @@ Sema::ObjCSubscriptKind // All other scalar cases are assumed to be dictionary indexing which // caller handles, with diagnostics if needed. return OS_Dictionary; - if (!getLangOptions().CPlusPlus || RecordTy->isIncompleteType()) { + if (!getLangOpts().CPlusPlus || RecordTy->isIncompleteType()) { // No indexing can be done. Issue diagnostics and quit. Diag(FromE->getExprLoc(), diag::err_objc_subscript_type_conversion) << FromE->getType(); @@ -952,7 +952,7 @@ bool ObjCSubscriptOpBuilder::findAtIndexGetter() { bool receiverIdType = (BaseT->isObjCIdType() || BaseT->isObjCQualifiedIdType()); - if (!AtIndexGetter && S.getLangOptions().DebuggerObjCLiteral) { + if (!AtIndexGetter && S.getLangOpts().DebuggerObjCLiteral) { AtIndexGetter = ObjCMethodDecl::Create(S.Context, SourceLocation(), SourceLocation(), AtIndexGetterSelector, S.Context.getObjCIdType() /*ReturnType*/, @@ -1062,7 +1062,7 @@ bool ObjCSubscriptOpBuilder::findAtIndexSetter() { bool receiverIdType = (BaseT->isObjCIdType() || BaseT->isObjCQualifiedIdType()); - if (!AtIndexSetter && S.getLangOptions().DebuggerObjCLiteral) { + if (!AtIndexSetter && S.getLangOpts().DebuggerObjCLiteral) { TypeSourceInfo *ResultTInfo = 0; QualType ReturnType = S.Context.VoidTy; AtIndexSetter = ObjCMethodDecl::Create(S.Context, SourceLocation(), diff --git a/lib/Sema/SemaStmt.cpp b/lib/Sema/SemaStmt.cpp index b9022e6200..ef453f5c6a 100644 --- a/lib/Sema/SemaStmt.cpp +++ b/lib/Sema/SemaStmt.cpp @@ -78,7 +78,7 @@ void Sema::ActOnForEachDeclStmt(DeclGroupPtrTy dg) { // In ARC, we don't need to retain the iteration variable of a fast // enumeration loop. Rather than actually trying to catch that // during declaration processing, we remove the consequences here. - if (getLangOptions().ObjCAutoRefCount) { + if (getLangOpts().ObjCAutoRefCount) { QualType type = var->getType(); // Only do this if we inferred the lifetime. Inferred lifetime @@ -190,7 +190,7 @@ void Sema::DiagnoseUnusedExprResult(const Stmt *S) { } } } else if (const ObjCMessageExpr *ME = dyn_cast<ObjCMessageExpr>(E)) { - if (getLangOptions().ObjCAutoRefCount && ME->isDelegateInitCall()) { + if (getLangOpts().ObjCAutoRefCount && ME->isDelegateInitCall()) { Diag(Loc, diag::err_arc_unused_init_message) << R1; return; } @@ -248,7 +248,7 @@ Sema::ActOnCompoundStmt(SourceLocation L, SourceLocation R, Stmt **Elts = reinterpret_cast<Stmt**>(elts.release()); // If we're in C89 mode, check that we don't have any decls after stmts. If // so, emit an extension diagnostic. - if (!getLangOptions().C99 && !getLangOptions().CPlusPlus) { + if (!getLangOpts().C99 && !getLangOpts().CPlusPlus) { // Note that __extension__ can be around a decl. unsigned i = 0; // Skip over all declarations. @@ -296,7 +296,7 @@ Sema::ActOnCaseStmt(SourceLocation CaseLoc, Expr *LHSVal, return StmtError(); } - if (!getLangOptions().CPlusPlus0x) { + if (!getLangOpts().CPlusPlus0x) { // C99 6.8.4.2p3: The expression shall be an integer constant. // However, GCC allows any evaluatable integer expression. if (!LHSVal->isTypeDependent() && !LHSVal->isValueDependent()) { @@ -645,7 +645,7 @@ Sema::ActOnFinishSwitchStmt(SourceLocation SwitchLoc, Stmt *Switch, llvm::APSInt LoVal; - if (getLangOptions().CPlusPlus0x) { + if (getLangOpts().CPlusPlus0x) { // C++11 [stmt.switch]p2: the constant-expression shall be a converted // constant expression of the promoted type of the switch condition. ExprResult ConvLo = @@ -743,7 +743,7 @@ Sema::ActOnFinishSwitchStmt(SourceLocation SwitchLoc, Stmt *Switch, Expr *Hi = CR->getRHS(); llvm::APSInt HiVal; - if (getLangOptions().CPlusPlus0x) { + if (getLangOpts().CPlusPlus0x) { // C++11 [stmt.switch]p2: the constant-expression shall be a converted // constant expression of the promoted type of the switch condition. ExprResult ConvHi = @@ -1033,7 +1033,7 @@ Sema::ActOnForStmt(SourceLocation ForLoc, SourceLocation LParenLoc, Stmt *First, FullExprArg second, Decl *secondVar, FullExprArg third, SourceLocation RParenLoc, Stmt *Body) { - if (!getLangOptions().CPlusPlus) { + if (!getLangOpts().CPlusPlus) { if (DeclStmt *DS = dyn_cast_or_null<DeclStmt>(First)) { // C99 6.8.5p3: The declaration part of a 'for' statement shall only // declare identifiers for objects having storage class 'auto' or @@ -1115,7 +1115,7 @@ Sema::ActOnObjCForCollectionOperand(SourceLocation forLoc, Expr *collection) { // Under ARC, it is an error not to have a forward-declared class. if (iface && RequireCompleteType(forLoc, QualType(objectType, 0), - getLangOptions().ObjCAutoRefCount + getLangOpts().ObjCAutoRefCount ? PDiag(diag::err_arc_collection_forward) << collection->getSourceRange() : PDiag(0))) { @@ -1235,7 +1235,7 @@ static bool FinishForRangeVarDecl(Sema &SemaRef, VarDecl *Decl, Expr *Init, // In ARC, infer lifetime. // FIXME: ARC may want to turn this into 'const __unsafe_unretained' if // we're doing the equivalent of fast iteration. - if (SemaRef.getLangOptions().ObjCAutoRefCount && + if (SemaRef.getLangOpts().ObjCAutoRefCount && SemaRef.inferObjCARCLifetime(Decl)) Decl->setInvalidDecl(); @@ -1883,7 +1883,7 @@ Sema::ActOnCapScopeReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp) { // types we can conclusively prove aren't void. } else if (FnRetType->isVoidType()) { if (RetValExp && !isa<InitListExpr>(RetValExp) && - !(getLangOptions().CPlusPlus && + !(getLangOpts().CPlusPlus && (RetValExp->isTypeDependent() || RetValExp->getType()->isVoidType()))) { Diag(ReturnLoc, diag::err_return_block_has_expr); @@ -1923,7 +1923,7 @@ Sema::ActOnCapScopeReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp) { // If we need to check for the named return value optimization, save the // return statement in our scope for later processing. - if (getLangOptions().CPlusPlus && FnRetType->isRecordType() && + if (getLangOpts().CPlusPlus && FnRetType->isRecordType() && !CurContext->isDependentContext()) FunctionScopes.back()->Returns.push_back(Result); @@ -2001,7 +2001,7 @@ Sema::ActOnReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp) { // return (some void expression); is legal in C++. if (D != diag::ext_return_has_void_expr || - !getLangOptions().CPlusPlus) { + !getLangOpts().CPlusPlus) { NamedDecl *CurDecl = getCurFunctionOrMethodDecl(); int FunctionKind = 0; @@ -2028,7 +2028,7 @@ Sema::ActOnReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp) { } else if (!RetValExp && !FnRetType->isDependentType()) { unsigned DiagID = diag::warn_return_missing_expr; // C90 6.6.6.4p4 // C99 6.8.6.4p1 (ext_ since GCC warns) - if (getLangOptions().C99) DiagID = diag::ext_return_missing_expr; + if (getLangOpts().C99) DiagID = diag::ext_return_missing_expr; if (FunctionDecl *FD = getCurFunctionDecl()) Diag(ReturnLoc, DiagID) << FD->getIdentifier() << 0/*fn*/; @@ -2082,7 +2082,7 @@ Sema::ActOnReturnStmt(SourceLocation ReturnLoc, Expr *RetValExp) { // If we need to check for the named return value optimization, save the // return statement in our scope for later processing. - if (getLangOptions().CPlusPlus && FnRetType->isRecordType() && + if (getLangOpts().CPlusPlus && FnRetType->isRecordType() && !CurContext->isDependentContext()) FunctionScopes.back()->Returns.push_back(Result); @@ -2108,7 +2108,7 @@ static bool CheckAsmLValue(const Expr *E, Sema &S) { // are supposed to allow. const Expr *E2 = E->IgnoreParenNoopCasts(S.Context); if (E != E2 && E2->isLValue()) { - if (!S.getLangOptions().HeinousExtensions) + if (!S.getLangOpts().HeinousExtensions) S.Diag(E2->getLocStart(), diag::err_invalid_asm_cast_lvalue) << E->getSourceRange(); else @@ -2386,7 +2386,7 @@ Sema::ActOnObjCAtFinallyStmt(SourceLocation AtLoc, Stmt *Body) { StmtResult Sema::ActOnObjCAtTryStmt(SourceLocation AtLoc, Stmt *Try, MultiStmtArg CatchStmts, Stmt *Finally) { - if (!getLangOptions().ObjCExceptions) + if (!getLangOpts().ObjCExceptions) Diag(AtLoc, diag::err_objc_exceptions_disabled) << "@try"; getCurFunction()->setHasBranchProtectedScope(); @@ -2423,7 +2423,7 @@ StmtResult Sema::BuildObjCAtThrowStmt(SourceLocation AtLoc, StmtResult Sema::ActOnObjCAtThrowStmt(SourceLocation AtLoc, Expr *Throw, Scope *CurScope) { - if (!getLangOptions().ObjCExceptions) + if (!getLangOpts().ObjCExceptions) Diag(AtLoc, diag::err_objc_exceptions_disabled) << "@throw"; if (!Throw) { @@ -2523,7 +2523,7 @@ StmtResult Sema::ActOnCXXTryBlock(SourceLocation TryLoc, Stmt *TryBlock, MultiStmtArg RawHandlers) { // Don't report an error if 'try' is used in system headers. - if (!getLangOptions().CXXExceptions && + if (!getLangOpts().CXXExceptions && !getSourceManager().isInSystemHeader(TryLoc)) Diag(TryLoc, diag::err_exceptions_disabled) << "try"; diff --git a/lib/Sema/SemaTemplate.cpp b/lib/Sema/SemaTemplate.cpp index 71677fc157..af6b319e90 100644 --- a/lib/Sema/SemaTemplate.cpp +++ b/lib/Sema/SemaTemplate.cpp @@ -138,7 +138,7 @@ TemplateNameKind Sema::isTemplateName(Scope *S, bool EnteringContext, TemplateTy &TemplateResult, bool &MemberOfUnknownSpecialization) { - assert(getLangOptions().CPlusPlus && "No template names in C!"); + assert(getLangOpts().CPlusPlus && "No template names in C!"); DeclarationName TName; MemberOfUnknownSpecialization = false; @@ -328,8 +328,8 @@ void Sema::LookupTemplateName(LookupResult &Found, Found.addDecl(Corrected.getCorrectionDecl()); FilterAcceptableTemplateNames(Found); if (!Found.empty()) { - std::string CorrectedStr(Corrected.getAsString(getLangOptions())); - std::string CorrectedQuotedStr(Corrected.getQuoted(getLangOptions())); + std::string CorrectedStr(Corrected.getAsString(getLangOpts())); + std::string CorrectedQuotedStr(Corrected.getQuoted(getLangOpts())); if (LookupCtx) Diag(Found.getNameLoc(), diag::err_no_member_template_suggest) << Name << LookupCtx << CorrectedQuotedStr << SS.getRange() @@ -452,7 +452,7 @@ void Sema::DiagnoseTemplateParameterShadow(SourceLocation Loc, Decl *PrevDecl) { assert(PrevDecl->isTemplateParameter() && "Not a template parameter"); // Microsoft Visual C++ permits template parameters to be shadowed. - if (getLangOptions().MicrosoftExt) + if (getLangOpts().MicrosoftExt) return; // C++ [temp.local]p4: @@ -1132,7 +1132,7 @@ static bool DiagnoseDefaultTemplateArgument(Sema &S, // template-argument, that declaration shall be a definition and shall be // the only declaration of the function template in the translation unit. // (C++98/03 doesn't have this wording; see DR226). - S.Diag(ParamLoc, S.getLangOptions().CPlusPlus0x ? + S.Diag(ParamLoc, S.getLangOpts().CPlusPlus0x ? diag::warn_cxx98_compat_template_parameter_default_in_function_template : diag::ext_template_parameter_default_in_function_template) << DefArgRange; @@ -2307,7 +2307,7 @@ TemplateNameKind Sema::ActOnDependentTemplateName(Scope *S, TemplateTy &Result) { if (TemplateKWLoc.isValid() && S && !S->getTemplateParamParent()) Diag(TemplateKWLoc, - getLangOptions().CPlusPlus0x ? + getLangOpts().CPlusPlus0x ? diag::warn_cxx98_compat_template_outside_of_template : diag::ext_template_outside_of_template) << FixItHint::CreateRemoval(TemplateKWLoc); @@ -2430,7 +2430,7 @@ bool Sema::CheckTemplateTypeArgument(TemplateTypeParmDecl *Param, // Objective-C ARC: // If an explicitly-specified template argument type is a lifetime type // with no lifetime qualifier, the __strong lifetime qualifier is inferred. - if (getLangOptions().ObjCAutoRefCount && + if (getLangOpts().ObjCAutoRefCount && ArgType->isObjCLifetimeType() && !ArgType.getObjCLifetime()) { Qualifiers Qs; @@ -2871,7 +2871,7 @@ bool Sema::CheckTemplateArgument(NamedDecl *Param, // We have a template template parameter but the template // argument does not refer to a template. Diag(Arg.getLocation(), diag::err_template_arg_must_be_template) - << getLangOptions().CPlusPlus0x; + << getLangOpts().CPlusPlus0x; return true; case TemplateArgument::Declaration: @@ -3375,7 +3375,7 @@ bool UnnamedLocalNoLinkageFinder::VisitAtomicType(const AtomicType* T) { bool UnnamedLocalNoLinkageFinder::VisitTagDecl(const TagDecl *Tag) { if (Tag->getDeclContext()->isFunctionOrMethod()) { S.Diag(SR.getBegin(), - S.getLangOptions().CPlusPlus0x ? + S.getLangOpts().CPlusPlus0x ? diag::warn_cxx98_compat_template_arg_local_type : diag::ext_template_arg_local_type) << S.Context.getTypeDeclType(Tag) << SR; @@ -3384,7 +3384,7 @@ bool UnnamedLocalNoLinkageFinder::VisitTagDecl(const TagDecl *Tag) { if (!Tag->getDeclName() && !Tag->getTypedefNameForAnonDecl()) { S.Diag(SR.getBegin(), - S.getLangOptions().CPlusPlus0x ? + S.getLangOpts().CPlusPlus0x ? diag::warn_cxx98_compat_template_arg_unnamed_type : diag::ext_template_arg_unnamed_type) << SR; S.Diag(Tag->getLocation(), diag::note_template_unnamed_type_here); @@ -3484,7 +3484,7 @@ CheckTemplateArgumentAddressOfObjectOrFunction(Sema &S, while (ParenExpr *Parens = dyn_cast<ParenExpr>(Arg)) { if (!Invalid && !ExtraParens) { S.Diag(Arg->getLocStart(), - S.getLangOptions().CPlusPlus0x ? + S.getLangOpts().CPlusPlus0x ? diag::warn_cxx98_compat_template_arg_extra_parens : diag::ext_template_arg_extra_parens) << Arg->getSourceRange(); @@ -3508,7 +3508,7 @@ CheckTemplateArgumentAddressOfObjectOrFunction(Sema &S, } } - if (S.getLangOptions().MicrosoftExt && isa<CXXUuidofExpr>(Arg)) { + if (S.getLangOpts().MicrosoftExt && isa<CXXUuidofExpr>(Arg)) { Converted = TemplateArgument(ArgIn); return false; } @@ -3751,7 +3751,7 @@ bool Sema::CheckTemplateArgumentPointerToMember(Expr *Arg, while (ParenExpr *Parens = dyn_cast<ParenExpr>(Arg)) { if (!Invalid && !ExtraParens) { Diag(Arg->getLocStart(), - getLangOptions().CPlusPlus0x ? + getLangOpts().CPlusPlus0x ? diag::warn_cxx98_compat_template_arg_extra_parens : diag::ext_template_arg_extra_parens) << Arg->getSourceRange(); @@ -3877,7 +3877,7 @@ ExprResult Sema::CheckTemplateArgument(NonTypeTemplateParmDecl *Param, return ExprError(); } - if (getLangOptions().CPlusPlus0x) { + if (getLangOpts().CPlusPlus0x) { // We can't check arbitrary value-dependent arguments. // FIXME: If there's no viable conversion to the template parameter type, // we should be able to diagnose that prior to instantiation. @@ -4718,7 +4718,7 @@ static bool CheckTemplateSpecializationScope(Sema &S, } if (S.CurContext->isRecord() && !IsPartialSpecialization) { - if (S.getLangOptions().MicrosoftExt) { + if (S.getLangOpts().MicrosoftExt) { // Do not warn for class scope explicit specialization during // instantiation, warning was already emitted during pattern // semantic analysis. @@ -4774,7 +4774,7 @@ static bool CheckTemplateSpecializationScope(Sema &S, int Diag; if (!IsCPlusPlus0xExtension) Diag = diag::err_template_spec_decl_out_of_scope; - else if (!S.getLangOptions().CPlusPlus0x) + else if (!S.getLangOpts().CPlusPlus0x) Diag = diag::ext_template_spec_decl_out_of_scope; else Diag = diag::warn_cxx98_compat_template_spec_decl_out_of_scope; @@ -4784,7 +4784,7 @@ static bool CheckTemplateSpecializationScope(Sema &S, S.Diag(Specialized->getLocation(), diag::note_specialized_entity); ComplainedAboutScope = - !(IsCPlusPlus0xExtension && S.getLangOptions().CPlusPlus0x); + !(IsCPlusPlus0xExtension && S.getLangOpts().CPlusPlus0x); } } @@ -5523,7 +5523,7 @@ Sema::CheckSpecializationInstantiationRedecl(SourceLocation NewLoc, // In C++98/03 mode, we only give an extension warning here, because it // is not harmful to try to explicitly instantiate something that // has been explicitly specialized. - Diag(NewLoc, getLangOptions().CPlusPlus0x ? + Diag(NewLoc, getLangOpts().CPlusPlus0x ? diag::warn_cxx98_compat_explicit_instantiation_after_specialization : diag::ext_explicit_instantiation_after_specialization) << PrevDecl; @@ -5955,19 +5955,19 @@ static bool CheckExplicitInstantiationScope(Sema &S, NamedDecl *D, if (NamespaceDecl *NS = dyn_cast<NamespaceDecl>(OrigContext)) { if (WasQualifiedName) S.Diag(InstLoc, - S.getLangOptions().CPlusPlus0x? + S.getLangOpts().CPlusPlus0x? diag::err_explicit_instantiation_out_of_scope : diag::warn_explicit_instantiation_out_of_scope_0x) << D << NS; else S.Diag(InstLoc, - S.getLangOptions().CPlusPlus0x? + S.getLangOpts().CPlusPlus0x? diag::err_explicit_instantiation_unqualified_wrong_namespace : diag::warn_explicit_instantiation_unqualified_wrong_namespace_0x) << D << NS; } else S.Diag(InstLoc, - S.getLangOptions().CPlusPlus0x? + S.getLangOpts().CPlusPlus0x? diag::err_explicit_instantiation_must_be_global : diag::warn_explicit_instantiation_must_be_global_0x) << D; @@ -6367,7 +6367,7 @@ DeclResult Sema::ActOnExplicitInstantiation(Scope *S, // well. if (D.getDeclSpec().isInlineSpecified()) Diag(D.getDeclSpec().getInlineSpecLoc(), - getLangOptions().CPlusPlus0x ? + getLangOpts().CPlusPlus0x ? diag::err_explicit_instantiation_inline : diag::warn_explicit_instantiation_inline_0x) << FixItHint::CreateRemoval(D.getDeclSpec().getInlineSpecLoc()); @@ -6626,7 +6626,7 @@ Sema::ActOnTypenameType(Scope *S, SourceLocation TypenameLoc, if (TypenameLoc.isValid() && S && !S->getTemplateParamParent()) Diag(TypenameLoc, - getLangOptions().CPlusPlus0x ? + getLangOpts().CPlusPlus0x ? diag::warn_cxx98_compat_typename_outside_of_template : diag::ext_typename_outside_of_template) << FixItHint::CreateRemoval(TypenameLoc); @@ -6665,7 +6665,7 @@ Sema::ActOnTypenameType(Scope *S, SourceLocation RAngleLoc) { if (TypenameLoc.isValid() && S && !S->getTemplateParamParent()) Diag(TypenameLoc, - getLangOptions().CPlusPlus0x ? + getLangOpts().CPlusPlus0x ? diag::warn_cxx98_compat_typename_outside_of_template : diag::ext_typename_outside_of_template) << FixItHint::CreateRemoval(TypenameLoc); diff --git a/lib/Sema/SemaTemplateDeduction.cpp b/lib/Sema/SemaTemplateDeduction.cpp index f6ed7d6af9..1d43b3fd4d 100644 --- a/lib/Sema/SemaTemplateDeduction.cpp +++ b/lib/Sema/SemaTemplateDeduction.cpp @@ -1029,7 +1029,7 @@ DeduceTemplateArgumentsByTypeMatch(Sema &S, // Objective-C ARC: // If template deduction would produce an argument type with lifetime type // but no lifetime qualifier, the __strong lifetime qualifier is inferred. - if (S.getLangOptions().ObjCAutoRefCount && + if (S.getLangOpts().ObjCAutoRefCount && DeducedType->isObjCLifetimeType() && !DeducedQs.hasObjCLifetime()) DeducedQs.setObjCLifetime(Qualifiers::OCL_Strong); @@ -3584,17 +3584,17 @@ static bool isAtLeastAsSpecializedAs(Sema &S, // first argument of the free function or static member, which // seems to match existing practice. SmallVector<QualType, 4> Args1; - unsigned Skip1 = !S.getLangOptions().CPlusPlus0x && + unsigned Skip1 = !S.getLangOpts().CPlusPlus0x && IsNonStatic2 && !IsNonStatic1; - if (S.getLangOptions().CPlusPlus0x && IsNonStatic1 && !IsNonStatic2) + if (S.getLangOpts().CPlusPlus0x && IsNonStatic1 && !IsNonStatic2) MaybeAddImplicitObjectParameterType(S.Context, Method1, Args1); Args1.insert(Args1.end(), Proto1->arg_type_begin() + Skip1, Proto1->arg_type_end()); SmallVector<QualType, 4> Args2; - Skip2 = !S.getLangOptions().CPlusPlus0x && + Skip2 = !S.getLangOpts().CPlusPlus0x && IsNonStatic1 && !IsNonStatic2; - if (S.getLangOptions().CPlusPlus0x && IsNonStatic2 && !IsNonStatic1) + if (S.getLangOpts().CPlusPlus0x && IsNonStatic2 && !IsNonStatic1) MaybeAddImplicitObjectParameterType(S.Context, Method2, Args2); Args2.insert(Args2.end(), Proto2->arg_type_begin() + Skip2, Proto2->arg_type_end()); @@ -3663,7 +3663,7 @@ static bool isAtLeastAsSpecializedAs(Sema &S, unsigned NumParams = std::min(NumCallArguments, std::min(Proto1->getNumArgs(), Proto2->getNumArgs())); - if (S.getLangOptions().CPlusPlus0x && IsNonStatic2 && !IsNonStatic1) + if (S.getLangOpts().CPlusPlus0x && IsNonStatic2 && !IsNonStatic1) ::MarkUsedTemplateParameters(S.Context, Method2->getThisType(S.Context), false, TemplateParams->getDepth(), UsedParameters); diff --git a/lib/Sema/SemaTemplateInstantiate.cpp b/lib/Sema/SemaTemplateInstantiate.cpp index 073d64407a..697ac0ecd4 100644 --- a/lib/Sema/SemaTemplateInstantiate.cpp +++ b/lib/Sema/SemaTemplateInstantiate.cpp @@ -404,15 +404,15 @@ bool Sema::InstantiatingTemplate::CheckInstantiationDepth( SemaRef.ActiveTemplateInstantiations.size()); if ((SemaRef.ActiveTemplateInstantiations.size() - SemaRef.NonInstantiationEntries) - <= SemaRef.getLangOptions().InstantiationDepth) + <= SemaRef.getLangOpts().InstantiationDepth) return false; SemaRef.Diag(PointOfInstantiation, diag::err_template_recursion_depth_exceeded) - << SemaRef.getLangOptions().InstantiationDepth + << SemaRef.getLangOpts().InstantiationDepth << InstantiationRange; SemaRef.Diag(PointOfInstantiation, diag::note_template_recursion_depth) - << SemaRef.getLangOptions().InstantiationDepth; + << SemaRef.getLangOpts().InstantiationDepth; return true; } diff --git a/lib/Sema/SemaTemplateInstantiateDecl.cpp b/lib/Sema/SemaTemplateInstantiateDecl.cpp index 7d2ec16cba..56ce50e592 100644 --- a/lib/Sema/SemaTemplateInstantiateDecl.cpp +++ b/lib/Sema/SemaTemplateInstantiateDecl.cpp @@ -312,7 +312,7 @@ Decl *TemplateDeclInstantiator::VisitVarDecl(VarDecl *D) { SemaRef.LookupQualifiedName(Previous, Owner, false); // In ARC, infer 'retaining' for variables of retainable type. - if (SemaRef.getLangOptions().ObjCAutoRefCount && + if (SemaRef.getLangOpts().ObjCAutoRefCount && SemaRef.inferObjCARCLifetime(Var)) Var->setInvalidDecl(); @@ -1203,7 +1203,7 @@ Decl *TemplateDeclInstantiator::VisitFunctionDecl(FunctionDecl *D, // // If -Wc++98-compat is enabled, we go through the motions of checking for a // redefinition, but don't instantiate the function. - if ((!SemaRef.getLangOptions().CPlusPlus0x || + if ((!SemaRef.getLangOpts().CPlusPlus0x || SemaRef.Diags.getDiagnosticLevel( diag::warn_cxx98_compat_friend_redefinition, Function->getLocation()) @@ -1214,11 +1214,11 @@ Decl *TemplateDeclInstantiator::VisitFunctionDecl(FunctionDecl *D, if (Function->isDefined(Definition) && Definition->getTemplateSpecializationKind() == TSK_Undeclared) { SemaRef.Diag(Function->getLocation(), - SemaRef.getLangOptions().CPlusPlus0x ? + SemaRef.getLangOpts().CPlusPlus0x ? diag::warn_cxx98_compat_friend_redefinition : diag::err_redefinition) << Function->getDeclName(); SemaRef.Diag(Definition->getLocation(), diag::note_previous_definition); - if (!SemaRef.getLangOptions().CPlusPlus0x) + if (!SemaRef.getLangOpts().CPlusPlus0x) Function->setInvalidDecl(); } // Check for redefinitions due to other instantiations of this or @@ -1230,7 +1230,7 @@ Decl *TemplateDeclInstantiator::VisitFunctionDecl(FunctionDecl *D, continue; switch (R->getFriendObjectKind()) { case Decl::FOK_None: - if (!SemaRef.getLangOptions().CPlusPlus0x && + if (!SemaRef.getLangOpts().CPlusPlus0x && !queuedInstantiation && R->isUsed(false)) { if (MemberSpecializationInfo *MSInfo = Function->getMemberSpecializationInfo()) { @@ -1249,12 +1249,12 @@ Decl *TemplateDeclInstantiator::VisitFunctionDecl(FunctionDecl *D, = R->getTemplateInstantiationPattern()) if (RPattern->isDefined(RPattern)) { SemaRef.Diag(Function->getLocation(), - SemaRef.getLangOptions().CPlusPlus0x ? + SemaRef.getLangOpts().CPlusPlus0x ? diag::warn_cxx98_compat_friend_redefinition : diag::err_redefinition) << Function->getDeclName(); SemaRef.Diag(R->getLocation(), diag::note_previous_definition); - if (!SemaRef.getLangOptions().CPlusPlus0x) + if (!SemaRef.getLangOpts().CPlusPlus0x) Function->setInvalidDecl(); break; } diff --git a/lib/Sema/SemaTemplateVariadic.cpp b/lib/Sema/SemaTemplateVariadic.cpp index 9528f4c374..87c8b4d40e 100644 --- a/lib/Sema/SemaTemplateVariadic.cpp +++ b/lib/Sema/SemaTemplateVariadic.cpp @@ -761,12 +761,12 @@ ExprResult Sema::ActOnSizeofParameterPackExpr(Scope *S, if (TypoCorrection Corrected = CorrectTypo(R.getLookupNameInfo(), R.getLookupKind(), S, 0, Validator)) { - std::string CorrectedQuotedStr(Corrected.getQuoted(getLangOptions())); + std::string CorrectedQuotedStr(Corrected.getQuoted(getLangOpts())); ParameterPack = Corrected.getCorrectionDecl(); Diag(NameLoc, diag::err_sizeof_pack_no_pack_name_suggest) << &Name << CorrectedQuotedStr << FixItHint::CreateReplacement( - NameLoc, Corrected.getAsString(getLangOptions())); + NameLoc, Corrected.getAsString(getLangOpts())); Diag(ParameterPack->getLocation(), diag::note_parameter_pack_here) << CorrectedQuotedStr; } diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp index 919faa0a3c..f1b00e38d7 100644 --- a/lib/Sema/SemaType.cpp +++ b/lib/Sema/SemaType.cpp @@ -505,7 +505,7 @@ static void distributeTypeAttrsFromDeclarator(TypeProcessingState &state, break; case AttributeList::AT_ns_returns_retained: - if (!state.getSema().getLangOptions().ObjCAutoRefCount) + if (!state.getSema().getLangOpts().ObjCAutoRefCount) break; // fallthrough @@ -656,7 +656,7 @@ static QualType ConvertDeclSpecToType(TypeProcessingState &state) { // allowed to be completely missing a declspec. This is handled in the // parser already though by it pretending to have seen an 'int' in this // case. - if (S.getLangOptions().ImplicitInt) { + if (S.getLangOpts().ImplicitInt) { // In C89 mode, we only warn if there is a completely missing declspec // when one is not allowed. if (DS.isEmpty()) { @@ -670,8 +670,8 @@ static QualType ConvertDeclSpecToType(TypeProcessingState &state) { // specifiers in each declaration, and in the specifier-qualifier list in // each struct declaration and type name." // FIXME: Does Microsoft really have the implicit int extension in C++? - if (S.getLangOptions().CPlusPlus && - !S.getLangOptions().MicrosoftExt) { + if (S.getLangOpts().CPlusPlus && + !S.getLangOpts().MicrosoftExt) { S.Diag(DeclLoc, diag::err_missing_type_specifier) << DS.getSourceRange(); @@ -696,9 +696,9 @@ static QualType ConvertDeclSpecToType(TypeProcessingState &state) { Result = Context.LongLongTy; // long long is a C99 feature. - if (!S.getLangOptions().C99) + if (!S.getLangOpts().C99) S.Diag(DS.getTypeSpecWidthLoc(), - S.getLangOptions().CPlusPlus0x ? + S.getLangOpts().CPlusPlus0x ? diag::warn_cxx98_compat_longlong : diag::ext_longlong); break; } @@ -711,9 +711,9 @@ static QualType ConvertDeclSpecToType(TypeProcessingState &state) { Result = Context.UnsignedLongLongTy; // long long is a C99 feature. - if (!S.getLangOptions().C99) + if (!S.getLangOpts().C99) S.Diag(DS.getTypeSpecWidthLoc(), - S.getLangOptions().CPlusPlus0x ? + S.getLangOpts().CPlusPlus0x ? diag::warn_cxx98_compat_longlong : diag::ext_longlong); break; } @@ -728,7 +728,7 @@ static QualType ConvertDeclSpecToType(TypeProcessingState &state) { else Result = Context.DoubleTy; - if (S.getLangOptions().OpenCL && !S.getOpenCLOptions().cl_khr_fp64) { + if (S.getLangOpts().OpenCL && !S.getOpenCLOptions().cl_khr_fp64) { S.Diag(DS.getTypeSpecTypeLoc(), diag::err_double_requires_fp64); declarator.setInvalidType(true); } @@ -881,7 +881,7 @@ static QualType ConvertDeclSpecToType(TypeProcessingState &state) { // Handle complex types. if (DS.getTypeSpecComplex() == DeclSpec::TSC_complex) { - if (S.getLangOptions().Freestanding) + if (S.getLangOpts().Freestanding) S.Diag(DS.getTypeSpecComplexLoc(), diag::ext_freestanding_complex); Result = Context.getComplexType(Result); } else if (DS.isTypeAltiVecVector()) { @@ -1108,7 +1108,7 @@ QualType Sema::BuildPointerType(QualType T, assert(!T->isObjCObjectType() && "Should build ObjCObjectPointerType"); // In ARC, it is forbidden to build pointers to unqualified pointers. - if (getLangOptions().ObjCAutoRefCount) + if (getLangOpts().ObjCAutoRefCount) T = inferARCLifetimeForPointee(*this, T, Loc, /*reference*/ false); // Build the pointer type. @@ -1165,7 +1165,7 @@ QualType Sema::BuildReferenceType(QualType T, bool SpelledAsLValue, } // In ARC, it is forbidden to build references to unqualified pointers. - if (getLangOptions().ObjCAutoRefCount) + if (getLangOpts().ObjCAutoRefCount) T = inferARCLifetimeForPointee(*this, T, Loc, /*reference*/ true); // Handle restrict on references. @@ -1207,7 +1207,7 @@ QualType Sema::BuildArrayType(QualType T, ArrayType::ArraySizeModifier ASM, SourceRange Brackets, DeclarationName Entity) { SourceLocation Loc = Brackets.getBegin(); - if (getLangOptions().CPlusPlus) { + if (getLangOpts().CPlusPlus) { // C++ [dcl.array]p1: // T is called the array element type; this type shall not be a reference // type, the (possibly cv-qualified) type void, a function type or an @@ -1277,7 +1277,7 @@ QualType Sema::BuildArrayType(QualType T, ArrayType::ArraySizeModifier ASM, // C99 6.7.5.2p1: The size expression shall have integer type. // C++11 allows contextual conversions to such types. - if (!getLangOptions().CPlusPlus0x && + if (!getLangOpts().CPlusPlus0x && ArraySize && !ArraySize->isTypeDependent() && !ArraySize->getType()->isIntegralOrUnscopedEnumerationType()) { Diag(ArraySize->getLocStart(), diag::err_array_size_non_int) @@ -1298,7 +1298,7 @@ QualType Sema::BuildArrayType(QualType T, ArrayType::ArraySizeModifier ASM, isArraySizeVLA(*this, ArraySize, ConstVal)) { // Even in C++11, don't allow contextual conversions in the array bound // of a VLA. - if (getLangOptions().CPlusPlus0x && + if (getLangOpts().CPlusPlus0x && !ArraySize->getType()->isIntegralOrUnscopedEnumerationType()) { Diag(ArraySize->getLocStart(), diag::err_array_size_non_int) << ArraySize->getType() << ArraySize->getSourceRange(); @@ -1349,7 +1349,7 @@ QualType Sema::BuildArrayType(QualType T, ArrayType::ArraySizeModifier ASM, T = Context.getConstantArrayType(T, ConstVal, ASM, Quals); } // If this is not C99, extwarn about VLA's and C99 array size modifiers. - if (!getLangOptions().C99) { + if (!getLangOpts().C99) { if (T->isVariableArrayType()) { // Prohibit the use of non-POD types in VLAs. QualType BaseT = Context.getBaseElementType(T); @@ -1370,7 +1370,7 @@ QualType Sema::BuildArrayType(QualType T, ArrayType::ArraySizeModifier ASM, Diag(Loc, diag::ext_vla); } else if (ASM != ArrayType::Normal || Quals != 0) Diag(Loc, - getLangOptions().CPlusPlus? diag::err_c99_array_usage_cxx + getLangOpts().CPlusPlus? diag::err_c99_array_usage_cxx : diag::ext_c99_array_usage) << ASM; } @@ -1792,7 +1792,7 @@ static QualType GetDeclSpecTypeForDeclarator(TypeProcessingState &state, // type (this is checked later) and we can skip this. In other languages // using auto, we need to check regardless. if (D.getDeclSpec().getTypeSpecType() == DeclSpec::TST_auto && - (!SemaRef.getLangOptions().CPlusPlus0x || !D.isFunctionDeclarator())) { + (!SemaRef.getLangOpts().CPlusPlus0x || !D.isFunctionDeclarator())) { int Error = -1; switch (D.getContext()) { @@ -1854,7 +1854,7 @@ static QualType GetDeclSpecTypeForDeclarator(TypeProcessingState &state, // contains a trailing return type. That is only legal at the outermost // level. Check all declarator chunks (outermost first) anyway, to give // better diagnostics. - if (SemaRef.getLangOptions().CPlusPlus0x && Error != -1) { + if (SemaRef.getLangOpts().CPlusPlus0x && Error != -1) { for (unsigned i = 0, e = D.getNumTypeObjects(); i != e; ++i) { unsigned chunkIndex = e - i - 1; state.setCurrentChunkIndex(chunkIndex); @@ -1880,7 +1880,7 @@ static QualType GetDeclSpecTypeForDeclarator(TypeProcessingState &state, diag::warn_cxx98_compat_auto_type_specifier); } - if (SemaRef.getLangOptions().CPlusPlus && + if (SemaRef.getLangOpts().CPlusPlus && OwnedTagDecl && OwnedTagDecl->isCompleteDefinition()) { // Check the contexts where C++ forbids the declaration of a new class // or enumeration in a type-specifier-seq. @@ -2003,7 +2003,7 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state, Declarator &D = state.getDeclarator(); Sema &S = state.getSema(); ASTContext &Context = S.Context; - const LangOptions &LangOpts = S.getLangOptions(); + const LangOptions &LangOpts = S.getLangOpts(); bool ImplicitlyNoexcept = false; if (D.getName().getKind() == UnqualifiedId::IK_OperatorFunctionId && @@ -2639,7 +2639,7 @@ TypeSourceInfo *Sema::GetTypeForDeclarator(Declarator &D, Scope *S) { if (T.isNull()) return Context.getNullTypeSourceInfo(); - if (D.isPrototypeContext() && getLangOptions().ObjCAutoRefCount) + if (D.isPrototypeContext() && getLangOpts().ObjCAutoRefCount) inferARCWriteback(state, T); return GetFullTypeForDeclarator(state, T, ReturnTypeInfo); @@ -2750,7 +2750,7 @@ TypeSourceInfo *Sema::GetTypeForDeclaratorCast(Declarator &D, QualType FromTy) { if (declSpecTy.isNull()) return Context.getNullTypeSourceInfo(); - if (getLangOptions().ObjCAutoRefCount) { + if (getLangOpts().ObjCAutoRefCount) { Qualifiers::ObjCLifetime ownership = Context.getInnerObjCOwnership(FromTy); if (ownership != Qualifiers::OCL_None) transferARCOwnership(state, declSpecTy, ownership); @@ -3171,7 +3171,7 @@ TypeResult Sema::ActOnTypeName(Scope *S, Declarator &D) { if (D.getContext() != Declarator::ObjCParameterContext) checkUnusedDeclAttributes(D); - if (getLangOptions().CPlusPlus) { + if (getLangOpts().CPlusPlus) { // Check that there are no default arguments (C++ only). CheckExtraCXXDefaultArguments(D); } @@ -3319,7 +3319,7 @@ static bool handleObjCOwnershipTypeAttr(TypeProcessingState &state, // Consume lifetime attributes without further comment outside of // ARC mode. - if (!S.getLangOptions().ObjCAutoRefCount) + if (!S.getLangOpts().ObjCAutoRefCount) return true; Qualifiers::ObjCLifetime lifetime; @@ -3390,7 +3390,7 @@ static bool handleObjCOwnershipTypeAttr(TypeProcessingState &state, // Forbid __weak if the runtime doesn't support it. if (lifetime == Qualifiers::OCL_Weak && - !S.getLangOptions().ObjCRuntimeHasWeak && !NonObjCPointer) { + !S.getLangOpts().ObjCRuntimeHasWeak && !NonObjCPointer) { // Actually, delay this until we know what we're parsing. if (S.DelayedDiagnostics.shouldDelayDiagnostics()) { @@ -3637,7 +3637,7 @@ static bool handleFunctionTypeAttr(TypeProcessingState &state, // ns_returns_retained is not always a type attribute, but if we got // here, we're treating it as one right now. if (attr.getKind() == AttributeList::AT_ns_returns_retained) { - assert(S.getLangOptions().ObjCAutoRefCount && + assert(S.getLangOpts().ObjCAutoRefCount && "ns_returns_retained treated as type attribute in non-ARC"); if (attr.getNumArgs()) return true; @@ -3980,7 +3980,7 @@ static void processTypeAttrs(TypeProcessingState &state, QualType &type, break; case AttributeList::AT_ns_returns_retained: - if (!state.getSema().getLangOptions().ObjCAutoRefCount) + if (!state.getSema().getLangOpts().ObjCAutoRefCount) break; // fallthrough into the function attrs diff --git a/lib/Sema/TargetAttributesSema.cpp b/lib/Sema/TargetAttributesSema.cpp index aa0bc08ef7..8b19be74dd 100644 --- a/lib/Sema/TargetAttributesSema.cpp +++ b/lib/Sema/TargetAttributesSema.cpp @@ -169,7 +169,7 @@ static void HandleDLLImportAttr(Decl *D, const AttributeList &Attr, Sema &S) { // Apparently Visual C++ thinks it is okay to not emit a warning // in this case, so only emit a warning when -fms-extensions is not // specified. - if (!S.getLangOptions().MicrosoftExt) + if (!S.getLangOpts().MicrosoftExt) S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type) << Attr.getName() << 2 /*variable and function*/; return; diff --git a/lib/Sema/TreeTransform.h b/lib/Sema/TreeTransform.h index 9bb51b4124..16cfc3b2e3 100644 --- a/lib/Sema/TreeTransform.h +++ b/lib/Sema/TreeTransform.h @@ -2716,7 +2716,7 @@ TreeTransform<Derived>::TransformNestedNameSpecifierLoc( return NestedNameSpecifierLoc(); if (TL.getType()->isDependentType() || TL.getType()->isRecordType() || - (SemaRef.getLangOptions().CPlusPlus0x && + (SemaRef.getLangOpts().CPlusPlus0x && TL.getType()->isEnumeralType())) { assert(!TL.getType().hasLocalQualifiers() && "Can't get cv-qualifiers here"); |