From: Daniel Dunbar Date: Tue, 10 Nov 2009 19:51:33 +0000 (+0000) Subject: Change LangOpts initialization to directly test the code generation options, X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e359445fd7ab78a35c63731371f8f97ec1c88d44;p=clang Change LangOpts initialization to directly test the code generation options, instead of reproducing their logic. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86709 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/tools/clang-cc/clang-cc.cpp b/tools/clang-cc/clang-cc.cpp index c0719bf576..026f9e0005 100644 --- a/tools/clang-cc/clang-cc.cpp +++ b/tools/clang-cc/clang-cc.cpp @@ -674,6 +674,7 @@ StackProtector("stack-protector", static void InitializeLanguageStandard(LangOptions &Options, LangKind LK, TargetInfo &Target, + const CompileOptions &CompileOpts, const llvm::StringMap &Features) { // Allow the target to set the default the language options as it sees fit. Target.getDefaultLangOptions(Options); @@ -837,17 +838,18 @@ static void InitializeLanguageStandard(LangOptions &Options, LangKind LK, // The __OPTIMIZE_SIZE__ define is tied to -Oz, which we don't // support. Options.OptimizeSize = 0; - - // -Os implies -O2 - if (OptSize || OptLevel) - Options.Optimize = 1; + Options.Optimize = !!CompileOpts.OptimizationLevel; assert(PICLevel <= 2 && "Invalid value for -pic-level"); Options.PICLevel = PICLevel; Options.GNUInline = !Options.C99; // FIXME: This is affected by other options (-fno-inline). - Options.NoInline = !OptSize && !OptLevel; + + // This is the __NO_INLINE__ define, which just depends on things like the + // optimization level and -fno-inline, not actually whether the backend has + // inlining enabled. + Options.NoInline = !CompileOpts.OptimizationLevel; Options.Static = StaticDefine; @@ -2176,7 +2178,7 @@ static void ConstructCompilerInvocation(CompilerInvocation &Opts, if (LK != langkind_ast) { InitializeLangOptions(Opts.getLangOpts(), LK); InitializeLanguageStandard(Opts.getLangOpts(), LK, Target, - Opts.getTargetFeatures()); + Opts.getCompileOpts(), Opts.getTargetFeatures()); } // Initialize the header search options.