Rename LangOptions::Microsoft to LangOptions::MicrosoftExt to make it clear that this flag must be used only for Microsoft extensions and not emulation; to avoid confusion with the new LangOptions::MicrosoftMode flag.

Many of the code now under LangOptions::MicrosoftExt will eventually be moved under the LangOptions::MicrosoftMode flag.

llvm-svn: 139987
This commit is contained in:
Francois Pichet 2011-09-17 17:15:52 +00:00
parent f2b8c854dd
commit 0706d203cf
35 changed files with 84 additions and 83 deletions

View File

@ -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++")

View File

@ -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,

View File

@ -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;

View File

@ -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

View File

@ -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);

View File

@ -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__");

View File

@ -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; }

View File

@ -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);

View File

@ -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.

View File

@ -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;

View File

@ -1034,7 +1034,7 @@ void Preprocessor::RegisterBuiltinPragmas() {
AddPragmaHandler("STDC", new PragmaSTDC_UnknownHandler());
// MS extensions.
if (Features.Microsoft) {
if (Features.MicrosoftExt) {
AddPragmaHandler(new PragmaCommentHandler());
}
}

View File

@ -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();
}

View File

@ -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();

View File

@ -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);

View File

@ -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();

View File

@ -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)

View File

@ -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);
}

View File

@ -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);

View File

@ -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<ObjCInterfaceDecl*>(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";

View File

@ -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;

View File

@ -694,7 +694,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().Microsoft && JumpDiagWarning != 0 &&
if (S.getLangOptions().MicrosoftExt && JumpDiagWarning != 0 &&
IsMicrosoftJumpWarning(JumpDiagError, Scopes[I].InDiag))
ToScopesWarning.push_back(I);
else if (Scopes[I].InDiag)

View File

@ -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;

View File

@ -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;
}

View File

@ -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);

View File

@ -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

View File

@ -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;

View File

@ -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<CXXMethodDecl>(New);
if (MD && MD->getParent()->getDescribedClassTemplate()) {
// Merge the old default argument into the new parameter.

View File

@ -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),

View File

@ -1441,7 +1441,7 @@ bool Sema::DiagnoseEmptyLookup(Scope *S, CXXScopeSpec &SS, LookupResult &R,
CXXMethodDecl *DepMethod = cast_or_null<CXXMethodDecl>(
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;

View File

@ -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);

View File

@ -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()

View File

@ -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<CXXMethodDecl>(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<CXXConstructorDecl>(Func)) {
if (getLangOptions().MicrosoftExt && isa<CXXConstructorDecl>(Func)) {
AddOverloadCandidate(cast<CXXConstructorDecl>(Func), I.getPair(), Args, NumArgs,
CandidateSet);
} else if ((Method = dyn_cast<CXXMethodDecl>(Func))) {

View File

@ -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<CXXUuidofExpr>(Arg)) {
if (S.getLangOptions().MicrosoftExt && isa<CXXUuidofExpr>(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.

View File

@ -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();

View File

@ -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;