[cfe-commits] r86709 - /cfe/trunk/tools/clang-cc/clang-cc.cpp

Daniel Dunbar daniel at zuster.org
Tue Nov 10 11:51:33 PST 2009


Author: ddunbar
Date: Tue Nov 10 13:51:33 2009
New Revision: 86709

URL: http://llvm.org/viewvc/llvm-project?rev=86709&view=rev
Log:
Change LangOpts initialization to directly test the code generation options,
instead of reproducing their logic.

Modified:
    cfe/trunk/tools/clang-cc/clang-cc.cpp

Modified: cfe/trunk/tools/clang-cc/clang-cc.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-cc/clang-cc.cpp?rev=86709&r1=86708&r2=86709&view=diff

==============================================================================
--- cfe/trunk/tools/clang-cc/clang-cc.cpp (original)
+++ cfe/trunk/tools/clang-cc/clang-cc.cpp Tue Nov 10 13:51:33 2009
@@ -674,6 +674,7 @@
 
 static void InitializeLanguageStandard(LangOptions &Options, LangKind LK,
                                        TargetInfo &Target,
+                                       const CompileOptions &CompileOpts,
                                        const llvm::StringMap<bool> &Features) {
   // Allow the target to set the default the language options as it sees fit.
   Target.getDefaultLangOptions(Options);
@@ -837,17 +838,18 @@
   // 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 @@
   if (LK != langkind_ast) {
     InitializeLangOptions(Opts.getLangOpts(), LK);
     InitializeLanguageStandard(Opts.getLangOpts(), LK, Target,
-                               Opts.getTargetFeatures());
+                               Opts.getCompileOpts(), Opts.getTargetFeatures());
   }
 
   // Initialize the header search options.





More information about the cfe-commits mailing list