]> granicus.if.org Git - clang/commitdiff
Use -### instead of -ccc-print-options.
authorRafael Espindola <rafael.espindola@gmail.com>
Tue, 3 Sep 2013 13:26:49 +0000 (13:26 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Tue, 3 Sep 2013 13:26:49 +0000 (13:26 +0000)
Convert the last few tests using -ccc-print-options to -### and remove
-ccc-print-options.

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

include/clang/Driver/Driver.h
include/clang/Driver/Options.td
lib/Driver/Driver.cpp
test/Driver/option-aliases.c
test/Driver/parsing.c [deleted file]
test/Driver/qa_override.c
test/Driver/working-directory.c

index 5edf26b639238cbc6e6da1e6c3f7d806a3b04fca..69e815a7c80d1141eeceb33c7cf33ff44f7a4ba2 100644 (file)
@@ -318,9 +318,6 @@ public:
   /// \param ShowHidden - Show hidden options.
   void PrintHelp(bool ShowHidden) const;
 
-  /// PrintOptions - Print the list of arguments.
-  void PrintOptions(const llvm::opt::ArgList &Args) const;
-
   /// PrintVersion - Print the driver version.
   void PrintVersion(const Compilation &C, raw_ostream &OS) const;
 
index 0a62486fbb96db9fbee1305b1c2248e092aa6418..4a36acfcd553cc3b63e645fef793adeebef9772a 100644 (file)
@@ -137,8 +137,6 @@ class InternalDebugOpt : Group<internal_debug_Group>,
   Flags<[DriverOption, HelpHidden]>;
 def ccc_install_dir : Separate<["-"], "ccc-install-dir">, InternalDebugOpt,
   HelpText<"Simulate installation in the given directory">;
-def ccc_print_options : Flag<["-"], "ccc-print-options">, InternalDebugOpt,
-  HelpText<"Dump parsed command line arguments">;
 def ccc_print_phases : Flag<["-"], "ccc-print-phases">, InternalDebugOpt,
   HelpText<"Dump list of actions to perform">;
 def ccc_print_bindings : Flag<["-"], "ccc-print-bindings">, InternalDebugOpt,
index de589628b774e570f7c173b232840a15ea5234ce..87e1e2333fc966c9112a56b2b7663fad796701b9 100644 (file)
@@ -58,7 +58,7 @@ Driver::Driver(StringRef ClangExecutable,
     CCPrintOptionsFilename(0), CCPrintHeadersFilename(0),
     CCLogDiagnosticsFilename(0),
     CCCPrintBindings(false),
-    CCPrintOptions(false), CCPrintHeaders(false), CCLogDiagnostics(false),
+    CCPrintHeaders(false), CCLogDiagnostics(false),
     CCGenDiagnostics(false), CCCGenericGCCName(""), CheckInputsExist(true),
     CCCUsePCH(true), SuppressMissingInputWarning(false) {
 
@@ -327,7 +327,7 @@ Compilation *Driver::BuildCompilation(ArrayRef<const char *> ArgList) {
   // FIXME: What are we going to do with -V and -b?
 
   // FIXME: This stuff needs to go into the Compilation, not the driver.
-  bool CCCPrintOptions, CCCPrintActions;
+  bool CCCPrintActions;
 
   InputArgList *Args = ParseArgStrings(ArgList.slice(1));
 
@@ -343,7 +343,6 @@ Compilation *Driver::BuildCompilation(ArrayRef<const char *> ArgList) {
   // should be outside in the client; the parts that aren't should have proper
   // options, either by introducing new ones or by overloading gcc ones like -V
   // or -b.
-  CCCPrintOptions = Args->hasArg(options::OPT_ccc_print_options);
   CCCPrintActions = Args->hasArg(options::OPT_ccc_print_phases);
   CCCPrintBindings = Args->hasArg(options::OPT_ccc_print_bindings);
   if (const Arg *A = Args->getLastArg(options::OPT_ccc_gcc_name))
@@ -387,12 +386,6 @@ Compilation *Driver::BuildCompilation(ArrayRef<const char *> ArgList) {
   // The compilation takes ownership of Args.
   Compilation *C = new Compilation(*this, TC, Args, TranslatedArgs);
 
-  // FIXME: This behavior shouldn't be here.
-  if (CCCPrintOptions) {
-    PrintOptions(C->getInputArgs());
-    return C;
-  }
-
   if (!HandleImmediateArgs(*C))
     return C;
 
@@ -641,23 +634,6 @@ int Driver::ExecuteCompilation(const Compilation &C,
   return 0;
 }
 
-void Driver::PrintOptions(const ArgList &Args) const {
-  unsigned i = 0;
-  for (ArgList::const_iterator it = Args.begin(), ie = Args.end();
-       it != ie; ++it, ++i) {
-    Arg *A = *it;
-    llvm::errs() << "Option " << i << " - "
-                 << "Name: \"" << A->getOption().getPrefixedName() << "\", "
-                 << "Values: {";
-    for (unsigned j = 0; j < A->getNumValues(); ++j) {
-      if (j)
-        llvm::errs() << ", ";
-      llvm::errs() << '"' << A->getValue(j) << '"';
-    }
-    llvm::errs() << "}\n";
-  }
-}
-
 void Driver::PrintHelp(bool ShowHidden) const {
   unsigned IncludedFlagsBitmask;
   unsigned ExcludedFlagsBitmask;
index 38bf4b1a577769c07529143e3f2e2da69cb1b746..9cd9252a483221dca94ff50e7d90b05d935adc0f 100644 (file)
@@ -1,11 +1,14 @@
-// RUN: %clang -ccc-print-options \
-// RUN:  --save-temps --undefine-macro=FOO --undefine-macro FOO \
-// RUN: --param=FOO --output=FOO 2> %t
-// RUN: FileCheck --check-prefix=CHECK-OPTIONS < %t %s
+// RUN: %clang -### -S \
+// RUN:  --save-temps --undefine-macro=FOO --undefine-macro BAR \
+// RUN: --param=FOO --output=FOO %s 2>&1 | \
+// RUN: FileCheck %s
 
-// CHECK-OPTIONS: Option 0 - Name: "-ccc-print-options", Values: {}
-// CHECK-OPTIONS: Option 1 - Name: "-save-temps", Values: {}
-// CHECK-OPTIONS: Option 2 - Name: "-U", Values: {"FOO"}
-// CHECK-OPTIONS: Option 3 - Name: "-U", Values: {"FOO"}
-// CHECK-OPTIONS: Option 4 - Name: "--param", Values: {"FOO"}
-// CHECK-OPTIONS: Option 5 - Name: "-o", Values: {"FOO"}
+// CHECK: "-cc1"
+// CHECK: "-E"
+// CHECK: "-U" "FOO"
+// CHECK: "-U" "BAR"
+// CHECK: "-o" "option-aliases.i"
+
+// CHECK-NEXT: "-cc1"
+// CHECK: "-S"
+// CHECK: "-o" "FOO"
diff --git a/test/Driver/parsing.c b/test/Driver/parsing.c
deleted file mode 100644 (file)
index eceba37..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-// RUN: %clang -ccc-print-options input -Yunknown -m32 -arch ppc -djoined -A separate -Ajoined -Wp,one,two -Xarch_joined AndSeparate -sectalign 1 2 3 2> %t
-// RUN: grep 'Option 0 - Name: "-ccc-print-options", Values: {}' %t
-// RUN: grep 'Option 1 - Name: "<input>", Values: {"input"}' %t
-// RUN: grep 'Option 2 - Name: "<unknown>", Values: {"-Yunknown"}' %t
-// RUN: grep 'Option 3 - Name: "-m32", Values: {}' %t
-// RUN: grep 'Option 4 - Name: "-arch", Values: {"ppc"}' %t
-// RUN: grep 'Option 5 - Name: "-d", Values: {"joined"}' %t
-// RUN: grep 'Option 6 - Name: "-A", Values: {"separate"}' %t
-// RUN: grep 'Option 7 - Name: "-A", Values: {"joined"}' %t
-// RUN: grep 'Option 8 - Name: "-Wp,", Values: {"one", "two"}' %t
-// RUN: grep 'Option 9 - Name: "-Xarch_", Values: {"joined", "AndSeparate"}' %t
-// RUN: grep 'Option 10 - Name: "-sectalign", Values: {"1", "2", "3"}' %t
-
-// RUN: not %clang -V 2> %t
-// RUN: grep "error: argument to '-V' is missing (expected 1 value)" %t
-// RUN: not %clang -sectalign 1 2 2> %t
-// RUN: grep "error: argument to '-sectalign' is missing (expected 3 values)" %t
-
-// Verify that search continues after find the first option.
-// RUN: %clang -ccc-print-options -Wally 2> %t
-// RUN: grep 'Option 0 - Name: "-ccc-print-options", Values: {}' %t
-// RUN: grep 'Option 1 - Name: "-W", Values: {"ally"}' %t
index 54fdddce9eb0dceb8a463539b50e69833ee7e250..f556f4b5aca7c19acb16f2135c5939c031877f9a 100644 (file)
@@ -1,14 +1,10 @@
-// RUN: env QA_OVERRIDE_GCC3_OPTIONS="#+-Os +-Oz +-O +-O3 +-Oignore +a +b +c xb Xa Omagic ^-ccc-print-options  " %clang x -O2 b -O3 2>&1 | FileCheck %s
+// RUN: env QA_OVERRIDE_GCC3_OPTIONS="#+-Os +-Oz +-O +-O3 +-Oignore +a +b +c xb Xa Omagic ^-###  " %clang %s -O2 b -O3 2>&1 | FileCheck %s
 // RUN: env QA_OVERRIDE_GCC3_OPTIONS="x-Werror +-mfoo" %clang -Werror %s -c -### 2>&1 | FileCheck %s -check-prefix=RM-WERROR
 
-// FIXME: It seems doesn't work with gcc-driver.
-// REQUIRES: clang-driver
-
-// CHECK-NOT: ###
-// CHECK: Option 0 - Name: "-ccc-print-options", Values: {}
-// CHECK-NEXT: Option 1 - Name: "<input>", Values: {"x"}
-// CHECK-NEXT: Option 2 - Name: "-O", Values: {"ignore"}
-// CHECK-NEXT: Option 3 - Name: "-O", Values: {"magic"}
+// CHECK: "-cc1"
+// CHECK-NOT: "-Oignore"
+// CHECK: "-Omagic"
+// CHECK-NOT: "-Oignore"
 
 // RM-WERROR: ### QA_OVERRIDE_GCC3_OPTIONS: x-Werror +-mfoo
 // RM-WERROR-NEXT: ### Deleting argument -Werror
index 38a87a6402af811dc2843d362a83e595645144f5..15ba8f00bd1265c668097cf2274e64016047dcf1 100644 (file)
@@ -1,4 +1,3 @@
-// RUN: %clang -ccc-print-options -working-directory "C:\Test" input 2>&1 | FileCheck %s
-// CHECK: Option 0 - Name: "-ccc-print-options", Values: {}
-// CHECK: Option 1 - Name: "-working-directory", Values: {"C:\Test"}
-// CHECK: Option 2 - Name: "<input>", Values: {"input"}
+// RUN: %clang -### -working-directory /no/such/dir/ input 2>&1 | FileCheck %s
+
+//CHECK: no such file or directory: '/no/such/dir/input'