diff options
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r-- | clang/lib/Sema/JumpDiagnostics.cpp | 2 | ||||
-rw-r--r-- | clang/lib/Sema/Sema.cpp | 2 | ||||
-rw-r--r-- | clang/lib/Sema/SemaAccess.cpp | 4 | ||||
-rw-r--r-- | clang/lib/Sema/SemaCXXScopeSpec.cpp | 4 | ||||
-rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 10 | ||||
-rw-r--r-- | clang/lib/Sema/SemaDeclCXX.cpp | 8 | ||||
-rw-r--r-- | clang/lib/Sema/SemaExpr.cpp | 6 | ||||
-rw-r--r-- | clang/lib/Sema/SemaExprCXX.cpp | 8 | ||||
-rw-r--r-- | clang/lib/Sema/SemaLookup.cpp | 2 | ||||
-rw-r--r-- | clang/lib/Sema/SemaOverload.cpp | 9 |
10 files changed, 27 insertions, 28 deletions
diff --git a/clang/lib/Sema/JumpDiagnostics.cpp b/clang/lib/Sema/JumpDiagnostics.cpp index a07f44221a0..6d36f627e7f 100644 --- a/clang/lib/Sema/JumpDiagnostics.cpp +++ b/clang/lib/Sema/JumpDiagnostics.cpp @@ -752,7 +752,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.getLangOpts().MicrosoftMode && JumpDiagWarning != 0 && + if (S.getLangOpts().MSVCCompat && JumpDiagWarning != 0 && IsMicrosoftJumpWarning(JumpDiagError, Scopes[I].InDiag)) ToScopesWarning.push_back(I); else if (IsCXX98CompatWarning(S, Scopes[I].InDiag)) diff --git a/clang/lib/Sema/Sema.cpp b/clang/lib/Sema/Sema.cpp index a6d3e322d0f..badff7e0dc8 100644 --- a/clang/lib/Sema/Sema.cpp +++ b/clang/lib/Sema/Sema.cpp @@ -178,7 +178,7 @@ void Sema::Initialize() { } // Initialize Microsoft "predefined C++ types". - if (PP.getLangOpts().MicrosoftMode && PP.getLangOpts().CPlusPlus) { + if (PP.getLangOpts().MSVCCompat && PP.getLangOpts().CPlusPlus) { if (IdResolver.begin(&Context.Idents.get("type_info")) == IdResolver.end()) PushOnScopeChains(Context.buildImplicitRecord("type_info", TTK_Class), TUScope); diff --git a/clang/lib/Sema/SemaAccess.cpp b/clang/lib/Sema/SemaAccess.cpp index b7df3244caa..719574c04e3 100644 --- a/clang/lib/Sema/SemaAccess.cpp +++ b/clang/lib/Sema/SemaAccess.cpp @@ -797,7 +797,7 @@ static AccessResult HasAccess(Sema &S, // Emulate a MSVC bug where the creation of pointer-to-member // to protected member of base class is allowed but only from // static member functions. - if (S.getLangOpts().MicrosoftMode && !EC.Functions.empty()) + if (S.getLangOpts().MSVCCompat && !EC.Functions.empty()) if (CXXMethodDecl* MD = dyn_cast<CXXMethodDecl>(EC.Functions.front())) if (MD->isStatic()) return AR_accessible; @@ -1422,7 +1422,7 @@ static AccessResult CheckEffectiveAccess(Sema &S, AccessTarget &Entity) { assert(Entity.getAccess() != AS_public && "called for public access!"); - if (S.getLangOpts().MicrosoftMode && + if (S.getLangOpts().MSVCCompat && IsMicrosoftUsingDeclarationAccessBug(S, Loc, Entity)) return AR_accessible; diff --git a/clang/lib/Sema/SemaCXXScopeSpec.cpp b/clang/lib/Sema/SemaCXXScopeSpec.cpp index 15f122ecb10..9a390a7e266 100644 --- a/clang/lib/Sema/SemaCXXScopeSpec.cpp +++ b/clang/lib/Sema/SemaCXXScopeSpec.cpp @@ -484,7 +484,7 @@ bool Sema::BuildCXXNestedNameSpecifier(Scope *S, // FIXME: Deal with ambiguities cleanly. - if (Found.empty() && !ErrorRecoveryLookup && !getLangOpts().MicrosoftMode) { + if (Found.empty() && !ErrorRecoveryLookup && !getLangOpts().MSVCCompat) { // We haven't found anything, and we're not recovering from a // different kind of error, so look for typos. DeclarationName Name = Found.getLookupName(); @@ -646,7 +646,7 @@ bool Sema::BuildCXXNestedNameSpecifier(Scope *S, // public: // void foo() { D::foo2(); } // }; - if (getLangOpts().MicrosoftMode) { + if (getLangOpts().MSVCCompat) { DeclContext *DC = LookupCtx ? LookupCtx : CurContext; if (DC->isDependentContext() && DC->isFunctionOrMethod()) { SS.Extend(Context, &Identifier, IdentifierLoc, CCLoc); diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 222211dab97..d119081d64a 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -467,7 +467,7 @@ bool Sema::DiagnoseUnknownTypeName(IdentifierInfo *&II, << II << DC << SS->getRange(); else if (isDependentScopeSpecifier(*SS)) { unsigned DiagID = diag::err_typename_missing; - if (getLangOpts().MicrosoftMode && isMicrosoftMissingTypename(SS, S)) + if (getLangOpts().MSVCCompat && isMicrosoftMissingTypename(SS, S)) DiagID = diag::warn_typename_missing; Diag(SS->getRange().getBegin(), DiagID) @@ -10488,7 +10488,7 @@ Decl *Sema::ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK, UPPC_FixedUnderlyingType)) EnumUnderlying = Context.IntTy.getTypePtr(); - } else if (getLangOpts().MicrosoftMode) + } else if (getLangOpts().MSVCCompat) // Microsoft enums are always of int type. EnumUnderlying = Context.IntTy.getTypePtr(); } @@ -10981,7 +10981,7 @@ CreateNewDecl: Diag(Def->getLocation(), diag::note_previous_definition); } else { unsigned DiagID = diag::ext_forward_ref_enum; - if (getLangOpts().MicrosoftMode) + if (getLangOpts().MSVCCompat) DiagID = diag::ext_ms_forward_ref_enum; else if (getLangOpts().CPlusPlus) DiagID = diag::err_forward_ref_enum; @@ -12353,7 +12353,7 @@ EnumConstantDecl *Sema::CheckEnumConstant(EnumDecl *Enum, else { SourceLocation ExpLoc; if (getLangOpts().CPlusPlus11 && Enum->isFixed() && - !getLangOpts().MicrosoftMode) { + !getLangOpts().MSVCCompat) { // 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. @@ -12378,7 +12378,7 @@ EnumConstantDecl *Sema::CheckEnumConstant(EnumDecl *Enum, // we perform a non-narrowing conversion as part of converted constant // expression checking. if (!isRepresentableIntegerValue(Context, EnumVal, EltTy)) { - if (getLangOpts().MicrosoftMode) { + if (getLangOpts().MSVCCompat) { Diag(IdLoc, diag::ext_enumerator_too_large) << EltTy; Val = ImpCastExprToType(Val, EltTy, CK_IntegralCast).take(); } else diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index 820f57f5f0c..f3593392fcb 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -5310,7 +5310,7 @@ bool Sema::ShouldDeleteSpecialMember(CXXMethodDecl *MD, CXXSpecialMember CSM, // In Microsoft mode, a user-declared move only causes the deletion of the // corresponding copy operation, not both copy operations. if (RD->hasUserDeclaredMoveConstructor() && - (!getLangOpts().MicrosoftMode || CSM == CXXCopyConstructor)) { + (!getLangOpts().MSVCCompat || CSM == CXXCopyConstructor)) { if (!Diagnose) return true; // Find any user-declared move constructor. @@ -5323,7 +5323,7 @@ bool Sema::ShouldDeleteSpecialMember(CXXMethodDecl *MD, CXXSpecialMember CSM, } assert(UserDeclaredMove); } else if (RD->hasUserDeclaredMoveAssignment() && - (!getLangOpts().MicrosoftMode || CSM == CXXCopyAssignment)) { + (!getLangOpts().MSVCCompat || CSM == CXXCopyAssignment)) { if (!Diagnose) return true; // Find any user-declared move assignment operator. @@ -9361,7 +9361,7 @@ static void diagnoseDeprecatedCopyOperation(Sema &S, CXXMethodDecl *CopyOp, UserDeclaredOperation = RD->getDestructor(); } else if (!isa<CXXConstructorDecl>(CopyOp) && RD->hasUserDeclaredCopyConstructor() && - !S.getLangOpts().MicrosoftMode) { + !S.getLangOpts().MSVCCompat) { // Find any user-declared copy constructor. for (CXXRecordDecl::ctor_iterator I = RD->ctor_begin(), E = RD->ctor_end(); I != E; ++I) { @@ -9373,7 +9373,7 @@ static void diagnoseDeprecatedCopyOperation(Sema &S, CXXMethodDecl *CopyOp, assert(UserDeclaredOperation); } else if (isa<CXXConstructorDecl>(CopyOp) && RD->hasUserDeclaredCopyAssignment() && - !S.getLangOpts().MicrosoftMode) { + !S.getLangOpts().MSVCCompat) { // Find any user-declared move assignment operator. for (CXXRecordDecl::method_iterator I = RD->method_begin(), E = RD->method_end(); I != E; ++I) { diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index f479dc8ae56..8531286a9c7 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -1733,7 +1733,7 @@ bool Sema::DiagnoseEmptyLookup(Scope *S, CXXScopeSpec &SS, LookupResult &R, // Give a code modification hint to insert 'this->'. // TODO: fixit for inserting 'Base<T>::' in the other cases. // Actually quite difficult! - if (getLangOpts().MicrosoftMode) + if (getLangOpts().MSVCCompat) diagnostic = diag::warn_found_via_dependent_bases_lookup; if (isInstance) { Diag(R.getNameLoc(), diagnostic) << Name @@ -1799,7 +1799,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 (getLangOpts().MicrosoftMode && isa<FunctionDecl>(DC) && + if (getLangOpts().MSVCCompat && isa<FunctionDecl>(DC) && cast<FunctionDecl>(DC)->getFriendObjectKind() && DC->getLexicalParent()->isRecord()) DC = DC->getLexicalParent(); @@ -2018,7 +2018,7 @@ ExprResult Sema::ActOnIdExpression(Scope *S, // unqualified name lookup. Any name lookup during template parsing means // clang might find something that MSVC doesn't. For now, we only handle // the common case of members of a dependent base class. - if (getLangOpts().MicrosoftMode) { + if (getLangOpts().MSVCCompat) { CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(CurContext); if (MD && MD->isInstance() && MD->getParent()->hasAnyDependentBases()) { assert(SS.isEmpty() && "qualifiers should be already handled"); diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp index 8426646b172..a29a279e4ba 100644 --- a/clang/lib/Sema/SemaExprCXX.cpp +++ b/clang/lib/Sema/SemaExprCXX.cpp @@ -454,7 +454,7 @@ Sema::ActOnCXXTypeid(SourceLocation OpLoc, SourceLocation LParenLoc, CXXTypeInfoDecl = R.getAsSingle<RecordDecl>(); // Microsoft's typeinfo doesn't have type_info in std but in the global // namespace if _HAS_EXCEPTIONS is defined to 0. See PR13153. - if (!CXXTypeInfoDecl && LangOpts.MicrosoftMode) { + if (!CXXTypeInfoDecl && LangOpts.MSVCCompat) { LookupQualifiedName(R, Context.getTranslationUnitDecl()); CXXTypeInfoDecl = R.getAsSingle<RecordDecl>(); } @@ -1650,7 +1650,7 @@ bool Sema::FindAllocationFunctions(SourceLocation StartLoc, SourceRange Range, // Didn't find a member overload. Look for a global one. DeclareGlobalNewDelete(); DeclContext *TUDecl = Context.getTranslationUnitDecl(); - bool FallbackEnabled = IsArray && Context.getLangOpts().MicrosoftMode; + bool FallbackEnabled = IsArray && Context.getLangOpts().MSVCCompat; if (FindAllocationOverload(StartLoc, Range, NewName, AllocArgs, TUDecl, /*AllowMissing=*/FallbackEnabled, OperatorNew, /*Diagnose=*/!FallbackEnabled)) { @@ -5070,7 +5070,7 @@ ExprResult Sema::ActOnDecltypeExpression(Expr *E) { // In MS mode, don't perform any extra checking of call return types within a // decltype expression. - if (getLangOpts().MicrosoftMode) + if (getLangOpts().MSVCCompat) return Owned(E); // Perform the semantic checks we delayed until this point. @@ -5345,7 +5345,7 @@ ExprResult Sema::BuildPseudoDestructorExpr(Expr *Base, if (!ObjectType->isDependentType() && !ObjectType->isScalarType() && !ObjectType->isVectorType()) { - if (getLangOpts().MicrosoftMode && ObjectType->isVoidType()) + if (getLangOpts().MSVCCompat && ObjectType->isVoidType()) Diag(OpLoc, diag::ext_pseudo_dtor_on_void) << Base->getSourceRange(); else Diag(OpLoc, diag::err_pseudo_dtor_base_not_scalar) diff --git a/clang/lib/Sema/SemaLookup.cpp b/clang/lib/Sema/SemaLookup.cpp index 2aa1ee56402..6b70ca2c9d8 100644 --- a/clang/lib/Sema/SemaLookup.cpp +++ b/clang/lib/Sema/SemaLookup.cpp @@ -4065,7 +4065,7 @@ TypoCorrection Sema::CorrectTypo(const DeclarationNameInfo &TypoName, // 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 (getLangOpts().MicrosoftMode && CurContext->isDependentContext() && + if (getLangOpts().MSVCCompat && CurContext->isDependentContext() && isa<CXXMethodDecl>(CurContext)) return TypoCorrection(); diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp index 6032ed39805..f8e0819887d 100644 --- a/clang/lib/Sema/SemaOverload.cpp +++ b/clang/lib/Sema/SemaOverload.cpp @@ -3631,11 +3631,10 @@ CompareStandardConversionSequences(Sema &S, // } // Here, MSVC will call f(int) instead of generating a compile error // as clang will do in standard mode. - if (S.getLangOpts().MicrosoftMode && - SCS1.Second == ICK_Integral_Conversion && - SCS2.Second == ICK_Floating_Integral && + if (S.getLangOpts().MSVCCompat && SCS1.Second == ICK_Integral_Conversion && + SCS2.Second == ICK_Floating_Integral && S.Context.getTypeSize(SCS1.getFromType()) == - S.Context.getTypeSize(SCS1.getToType(2))) + S.Context.getTypeSize(SCS1.getToType(2))) return ImplicitConversionSequence::Better; return ImplicitConversionSequence::Indistinguishable; @@ -10445,7 +10444,7 @@ bool Sema::buildOverloadedCallSet(Scope *S, Expr *Fn, // 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 (getLangOpts().MicrosoftMode && CurContext->isDependentContext() && + if (getLangOpts().MSVCCompat && CurContext->isDependentContext() && (isa<FunctionDecl>(CurContext) || isa<CXXRecordDecl>(CurContext))) { CallExpr *CE = new (Context) CallExpr(Context, Fn, Args, Context.DependentTy, VK_RValue, |