]> granicus.if.org Git - clang/commitdiff
Address review comments on r290392:
authorChandler Carruth <chandlerc@gmail.com>
Thu, 12 Jan 2017 22:40:13 +0000 (22:40 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Thu, 12 Jan 2017 22:40:13 +0000 (22:40 +0000)
- 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.

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

lib/Driver/Tools.cpp
test/Driver/cl-options.c
test/Driver/disable-llvm.c [new file with mode: 0644]

index e267cdb2649f2e91af66da07b43b2fe2a234554e..b4a83347defae968aeaa6f945242a5302a531da8 100644 (file)
@@ -6431,11 +6431,13 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
     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
index 25c9cd089e88f520654a9ec9d5d315e01e423a37..69238227c542f5eb436b215bc94f0ac1a9f68a76 100644 (file)
 // 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 \
diff --git a/test/Driver/disable-llvm.c b/test/Driver/disable-llvm.c
new file mode 100644 (file)
index 0000000..24befbd
--- /dev/null
@@ -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