diff --git a/clang/include/clang/Basic/LangOptions.def b/clang/include/clang/Basic/LangOptions.def index 9768d67930f9..9ff9dbacce34 100644 --- a/clang/include/clang/Basic/LangOptions.def +++ b/clang/include/clang/Basic/LangOptions.def @@ -43,7 +43,7 @@ LANGOPT(C99 , 1, 0, "C99") LANGOPT(C1X , 1, 0, "C1X") -LANGOPT(Microsoft , 1, 0, "Microsoft extensions") +LANGOPT(MicrosoftExt , 1, 0, "Microsoft extensions") LANGOPT(MicrosoftMode , 1, 0, "Microsoft compatibility mode") LANGOPT(Borland , 1, 0, "Borland extensions") LANGOPT(CPlusPlus , 1, 0, "C++") diff --git a/clang/include/clang/Parse/Parser.h b/clang/include/clang/Parse/Parser.h index 906958f32353..d32c36efbdf1 100644 --- a/clang/include/clang/Parse/Parser.h +++ b/clang/include/clang/Parse/Parser.h @@ -1739,7 +1739,7 @@ private: void MaybeParseMicrosoftAttributes(ParsedAttributes &attrs, SourceLocation *endLoc = 0) { - if (getLang().Microsoft && Tok.is(tok::l_square)) + if (getLang().MicrosoftExt && Tok.is(tok::l_square)) ParseMicrosoftAttributes(attrs, endLoc); } void ParseMicrosoftAttributes(ParsedAttributes &attrs, diff --git a/clang/lib/Basic/IdentifierTable.cpp b/clang/lib/Basic/IdentifierTable.cpp index 0103318405c6..2419f9bb6c38 100644 --- a/clang/lib/Basic/IdentifierTable.cpp +++ b/clang/lib/Basic/IdentifierTable.cpp @@ -115,7 +115,7 @@ static void AddKeyword(StringRef Keyword, else if (LangOpts.CPlusPlus0x && (Flags & KEYCXX0X)) AddResult = 2; else if (LangOpts.C99 && (Flags & KEYC99)) AddResult = 2; else if (LangOpts.GNUKeywords && (Flags & KEYGNU)) AddResult = 1; - else if (LangOpts.Microsoft && (Flags & KEYMS)) AddResult = 1; + else if (LangOpts.MicrosoftExt && (Flags & KEYMS)) AddResult = 1; else if (LangOpts.Borland && (Flags & KEYBORLAND)) AddResult = 1; else if (LangOpts.Bool && (Flags & BOOLSUPPORT)) AddResult = 2; else if (LangOpts.AltiVec && (Flags & KEYALTIVEC)) AddResult = 2; diff --git a/clang/lib/Basic/Targets.cpp b/clang/lib/Basic/Targets.cpp index efbb1395739d..48e4d8a048dd 100644 --- a/clang/lib/Basic/Targets.cpp +++ b/clang/lib/Basic/Targets.cpp @@ -505,7 +505,7 @@ protected: if (Opts.MSCVersion != 0) Builder.defineMacro("_MSC_VER", Twine(Opts.MSCVersion)); - if (Opts.Microsoft) { + if (Opts.MicrosoftExt) { Builder.defineMacro("_MSC_EXTENSIONS"); if (Opts.CPlusPlus0x) { @@ -1512,7 +1512,7 @@ void X86TargetInfo::getTargetDefines(const LangOptions &Opts, break; } - if (Opts.Microsoft && PointerWidth == 32) { + if (Opts.MicrosoftExt && PointerWidth == 32) { switch (SSELevel) { case SSE42: case SSE41: @@ -1732,7 +1732,7 @@ public: // mingw32-gcc provides __declspec(a) as alias of __attribute__((a)). // In contrast, clang-cc1 provides __declspec(a) with -fms-extensions. - if (Opts.Microsoft) + if (Opts.MicrosoftExt) // Provide "as-is" __declspec. Builder.defineMacro("__declspec", "__declspec"); else @@ -1948,7 +1948,7 @@ public: // mingw32-gcc provides __declspec(a) as alias of __attribute__((a)). // In contrast, clang-cc1 provides __declspec(a) with -fms-extensions. - if (Opts.Microsoft) + if (Opts.MicrosoftExt) // Provide "as-is" __declspec. Builder.defineMacro("__declspec", "__declspec"); else diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index 5f4310a086d4..7a18ebf4e115 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -613,7 +613,7 @@ static void LangOptsToArgs(const LangOptions &Opts, Res.push_back("-fno-gnu-keywords"); if (!Opts.GNUMode && Opts.GNUKeywords) Res.push_back("-fgnu-keywords"); - if (Opts.Microsoft) + if (Opts.MicrosoftExt) Res.push_back("-fms-extensions"); if (Opts.MSCVersion != 0) Res.push_back("-fmsc-version=" + llvm::utostr(Opts.MSCVersion)); @@ -1654,7 +1654,7 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK, OPT_fno_dollars_in_identifiers, Opts.DollarIdents); Opts.PascalStrings = Args.hasArg(OPT_fpascal_strings); - Opts.Microsoft = Args.hasArg(OPT_fms_extensions); + Opts.MicrosoftExt = Args.hasArg(OPT_fms_extensions); Opts.MicrosoftMode = Args.hasArg(OPT_fms_compatibility); Opts.MSCVersion = Args.getLastArgIntValue(OPT_fmsc_version, 0, Diags); Opts.Borland = Args.hasArg(OPT_fborland_extensions); diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp index e70ecf9da8c2..0f6e40ad28c1 100644 --- a/clang/lib/Frontend/InitPreprocessor.cpp +++ b/clang/lib/Frontend/InitPreprocessor.cpp @@ -344,7 +344,7 @@ static void InitializeStandardPredefinedMacros(const TargetInfo &TI, const LangOptions &LangOpts, const FrontendOptions &FEOpts, MacroBuilder &Builder) { - if (!LangOpts.Microsoft && !LangOpts.TraditionalCPP) + if (!LangOpts.MicrosoftExt && !LangOpts.TraditionalCPP) Builder.defineMacro("__STDC__"); if (LangOpts.Freestanding) Builder.defineMacro("__STDC_HOSTED__", "0"); @@ -470,7 +470,7 @@ static void InitializePredefinedMacros(const TargetInfo &TI, Builder.defineMacro("__private_extern__", "extern"); } - if (LangOpts.Microsoft) { + if (LangOpts.MicrosoftExt) { // Both __PRETTY_FUNCTION__ and __FUNCTION__ are GCC extensions, however // VC++ appears to only like __FUNCTION__. Builder.defineMacro("__PRETTY_FUNCTION__", "__FUNCTION__"); diff --git a/clang/lib/Frontend/PrintPreprocessedOutput.cpp b/clang/lib/Frontend/PrintPreprocessedOutput.cpp index 6f9253d4cd80..18c8099644b4 100644 --- a/clang/lib/Frontend/PrintPreprocessedOutput.cpp +++ b/clang/lib/Frontend/PrintPreprocessedOutput.cpp @@ -109,7 +109,7 @@ public: Initialized = false; // If we're in microsoft mode, use normal #line instead of line markers. - UseLineDirective = PP.getLangOptions().Microsoft; + UseLineDirective = PP.getLangOptions().MicrosoftExt; } void SetEmittedTokensOnThisLine() { EmittedTokensOnThisLine = true; } diff --git a/clang/lib/Lex/Lexer.cpp b/clang/lib/Lex/Lexer.cpp index 26996027d843..2135cd4fb8f7 100644 --- a/clang/lib/Lex/Lexer.cpp +++ b/clang/lib/Lex/Lexer.cpp @@ -1353,7 +1353,7 @@ void Lexer::LexNumericConstant(Token &Result, const char *CurPtr) { if ((C == '-' || C == '+') && (PrevCh == 'E' || PrevCh == 'e')) { // If we are in Microsoft mode, don't continue if the constant is hex. // For example, MSVC will accept the following as 3 tokens: 0x1234567e+1 - if (!Features.Microsoft || !isHexaLiteral(BufferPtr, Features)) + if (!Features.MicrosoftExt || !isHexaLiteral(BufferPtr, Features)) return LexNumericConstant(Result, ConsumeChar(CurPtr, Size, Result)); } @@ -2327,7 +2327,7 @@ LexNextToken: case 26: // DOS & CP/M EOF: "^Z". // If we're in Microsoft extensions mode, treat this as end of file. - if (Features.Microsoft) { + if (Features.MicrosoftExt) { // Read the PP instance variable into an automatic variable, because // LexEndOfFile will often delete 'this'. Preprocessor *PPCache = PP; @@ -2716,7 +2716,7 @@ LexNextToken: Kind = tok::hashhash; // '%:%:' -> '##' CurPtr = ConsumeChar(ConsumeChar(CurPtr, SizeTmp, Result), SizeTmp2, Result); - } else if (Char == '@' && Features.Microsoft) { // %:@ -> #@ -> Charize + } else if (Char == '@' && Features.MicrosoftExt) {// %:@ -> #@ -> Charize CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); if (!isLexingRawMode()) Diag(BufferPtr, diag::charize_microsoft_ext); @@ -2890,7 +2890,7 @@ LexNextToken: if (Char == '#') { Kind = tok::hashhash; CurPtr = ConsumeChar(CurPtr, SizeTmp, Result); - } else if (Char == '@' && Features.Microsoft) { // #@ -> Charize + } else if (Char == '@' && Features.MicrosoftExt) { // #@ -> Charize Kind = tok::hashat; if (!isLexingRawMode()) Diag(BufferPtr, diag::charize_microsoft_ext); diff --git a/clang/lib/Lex/LiteralSupport.cpp b/clang/lib/Lex/LiteralSupport.cpp index d0e133a28a68..986a08a3ce7b 100644 --- a/clang/lib/Lex/LiteralSupport.cpp +++ b/clang/lib/Lex/LiteralSupport.cpp @@ -452,7 +452,7 @@ NumericLiteralParser(const char *begin, const char *end, continue; // Success. case 'i': case 'I': - if (PP.getLangOptions().Microsoft) { + if (PP.getLangOptions().MicrosoftExt) { if (isFPConstant || isLong || isLongLong) break; // Allow i8, i16, i32, i64, and i128. diff --git a/clang/lib/Lex/PPMacroExpansion.cpp b/clang/lib/Lex/PPMacroExpansion.cpp index 9923ae7b22aa..06956879011e 100644 --- a/clang/lib/Lex/PPMacroExpansion.cpp +++ b/clang/lib/Lex/PPMacroExpansion.cpp @@ -93,7 +93,7 @@ void Preprocessor::RegisterBuiltinMacros() { Ident__has_include_next = RegisterBuiltinMacro(*this, "__has_include_next"); // Microsoft Extensions. - if (Features.Microsoft) + if (Features.MicrosoftExt) Ident__pragma = RegisterBuiltinMacro(*this, "__pragma"); else Ident__pragma = 0; diff --git a/clang/lib/Lex/Pragma.cpp b/clang/lib/Lex/Pragma.cpp index f738d1de9c71..5a2f5cbaded6 100644 --- a/clang/lib/Lex/Pragma.cpp +++ b/clang/lib/Lex/Pragma.cpp @@ -1034,7 +1034,7 @@ void Preprocessor::RegisterBuiltinPragmas() { AddPragmaHandler("STDC", new PragmaSTDC_UnknownHandler()); // MS extensions. - if (Features.Microsoft) { + if (Features.MicrosoftExt) { AddPragmaHandler(new PragmaCommentHandler()); } } diff --git a/clang/lib/Lex/TokenLexer.cpp b/clang/lib/Lex/TokenLexer.cpp index a651f6c91aa1..7ea28bf20c91 100644 --- a/clang/lib/Lex/TokenLexer.cpp +++ b/clang/lib/Lex/TokenLexer.cpp @@ -539,7 +539,7 @@ bool TokenLexer::PasteTokens(Token &Tok) { if (isInvalid) { // Test for the Microsoft extension of /##/ turning into // here on the // error path. - if (PP.getLangOptions().Microsoft && Tok.is(tok::slash) && + if (PP.getLangOptions().MicrosoftExt && Tok.is(tok::slash) && RHS.is(tok::slash)) { HandleMicrosoftCommentPaste(Tok); return true; @@ -556,8 +556,8 @@ bool TokenLexer::PasteTokens(Token &Tok) { // error to a warning that defaults to an error. This allows // disabling it. PP.Diag(Loc, - PP.getLangOptions().Microsoft ? diag::err_pp_bad_paste_ms - : diag::err_pp_bad_paste) + PP.getLangOptions().MicrosoftExt ? diag::err_pp_bad_paste_ms + : diag::err_pp_bad_paste) << Buffer.str(); } diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp index 16c25a47904f..897a195a41a3 100644 --- a/clang/lib/Parse/ParseDecl.cpp +++ b/clang/lib/Parse/ParseDecl.cpp @@ -2701,7 +2701,7 @@ void Parser::ParseEnumSpecifier(SourceLocation StartLoc, DeclSpec &DS, MaybeParseGNUAttributes(attrs); bool AllowFixedUnderlyingType - = getLang().CPlusPlus0x || getLang().Microsoft || getLang().ObjC2; + = getLang().CPlusPlus0x || getLang().MicrosoftExt || getLang().ObjC2; CXXScopeSpec &SS = DS.getTypeSpecScope(); if (getLang().CPlusPlus) { @@ -4152,7 +4152,7 @@ void Parser::ParseParameterDeclarationClause( DeclSpec DS(AttrFactory); // Skip any Microsoft attributes before a param. - if (getLang().Microsoft && Tok.is(tok::l_square)) + if (getLang().MicrosoftExt && Tok.is(tok::l_square)) ParseMicrosoftAttributes(DS.getAttributes()); SourceLocation DSStart = Tok.getLocation(); diff --git a/clang/lib/Parse/ParseDeclCXX.cpp b/clang/lib/Parse/ParseDeclCXX.cpp index 75c65481c482..2ccbc27b195a 100644 --- a/clang/lib/Parse/ParseDeclCXX.cpp +++ b/clang/lib/Parse/ParseDeclCXX.cpp @@ -1733,7 +1733,7 @@ void Parser::ParseCXXClassMemberDeclaration(AccessSpecifier AS, // MSVC permits pure specifier on inline functions declared at class scope. // Hence check for =0 before checking for function definition. - if (getLang().Microsoft && Tok.is(tok::equal) && + if (getLang().MicrosoftExt && Tok.is(tok::equal) && DeclaratorInfo.isFunctionDeclarator() && NextToken().is(tok::numeric_constant)) { ConsumeToken(); @@ -2110,7 +2110,7 @@ void Parser::ParseCXXMemberSpecification(SourceLocation RecordLoc, while (Tok.isNot(tok::r_brace) && Tok.isNot(tok::eof)) { // Each iteration of this loop reads one member-declaration. - if (getLang().Microsoft && (Tok.is(tok::kw___if_exists) || + if (getLang().MicrosoftExt && (Tok.is(tok::kw___if_exists) || Tok.is(tok::kw___if_not_exists))) { ParseMicrosoftIfExistsClassDeclaration((DeclSpec::TST)TagType, CurAS); continue; @@ -2426,7 +2426,7 @@ ExceptionSpecificationType Parser::ParseDynamicExceptionSpecification( // can throw anything". if (Tok.is(tok::ellipsis)) { SourceLocation EllipsisLoc = ConsumeToken(); - if (!getLang().Microsoft) + if (!getLang().MicrosoftExt) Diag(EllipsisLoc, diag::ext_ellipsis_exception_spec); SourceLocation RParenLoc = MatchRHSPunctuation(tok::r_paren, LParenLoc); SpecificationRange.setEnd(RParenLoc); diff --git a/clang/lib/Parse/ParseExpr.cpp b/clang/lib/Parse/ParseExpr.cpp index b11bccdf8917..9c0ab6171c1d 100644 --- a/clang/lib/Parse/ParseExpr.cpp +++ b/clang/lib/Parse/ParseExpr.cpp @@ -1351,7 +1351,7 @@ Parser::ParsePostfixExpressionSuffix(ExprResult LHS) { if (ParseUnqualifiedId(SS, /*EnteringContext=*/false, /*AllowDestructorName=*/true, - /*AllowConstructorName=*/ getLang().Microsoft, + /*AllowConstructorName=*/ getLang().MicrosoftExt, ObjectType, Name)) LHS = ExprError(); diff --git a/clang/lib/Parse/ParseExprCXX.cpp b/clang/lib/Parse/ParseExprCXX.cpp index 1faeebc37cd4..4086da84ab2f 100644 --- a/clang/lib/Parse/ParseExprCXX.cpp +++ b/clang/lib/Parse/ParseExprCXX.cpp @@ -398,7 +398,7 @@ bool Parser::ParseOptionalCXXScopeSpecifier(CXXScopeSpec &SS, // parse correctly as a template, so suggest the keyword 'template' // before 'getAs' and treat this as a dependent template name. unsigned DiagID = diag::err_missing_dependent_template_keyword; - if (getLang().Microsoft) + if (getLang().MicrosoftExt) DiagID = diag::warn_missing_dependent_template_keyword; Diag(Tok.getLocation(), DiagID) diff --git a/clang/lib/Parse/ParseStmt.cpp b/clang/lib/Parse/ParseStmt.cpp index dd5006760b41..c1ead6bdef8c 100644 --- a/clang/lib/Parse/ParseStmt.cpp +++ b/clang/lib/Parse/ParseStmt.cpp @@ -746,7 +746,7 @@ StmtResult Parser::ParseCompoundStatementBody(bool isStmtExpr) { continue; } - if (getLang().Microsoft && (Tok.is(tok::kw___if_exists) || + if (getLang().MicrosoftExt && (Tok.is(tok::kw___if_exists) || Tok.is(tok::kw___if_not_exists))) { ParseMicrosoftIfExistsStatement(Stmts); continue; @@ -1637,7 +1637,7 @@ StmtResult Parser::ParseAsmStatement(bool &msAsm) { assert(Tok.is(tok::kw_asm) && "Not an asm stmt"); SourceLocation AsmLoc = ConsumeToken(); - if (getLang().Microsoft && Tok.isNot(tok::l_paren) && !isTypeQualifier()) { + if (getLang().MicrosoftExt && Tok.isNot(tok::l_paren) && !isTypeQualifier()) { msAsm = true; return FuzzyParseMicrosoftAsmStatement(AsmLoc); } diff --git a/clang/lib/Parse/Parser.cpp b/clang/lib/Parse/Parser.cpp index c31e1634a0a6..dd6d527a66e9 100644 --- a/clang/lib/Parse/Parser.cpp +++ b/clang/lib/Parse/Parser.cpp @@ -1222,7 +1222,7 @@ bool Parser::TryAnnotateTypeOrScopeToken(bool EnteringContext) { 0, /*IsTypename*/true)) return true; if (!SS.isSet()) { - if (getLang().Microsoft) + if (getLang().MicrosoftExt) Diag(Tok.getLocation(), diag::warn_expected_qualified_after_typename); else Diag(Tok.getLocation(), diag::err_expected_qualified_after_typename); diff --git a/clang/lib/Rewrite/RewriteObjC.cpp b/clang/lib/Rewrite/RewriteObjC.cpp index 2e118e85f25d..1b7fb2dfc422 100644 --- a/clang/lib/Rewrite/RewriteObjC.cpp +++ b/clang/lib/Rewrite/RewriteObjC.cpp @@ -589,7 +589,7 @@ void RewriteObjC::Initialize(ASTContext &context) { Preamble += "struct objc_selector; struct objc_class;\n"; Preamble += "struct __rw_objc_super { struct objc_object *object; "; Preamble += "struct objc_object *superClass; "; - if (LangOpts.Microsoft) { + if (LangOpts.MicrosoftExt) { // Add a constructor for creating temporary objects. Preamble += "__rw_objc_super(struct objc_object *o, struct objc_object *s) " ": "; @@ -600,7 +600,7 @@ void RewriteObjC::Initialize(ASTContext &context) { Preamble += "typedef struct objc_object Protocol;\n"; Preamble += "#define _REWRITER_typedef_Protocol\n"; Preamble += "#endif\n"; - if (LangOpts.Microsoft) { + if (LangOpts.MicrosoftExt) { Preamble += "#define __OBJC_RW_DLLIMPORT extern \"C\" __declspec(dllimport)\n"; Preamble += "#define __OBJC_RW_STATICIMPORT extern \"C\"\n"; } else @@ -677,7 +677,7 @@ void RewriteObjC::Initialize(ASTContext &context) { Preamble += "__OBJC_RW_DLLIMPORT void *_NSConcreteStackBlock[32];\n"; Preamble += "#endif\n"; Preamble += "#endif\n"; - if (LangOpts.Microsoft) { + if (LangOpts.MicrosoftExt) { Preamble += "#undef __OBJC_RW_DLLIMPORT\n"; Preamble += "#undef __OBJC_RW_STATICIMPORT\n"; Preamble += "#ifndef KEEP_ATTRIBUTES\n"; // We use this for clang tests. @@ -1139,7 +1139,7 @@ void RewriteObjC::RewriteObjCMethodDecl(const ObjCInterfaceDecl *IDecl, if (OMD->isInstanceMethod()) { QualType selfTy = Context->getObjCInterfaceType(IDecl); selfTy = Context->getPointerType(selfTy); - if (!LangOpts.Microsoft) { + if (!LangOpts.MicrosoftExt) { if (ObjCSynthesizedStructs.count(const_cast(IDecl))) ResultStr += "struct "; } @@ -2880,7 +2880,7 @@ Stmt *RewriteObjC::SynthMessageExpr(ObjCMessageExpr *Exp, QualType superType = getSuperStructType(); Expr *SuperRep; - if (LangOpts.Microsoft) { + if (LangOpts.MicrosoftExt) { SynthSuperContructorFunctionDecl(); // Simulate a contructor call... DeclRefExpr *DRE = new (Context) DeclRefExpr(SuperContructorFunctionDecl, @@ -2989,7 +2989,7 @@ Stmt *RewriteObjC::SynthMessageExpr(ObjCMessageExpr *Exp, QualType superType = getSuperStructType(); Expr *SuperRep; - if (LangOpts.Microsoft) { + if (LangOpts.MicrosoftExt) { SynthSuperContructorFunctionDecl(); // Simulate a contructor call... DeclRefExpr *DRE = new (Context) DeclRefExpr(SuperContructorFunctionDecl, @@ -3336,7 +3336,7 @@ void RewriteObjC::SynthesizeObjCInternalStruct(ObjCInterfaceDecl *CDecl, // SynthesizeObjCInternalStruct is ever called recursively. Result += "\nstruct "; Result += CDecl->getNameAsString(); - if (LangOpts.Microsoft) + if (LangOpts.MicrosoftExt) Result += "_IMPL"; if (NumIvars > 0) { @@ -3827,7 +3827,7 @@ void RewriteObjC::SynthesizeIvarOffsetComputation(ObjCIvarDecl *ivar, } else { Result += "__OFFSETOFIVAR__(struct "; Result += ivar->getContainingInterface()->getNameAsString(); - if (LangOpts.Microsoft) + if (LangOpts.MicrosoftExt) Result += "_IMPL"; Result += ", "; Result += ivar->getNameAsString(); @@ -4071,7 +4071,7 @@ void RewriteObjC::RewriteObjCClassMetaData(ObjCImplementationDecl *IDecl, // class has size. Must synthesize its size. Result += ",sizeof(struct "; Result += CDecl->getNameAsString(); - if (LangOpts.Microsoft) + if (LangOpts.MicrosoftExt) Result += "_IMPL"; Result += ")"; } @@ -4189,7 +4189,7 @@ void RewriteObjC::SynthesizeMetaDataIntoBuffer(std::string &Result) { ", sizeof(struct _objc_module), \"\", &_OBJC_SYMBOLS\n"; Result += "};\n\n"; - if (LangOpts.Microsoft) { + if (LangOpts.MicrosoftExt) { if (ProtocolExprDecls.size()) { Result += "#pragma section(\".objc_protocol$B\",long,read,write)\n"; Result += "#pragma data_seg(push, \".objc_protocol$B\")\n"; diff --git a/clang/lib/Sema/DeclSpec.cpp b/clang/lib/Sema/DeclSpec.cpp index bb483cc9b104..7278922967c5 100644 --- a/clang/lib/Sema/DeclSpec.cpp +++ b/clang/lib/Sema/DeclSpec.cpp @@ -866,7 +866,7 @@ void DeclSpec::Finish(Diagnostic &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().Microsoft && + if (PP.getLangOptions().CPlusPlus && !PP.getLangOptions().MicrosoftExt && TypeSpecType == TST_unspecified && StorageClassSpec == SCS_auto) { TypeSpecType = TST_auto; StorageClassSpec = StorageClassSpecAsWritten = SCS_unspecified; diff --git a/clang/lib/Sema/JumpDiagnostics.cpp b/clang/lib/Sema/JumpDiagnostics.cpp index fcc3154ebecf..40e8bcb247db 100644 --- a/clang/lib/Sema/JumpDiagnostics.cpp +++ b/clang/lib/Sema/JumpDiagnostics.cpp @@ -694,7 +694,7 @@ void JumpScopeChecker::CheckJump(Stmt *From, Stmt *To, SourceLocation DiagLoc, SmallVector ToScopesError; SmallVector ToScopesWarning; for (unsigned I = ToScope; I != CommonScope; I = Scopes[I].ParentScope) { - if (S.getLangOptions().Microsoft && JumpDiagWarning != 0 && + if (S.getLangOptions().MicrosoftExt && JumpDiagWarning != 0 && IsMicrosoftJumpWarning(JumpDiagError, Scopes[I].InDiag)) ToScopesWarning.push_back(I); else if (Scopes[I].InDiag) diff --git a/clang/lib/Sema/SemaAccess.cpp b/clang/lib/Sema/SemaAccess.cpp index abea1ba61b42..21d120a9fcc4 100644 --- a/clang/lib/Sema/SemaAccess.cpp +++ b/clang/lib/Sema/SemaAccess.cpp @@ -1273,7 +1273,7 @@ static AccessResult CheckEffectiveAccess(Sema &S, AccessTarget &Entity) { assert(Entity.getAccess() != AS_public && "called for public access!"); - if (S.getLangOptions().Microsoft && + if (S.getLangOptions().MicrosoftExt && IsMicrosoftUsingDeclarationAccessBug(S, Loc, Entity)) return AR_accessible; diff --git a/clang/lib/Sema/SemaCXXCast.cpp b/clang/lib/Sema/SemaCXXCast.cpp index 46f71be06019..bcad4995a8e7 100644 --- a/clang/lib/Sema/SemaCXXCast.cpp +++ b/clang/lib/Sema/SemaCXXCast.cpp @@ -1593,7 +1593,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().Microsoft) { + !Self.getLangOptions().MicrosoftExt) { msg = diag::err_bad_reinterpret_cast_small_int; return TC_Failed; } diff --git a/clang/lib/Sema/SemaCXXScopeSpec.cpp b/clang/lib/Sema/SemaCXXScopeSpec.cpp index d5bcb712553a..a2cef9cf931e 100644 --- a/clang/lib/Sema/SemaCXXScopeSpec.cpp +++ b/clang/lib/Sema/SemaCXXScopeSpec.cpp @@ -632,7 +632,7 @@ bool Sema::BuildCXXNestedNameSpecifier(Scope *S, // public: // void foo() { D::foo2(); } // }; - if (getLangOptions().Microsoft) { + if (getLangOptions().MicrosoftExt) { 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 abc3cf1938f1..dfa8f15b213f 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -362,7 +362,7 @@ bool Sema::DiagnoseUnknownTypeName(const IdentifierInfo &II, << &II << DC << SS->getRange(); else if (isDependentScopeSpecifier(*SS)) { unsigned DiagID = diag::err_typename_missing; - if (getLangOptions().Microsoft && isMicrosoftMissingTypename(SS)) + if (getLangOptions().MicrosoftExt && isMicrosoftMissingTypename(SS)) DiagID = diag::warn_typename_missing; Diag(SS->getRange().getBegin(), DiagID) @@ -1400,7 +1400,7 @@ void Sema::MergeTypedefNameDecl(TypedefNameDecl *New, LookupResult &OldDecls) { else if (New->isModulePrivate()) diagnoseModulePrivateRedeclaration(New, Old); - if (getLangOptions().Microsoft) + if (getLangOptions().MicrosoftExt) return; if (getLangOptions().CPlusPlus) { @@ -1636,7 +1636,7 @@ bool Sema::MergeFunctionDecl(FunctionDecl *New, Decl *OldD) { New->getStorageClass() == SC_Static && Old->getStorageClass() != SC_Static && !canRedefineFunction(Old, getLangOptions())) { - if (getLangOptions().Microsoft) { + if (getLangOptions().MicrosoftExt) { Diag(New->getLocation(), diag::warn_static_non_static) << New; Diag(Old->getLocation(), PrevDiag); } else { @@ -2298,7 +2298,7 @@ Decl *Sema::ParsedFreeStandingDeclSpec(Scope *S, AccessSpecifier AS, } // Check for Microsoft C extension: anonymous struct. - if (getLangOptions().Microsoft && !getLangOptions().CPlusPlus && + if (getLangOptions().MicrosoftExt && !getLangOptions().CPlusPlus && CurContext->isRecord() && DS.getStorageClassSpec() == DeclSpec::SCS_unspecified) { // Handle 2 kinds of anonymous struct: @@ -2656,7 +2656,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().Microsoft) + if (getLangOptions().MicrosoftExt) Diag(MemRecord->getLocation(), diag::ext_anonymous_record_with_type) << (int)Record->isUnion(); else { @@ -2680,7 +2680,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().Microsoft && + if (getLangOptions().MicrosoftExt && DK == diag::err_anonymous_record_with_type) Diag((*Mem)->getLocation(), diag::ext_anonymous_record_with_type) << (int)Record->isUnion(); @@ -4953,7 +4953,7 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC, if (CurContext->isDependentContext() && CurContext->isRecord() && !isFriend) { isDependentClassScopeExplicitSpecialization = true; - Diag(NewFD->getLocation(), getLangOptions().Microsoft ? + Diag(NewFD->getLocation(), getLangOptions().MicrosoftExt ? diag::ext_function_specialization_in_class : diag::err_function_specialization_in_class) << NewFD->getDeclName(); @@ -6686,7 +6686,7 @@ Decl *Sema::ActOnStartOfFunctionDef(Scope *FnBodyScope, Decl *D) { // dllimport attribute cannot be directly applied to definition. // Microsoft accepts dllimport for functions defined within class scope. if (!DA->isInherited() && - !(LangOpts.Microsoft && FD->getLexicalDeclContext()->isRecord())) { + !(LangOpts.MicrosoftExt && FD->getLexicalDeclContext()->isRecord())) { Diag(FD->getLocation(), diag::err_attribute_can_be_applied_only_to_symbol_declaration) << "dllimport"; @@ -6696,7 +6696,7 @@ Decl *Sema::ActOnStartOfFunctionDef(Scope *FnBodyScope, Decl *D) { // Visual C++ appears to not think this is an issue, so only issue // a warning when Microsoft extensions are disabled. - if (!LangOpts.Microsoft) { + if (!LangOpts.MicrosoftExt) { // If a symbol previously declared dllimport is later defined, the // attribute is ignored in subsequent references, and a warning is // emitted. @@ -6773,7 +6773,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().Microsoft && FD->isPure()) + if (getLangOptions().MicrosoftExt && FD->isPure()) Diag(FD->getLocation(), diag::warn_pure_function_definition); if (!FD->isInvalidDecl()) { @@ -7277,7 +7277,7 @@ Decl *Sema::ActOnTag(Scope *S, unsigned TagSpec, TagUseKind TUK, UPPC_FixedUnderlyingType)) EnumUnderlying = Context.IntTy.getTypePtr(); - } else if (getLangOptions().Microsoft) + } else if (getLangOptions().MicrosoftExt) // Microsoft enums are always of int type. EnumUnderlying = Context.IntTy.getTypePtr(); } @@ -7576,7 +7576,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().Microsoft)) || TUK == TUK_Friend) + getLangOptions().MicrosoftExt)) || TUK == TUK_Friend) return PrevTagDecl; // Diagnose attempts to redefine a tag. @@ -7728,7 +7728,7 @@ CreateNewDecl: Diag(Def->getLocation(), diag::note_previous_definition); } else { unsigned DiagID = diag::ext_forward_ref_enum; - if (getLangOptions().Microsoft) + if (getLangOptions().MicrosoftExt) DiagID = diag::ext_ms_forward_ref_enum; else if (getLangOptions().CPlusPlus) DiagID = diag::err_forward_ref_enum; @@ -7840,7 +7840,7 @@ CreateNewDecl: // the tag name visible. if (TUK == TUK_Friend) New->setObjectOfFriendDecl(/* PreviouslyDeclared = */ !Previous.empty() || - getLangOptions().Microsoft); + getLangOptions().MicrosoftExt); // Set the access specifier. if (!Invalid && SearchDC->isRecord()) @@ -8702,13 +8702,14 @@ void Sema::ActOnFields(Scope* S, continue; } else if (FDTy->isIncompleteArrayType() && Record && ((i == NumFields - 1 && !Record->isUnion()) || - ((getLangOptions().Microsoft || getLangOptions().CPlusPlus) && + ((getLangOptions().MicrosoftExt || + getLangOptions().CPlusPlus) && (i == NumFields - 1 || 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().Microsoft) { + if (getLangOptions().MicrosoftExt) { if (Record->isUnion()) Diag(FD->getLocation(), diag::ext_flexible_array_union_ms) << FD->getDeclName(); @@ -9071,7 +9072,7 @@ EnumConstantDecl *Sema::CheckEnumConstant(EnumDecl *Enum, // ... if the initializing value of an enumerator cannot be // represented by the underlying type, the program is ill-formed. if (!isRepresentableIntegerValue(Context, EnumVal, EltTy)) { - if (getLangOptions().Microsoft) { + if (getLangOptions().MicrosoftExt) { Diag(IdLoc, diag::ext_enumerator_too_large) << EltTy; Val = ImpCastExprToType(Val, EltTy, CK_IntegralCast).take(); } else diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp index f987a5d5942f..1f97d402114e 100644 --- a/clang/lib/Sema/SemaDeclAttr.cpp +++ b/clang/lib/Sema/SemaDeclAttr.cpp @@ -3322,7 +3322,7 @@ static bool isKnownDeclSpecAttr(const AttributeList &Attr) { //===----------------------------------------------------------------------===// static void handleUuidAttr(Sema &S, Decl *D, const AttributeList &Attr) { - if (S.LangOpts.Microsoft || S.LangOpts.Borland) { + if (S.LangOpts.MicrosoftExt || S.LangOpts.Borland) { // check the attribute arguments. if (!checkAttributeNumArgs(S, Attr, 1)) return; diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index f8c2905316be..0f7af4e30dd1 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -392,7 +392,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().Microsoft) { + if (getLangOptions().MicrosoftExt) { CXXMethodDecl* MD = dyn_cast(New); if (MD && MD->getParent()->getDescribedClassTemplate()) { // Merge the old default argument into the new parameter. diff --git a/clang/lib/Sema/SemaExceptionSpec.cpp b/clang/lib/Sema/SemaExceptionSpec.cpp index 7bcec315ddab..65bed3a205e1 100644 --- a/clang/lib/Sema/SemaExceptionSpec.cpp +++ b/clang/lib/Sema/SemaExceptionSpec.cpp @@ -101,7 +101,7 @@ bool Sema::CheckEquivalentExceptionSpec(FunctionDecl *Old, FunctionDecl *New) { bool MissingExceptionSpecification = false; bool MissingEmptyExceptionSpecification = false; unsigned DiagID = diag::err_mismatched_exception_spec; - if (getLangOptions().Microsoft) + if (getLangOptions().MicrosoftExt) DiagID = diag::warn_mismatched_exception_spec; if (!CheckEquivalentExceptionSpec(PDiag(DiagID), @@ -264,7 +264,7 @@ bool Sema::CheckEquivalentExceptionSpec( const FunctionProtoType *Old, SourceLocation OldLoc, const FunctionProtoType *New, SourceLocation NewLoc) { unsigned DiagID = diag::err_mismatched_exception_spec; - if (getLangOptions().Microsoft) + if (getLangOptions().MicrosoftExt) DiagID = diag::warn_mismatched_exception_spec; return CheckEquivalentExceptionSpec( PDiag(DiagID), @@ -717,7 +717,7 @@ bool Sema::CheckOverridingFunctionExceptionSpec(const CXXMethodDecl *New, } } unsigned DiagID = diag::err_override_exception_spec; - if (getLangOptions().Microsoft) + if (getLangOptions().MicrosoftExt) DiagID = diag::warn_override_exception_spec; return CheckExceptionSpecSubset(PDiag(DiagID), PDiag(diag::note_overridden_virtual_function), diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index 36623e3ac897..2d80ac1265e6 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -1441,7 +1441,7 @@ bool Sema::DiagnoseEmptyLookup(Scope *S, CXXScopeSpec &SS, LookupResult &R, CXXMethodDecl *DepMethod = cast_or_null( CurMethod->getInstantiatedFromMemberFunction()); if (DepMethod) { - if (getLangOptions().Microsoft) + if (getLangOptions().MicrosoftExt) diagnostic = diag::warn_found_via_dependent_bases_lookup; Diag(R.getNameLoc(), diagnostic) << Name << FixItHint::CreateInsertion(R.getNameLoc(), "this->"); @@ -2601,7 +2601,7 @@ ExprResult Sema::ActOnNumericConstant(const Token &Tok) { // 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().Microsoft && Literal.isLongLong))) + (getLangOptions().MicrosoftExt && Literal.isLongLong))) Ty = Context.LongLongTy; else if (AllowUnsigned) Ty = Context.UnsignedLongLongTy; diff --git a/clang/lib/Sema/SemaExprMember.cpp b/clang/lib/Sema/SemaExprMember.cpp index 0fd654b479c1..091489046652 100644 --- a/clang/lib/Sema/SemaExprMember.cpp +++ b/clang/lib/Sema/SemaExprMember.cpp @@ -1432,7 +1432,7 @@ ExprResult Sema::ActOnMemberAccessExpr(Scope *S, Expr *Base, return ExprError(); // Warn about the explicit constructor calls Microsoft extension. - if (getLangOptions().Microsoft && + if (getLangOptions().MicrosoftExt && Id.getKind() == UnqualifiedId::IK_ConstructorName) Diag(Id.getSourceRange().getBegin(), diag::ext_ms_explicit_constructor_call); diff --git a/clang/lib/Sema/SemaInit.cpp b/clang/lib/Sema/SemaInit.cpp index b4ff3c5154a1..5fa8486a7f1e 100644 --- a/clang/lib/Sema/SemaInit.cpp +++ b/clang/lib/Sema/SemaInit.cpp @@ -2958,7 +2958,7 @@ static void TryReferenceInitialization(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().Microsoft) + if (!S.getLangOptions().CPlusPlus0x && !S.getLangOptions().MicrosoftExt) Sequence.AddExtraneousCopyToTemporary(cv2T2); } @@ -5176,7 +5176,7 @@ static void DiagnoseNarrowingInInitList( bool Constant, const APValue &ConstantValue) { if (Constant) { S.Diag(InitE->getLocStart(), - S.getLangOptions().CPlusPlus0x && !S.getLangOptions().Microsoft + S.getLangOptions().CPlusPlus0x && !S.getLangOptions().MicrosoftExt ? diag::err_init_list_constant_narrowing : diag::warn_init_list_constant_narrowing) << InitE->getSourceRange() @@ -5184,7 +5184,7 @@ static void DiagnoseNarrowingInInitList( << EntityType.getLocalUnqualifiedType(); } else S.Diag(InitE->getLocStart(), - S.getLangOptions().CPlusPlus0x && !S.getLangOptions().Microsoft + S.getLangOptions().CPlusPlus0x && !S.getLangOptions().MicrosoftExt ? diag::err_init_list_variable_narrowing : diag::warn_init_list_variable_narrowing) << InitE->getSourceRange() diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp index cce4057dd74d..a2ef403618fb 100644 --- a/clang/lib/Sema/SemaOverload.cpp +++ b/clang/lib/Sema/SemaOverload.cpp @@ -1665,7 +1665,7 @@ bool Sema::IsPointerConversion(Expr *From, QualType FromType, QualType ToType, } // MSVC allows implicit function to void* type conversion. - if (getLangOptions().Microsoft && FromPointeeType->isFunctionType() && + if (getLangOptions().MicrosoftExt && FromPointeeType->isFunctionType() && ToPointeeType->isVoidType()) { ConvertedType = BuildSimilarlyQualifiedPointerType(FromTypePtr, ToPointeeType, @@ -8373,7 +8373,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().Microsoft && CurContext->isDependentContext() && + if (getLangOptions().MicrosoftExt && CurContext->isDependentContext() && isa(CurContext)) { CallExpr *CE = new (Context) CallExpr(Context, Fn, Args, NumArgs, Context.DependentTy, VK_RValue, @@ -9209,7 +9209,7 @@ Sema::BuildCallToMemberFunction(Scope *S, Expr *MemExprE, // Microsoft supports direct constructor calls. - if (getLangOptions().Microsoft && isa(Func)) { + if (getLangOptions().MicrosoftExt && isa(Func)) { AddOverloadCandidate(cast(Func), I.getPair(), Args, NumArgs, CandidateSet); } else if ((Method = dyn_cast(Func))) { diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp index f613ebb36c6c..341cf4de9469 100644 --- a/clang/lib/Sema/SemaTemplate.cpp +++ b/clang/lib/Sema/SemaTemplate.cpp @@ -424,7 +424,7 @@ bool Sema::DiagnoseTemplateParameterShadow(SourceLocation Loc, Decl *PrevDecl) { assert(PrevDecl->isTemplateParameter() && "Not a template parameter"); // Microsoft Visual C++ permits template parameters to be shadowed. - if (getLangOptions().Microsoft) + if (getLangOptions().MicrosoftExt) return false; // C++ [temp.local]p4: @@ -3370,7 +3370,7 @@ CheckTemplateArgumentAddressOfObjectOrFunction(Sema &S, } } - if (S.getLangOptions().Microsoft && isa(Arg)) { + if (S.getLangOptions().MicrosoftExt && isa(Arg)) { Converted = TemplateArgument(ArgIn); return false; } @@ -4521,7 +4521,7 @@ static bool CheckTemplateSpecializationScope(Sema &S, } if (S.CurContext->isRecord() && !IsPartialSpecialization) { - if (S.getLangOptions().Microsoft) { + if (S.getLangOptions().MicrosoftExt) { // Do not warn for class scope explicit specialization during // instantiation, warning was already emitted during pattern // semantic analysis. diff --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp index e48704ca1df8..ee8e52d22e70 100644 --- a/clang/lib/Sema/SemaType.cpp +++ b/clang/lib/Sema/SemaType.cpp @@ -664,7 +664,7 @@ static QualType ConvertDeclSpecToType(TypeProcessingState &state) { // each struct declaration and type name." // FIXME: Does Microsoft really have the implicit int extension in C++? if (S.getLangOptions().CPlusPlus && - !S.getLangOptions().Microsoft) { + !S.getLangOptions().MicrosoftExt) { S.Diag(DeclLoc, diag::err_missing_type_specifier) << DS.getSourceRange(); diff --git a/clang/lib/Sema/TargetAttributesSema.cpp b/clang/lib/Sema/TargetAttributesSema.cpp index 0560a8b78d57..877bc32521a9 100644 --- a/clang/lib/Sema/TargetAttributesSema.cpp +++ b/clang/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().Microsoft) + if (!S.getLangOptions().MicrosoftExt) S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type) << Attr.getName() << 2 /*variable and function*/; return;