]> granicus.if.org Git - clang/commitdiff
Raise the responsibility for passing -disable-llvm-verifier in NDEBUG builds
authorJohn McCall <rjmccall@apple.com>
Sat, 13 Feb 2010 03:50:24 +0000 (03:50 +0000)
committerJohn McCall <rjmccall@apple.com>
Sat, 13 Feb 2010 03:50:24 +0000 (03:50 +0000)
to the driver, and support it in CodeGenOptsToArgs().  Note that this changes
the default behavior of clang -cc1 to always run the verifier.

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

lib/Driver/Tools.cpp
lib/Frontend/CompilerInvocation.cpp

index f3b19f524268c7e29e70167474cc5caeb5b43ec9..aff70bc7ba0df134141a24b65750baf3d3baa7db 100644 (file)
@@ -687,6 +687,11 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
   // The make clang go fast button.
   CmdArgs.push_back("-disable-free");
 
+  // Disable the verification pass in -asserts builds.
+#ifdef NDEBUG
+  CmdArgs.push_back("-disable-llvm-verifier");
+#endif
+
   // Set the main file name, so that debug info works even with
   // -save-temps.
   CmdArgs.push_back("-main-file-name");
index bd45f074b135a5aedf06fd1ab88411fca1ba03f2..a193ac8703070c9324108cee5a15da2d0c88b79e 100644 (file)
@@ -180,6 +180,8 @@ static void CodeGenOptsToArgs(const CodeGenOptions &Opts,
     Res.push_back("-mrelocation-model");
     Res.push_back(Opts.RelocationModel);
   }
+  if (!Opts.VerifyModule)
+    Res.push_back("-disable-llvm-verifier");
 }
 
 static void DependencyOutputOptsToArgs(const DependencyOutputOptions &Opts,
@@ -789,13 +791,7 @@ static void ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args,
   Opts.RelocationModel = getLastArgValue(Args, OPT_mrelocation_model, "pic");
 
   Opts.MainFileName = getLastArgValue(Args, OPT_main_file_name);
-
-  // FIXME: Put elsewhere?
-#ifdef NDEBUG
-  Opts.VerifyModule = 0;
-#else
   Opts.VerifyModule = !Args.hasArg(OPT_disable_llvm_verifier);
-#endif
 }
 
 static void ParseDependencyOutputArgs(DependencyOutputOptions &Opts,