r291850 - Address review comments on r290392:

Chandler Carruth via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 12 14:40:14 PST 2017


Author: chandlerc
Date: Thu Jan 12 16:40:13 2017
New Revision: 291850

URL: http://llvm.org/viewvc/llvm-project?rev=291850&view=rev
Log:
Address review comments on r290392:
- Don't break using '-mllvm -disable-llvm-optzns' (yet).
- Don't add support for '-mllvm -disable-llvm-passes'.

This is important for LLVM 4 as we haven't yet really told folks this is
coming. I'll add release notes about this.

I've also added some explicit testing of this so its more obvious what
is happening here.

Added:
    cfe/trunk/test/Driver/disable-llvm.c
Modified:
    cfe/trunk/lib/Driver/Tools.cpp
    cfe/trunk/test/Driver/cl-options.c

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=291850&r1=291849&r2=291850&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Thu Jan 12 16:40:13 2017
@@ -6431,11 +6431,13 @@ void Clang::ConstructJob(Compilation &C,
     A->claim();
 
     // We translate this by hand to the -cc1 argument, since nightly test uses
-    // it and developers have been trained to spell it with -mllvm.
-    if (StringRef(A->getValue(0)) == "-disable-llvm-passes") {
-      CmdArgs.push_back("-disable-llvm-passes");
-    } else
+    // it and developers have been trained to spell it with -mllvm. Both
+    // spellings are now deprecated and should be removed.
+    if (StringRef(A->getValue(0)) == "-disable-llvm-optzns") {
+      CmdArgs.push_back("-disable-llvm-optzns");
+    } else {
       A->render(Args, CmdArgs);
+    }
   }
 
   // With -save-temps, we want to save the unoptimized bitcode output from the

Modified: cfe/trunk/test/Driver/cl-options.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/cl-options.c?rev=291850&r1=291849&r2=291850&view=diff
==============================================================================
--- cfe/trunk/test/Driver/cl-options.c (original)
+++ cfe/trunk/test/Driver/cl-options.c Thu Jan 12 16:40:13 2017
@@ -535,7 +535,7 @@
 // RUN:     -fno-ms-compatibility \
 // RUN:     -fms-extensions \
 // RUN:     -fno-ms-extensions \
-// RUN:     -mllvm -disable-llvm-passes \
+// RUN:     -Xclang -disable-llvm-passes \
 // RUN:     -resource-dir asdf \
 // RUN:     -resource-dir=asdf \
 // RUN:     -Wunused-variable \

Added: cfe/trunk/test/Driver/disable-llvm.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/disable-llvm.c?rev=291850&view=auto
==============================================================================
--- cfe/trunk/test/Driver/disable-llvm.c (added)
+++ cfe/trunk/test/Driver/disable-llvm.c Thu Jan 12 16:40:13 2017
@@ -0,0 +1,22 @@
+// We support a CC1 option for disabling LLVM's passes.
+// RUN: %clang -O2 -Xclang -disable-llvm-passes -### %s 2>&1 \
+// RUN:     | FileCheck --check-prefix=DISABLED %s
+// DISABLED: -cc1
+// DISABLED-NOT: -mllvm
+// DISABLED: -disable-llvm-passes
+//
+// We also support two alternative spellings for historical reasons.
+// RUN: %clang -O2 -Xclang -disable-llvm-optzns -### %s 2>&1 \
+// RUN:     | FileCheck --check-prefix=DISABLED-LEGACY %s
+// RUN: %clang -O2 -mllvm -disable-llvm-optzns -### %s 2>&1 \
+// RUN:     | FileCheck --check-prefix=DISABLED-LEGACY %s
+// DISABLED-LEGACY: -cc1
+// DISABLED-LEGACY-NOT: -mllvm
+// DISABLED-LEGACY: -disable-llvm-optzns
+//
+// The main flag shouldn't be specially handled when used with '-mllvm'.
+// RUN: %clang -O2 -mllvm -disable-llvm-passes -### %s 2>&1 | FileCheck --check-prefix=MLLVM %s
+// MLLVM: -cc1
+// MLLVM-NOT: -disable-llvm-passes
+// MLLVM: "-mllvm" "-disable-llvm-passes"
+// MLLVM-NOT: -disable-llvm-passes




More information about the cfe-commits mailing list