]> granicus.if.org Git - clang/commitdiff
simplify this code by reading the decision from LangOptions instead
authorChris Lattner <sabre@nondot.org>
Mon, 16 Mar 2009 18:41:18 +0000 (18:41 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 16 Mar 2009 18:41:18 +0000 (18:41 +0000)
of recomputing the property from command line options.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67047 91177308-0d34-0410-b5e6-96231b3b80d8

Driver/clang.cpp

index e94f0ed07cbe8689210371a27f009295b322216e..48ae2216d43b4498aecc0a1c35235663c3825c18 100644 (file)
@@ -1191,7 +1191,8 @@ static llvm::cl::opt<std::string>
 TargetCPU("mcpu",
          llvm::cl::desc("Target a specific cpu type (-mcpu=help for details)"));
 
-static void InitializeCompileOptions(CompileOptions &Opts) {
+static void InitializeCompileOptions(CompileOptions &Opts,
+                                     const LangOptions &LangOpts) {
   Opts.OptimizeSize = OptSize;
   Opts.DebugInfo = GenerateDebugInfo;
   if (OptSize) {
@@ -1205,7 +1206,7 @@ static void InitializeCompileOptions(CompileOptions &Opts) {
   // FIXME: There are llvm-gcc options to control these selectively.
   Opts.InlineFunctions = (Opts.OptimizationLevel > 1);
   Opts.UnrollLoops = (Opts.OptimizationLevel > 1 && !OptSize);
-  Opts.SimplifyLibCalls = !NoBuiltin && !Freestanding;
+  Opts.SimplifyLibCalls = !LangOpts.NoBuiltin;
 
 #ifdef NDEBUG
   Opts.VerifyModule = 0;
@@ -1272,7 +1273,7 @@ static ASTConsumer *CreateASTConsumer(const std::string& InFile,
       Act = Backend_EmitBC;
     
     CompileOptions Opts;
-    InitializeCompileOptions(Opts);
+    InitializeCompileOptions(Opts, LangOpts);
     return CreateBackendConsumer(Act, Diag, LangOpts, Opts, 
                                  InFile, OutputFile);
   }