From: Craig Topper Date: Sun, 15 Nov 2015 17:27:57 +0000 (+0000) Subject: [Sema] Use getLangOpts in Sema instead of Preprocessor. Call getTargetInfo on the... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b1e0a551b2e7ef2114ddd9dbd499c2fab068c722;p=clang [Sema] Use getLangOpts in Sema instead of Preprocessor. Call getTargetInfo on the AST context instead of Preprocessor. NFC git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@253175 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/Sema.cpp b/lib/Sema/Sema.cpp index 5c56169a5a..b87fb52f4d 100644 --- a/lib/Sema/Sema.cpp +++ b/lib/Sema/Sema.cpp @@ -120,8 +120,7 @@ Sema::Sema(Preprocessor &pp, ASTContext &ctxt, ASTConsumer &consumer, FieldCollector.reset(new CXXFieldCollector()); // Tell diagnostics how to render things from the AST library. - PP.getDiagnostics().SetArgToStringFn(&FormatASTNodeDiagnosticArgument, - &Context); + Diags.SetArgToStringFn(&FormatASTNodeDiagnosticArgument, &Context); ExprEvalContexts.emplace_back(PotentiallyEvaluated, 0, false, nullptr, false); @@ -168,7 +167,7 @@ void Sema::Initialize() { // Initialize predefined Objective-C types: - if (PP.getLangOpts().ObjC1) { + if (getLangOpts().ObjC1) { // If 'SEL' does not yet refer to any declarations, make it refer to the // predefined 'SEL'. DeclarationName SEL = &Context.Idents.get("SEL"); @@ -193,8 +192,8 @@ void Sema::Initialize() { } // Initialize Microsoft "predefined C++ types". - if (PP.getLangOpts().MSVCCompat) { - if (PP.getLangOpts().CPlusPlus && + if (getLangOpts().MSVCCompat) { + if (getLangOpts().CPlusPlus && IdResolver.begin(&Context.Idents.get("type_info")) == IdResolver.end()) PushOnScopeChains(Context.buildImplicitRecord("type_info", TTK_Class), TUScope); @@ -203,7 +202,7 @@ void Sema::Initialize() { } // Initialize predefined OpenCL types. - if (PP.getLangOpts().OpenCL) { + if (getLangOpts().OpenCL) { addImplicitTypedef("image1d_t", Context.OCLImage1dTy); addImplicitTypedef("image1d_array_t", Context.OCLImage1dArrayTy); addImplicitTypedef("image1d_buffer_t", Context.OCLImage1dBufferTy); @@ -249,7 +248,7 @@ void Sema::Initialize() { } } - if (PP.getTargetInfo().hasBuiltinMSVaList()) { + if (Context.getTargetInfo().hasBuiltinMSVaList()) { DeclarationName MSVaList = &Context.Idents.get("__builtin_ms_va_list"); if (IdResolver.begin(MSVaList) == IdResolver.end()) PushOnScopeChains(Context.getBuiltinMSVaListDecl(), TUScope); diff --git a/lib/Sema/SemaCodeComplete.cpp b/lib/Sema/SemaCodeComplete.cpp index ad7185ccf4..20a1eb1a6b 100644 --- a/lib/Sema/SemaCodeComplete.cpp +++ b/lib/Sema/SemaCodeComplete.cpp @@ -3377,7 +3377,7 @@ void Sema::CodeCompleteOrdinaryName(Scope *S, case PCC_Statement: case PCC_RecoveryInFunction: if (S->getFnParent()) - AddPrettyFunctionResults(PP.getLangOpts(), Results); + AddPrettyFunctionResults(getLangOpts(), Results); break; case PCC_Namespace: @@ -3521,7 +3521,7 @@ void Sema::CodeCompleteExpression(Scope *S, if (S->getFnParent() && !Data.ObjCCollection && !Data.IntegralConstantExpression) - AddPrettyFunctionResults(PP.getLangOpts(), Results); + AddPrettyFunctionResults(getLangOpts(), Results); if (CodeCompleter->includeMacros()) AddMacroResults(PP, Results, false, PreferredTypeIsPointer); @@ -4206,7 +4206,7 @@ void Sema::CodeCompleteAfterIf(Scope *S) { Results.ExitScope(); if (S->getFnParent()) - AddPrettyFunctionResults(PP.getLangOpts(), Results); + AddPrettyFunctionResults(getLangOpts(), Results); if (CodeCompleter->includeMacros()) AddMacroResults(PP, Results, false);