[cfe-commits] r68570 - in /cfe/trunk: lib/Driver/Tools.cpp test/Driver/clang_f_opts.c

Daniel Dunbar daniel at zuster.org
Tue Apr 7 16:51:44 PDT 2009


Author: ddunbar
Date: Tue Apr  7 18:51:44 2009
New Revision: 68570

URL: http://llvm.org/viewvc/llvm-project?rev=68570&view=rev
Log:
Driver: Fix forwarding of -fpascal-strings.

Added:
    cfe/trunk/test/Driver/clang_f_opts.c
Modified:
    cfe/trunk/lib/Driver/Tools.cpp

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=68570&r1=68569&r2=68570&view=diff

==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Tue Apr  7 18:51:44 2009
@@ -410,27 +410,24 @@
       CmdArgs.push_back("-fblocks=0");
   }
 
-  // -fno-pascal-strings is default, only pass non-default.
+  // -fno-pascal-strings is default, only pass non-default. If the
+  // -tool chain happened to translate to -mpascal-strings, we want to
+  // -back translate here.
+  //
+  // FIXME: This is gross; that translation should be pulled from the
+  // tool chain.
   if (Args.hasFlag(options::OPT_fpascal_strings, 
-                      options::OPT_fno_pascal_strings))
+                   options::OPT_fno_pascal_strings,
+                   false) ||
+      Args.hasFlag(options::OPT_mpascal_strings,
+                   options::OPT_mno_pascal_strings,
+                   false))
     CmdArgs.push_back("-fpascal-strings");
 
   // -fcommon is default, only pass non-default.
   if (!Args.hasFlag(options::OPT_fcommon, options::OPT_fno_common))
     CmdArgs.push_back("-fno-common");
 
-  // If tool chain translates fpascal-strings, we want to back
-  // translate here.
-  // FIXME: This is gross; that translation should be pulled from the
-  // tool chain.
-  if (Arg *A = Args.getLastArg(options::OPT_mpascal_strings,
-                               options::OPT_mno_pascal_strings)) {
-    if (A->getOption().matches(options::OPT_mpascal_strings))
-      CmdArgs.push_back("-fpascal-strings");
-    else
-      CmdArgs.push_back("-fno-pascal-strings");
-  }
-
   Args.AddLastArg(CmdArgs, options::OPT_dM);
 
   // Add -Wp, and -Xassembler if using the preprocessor.

Added: cfe/trunk/test/Driver/clang_f_opts.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/clang_f_opts.c?rev=68570&view=auto

==============================================================================
--- cfe/trunk/test/Driver/clang_f_opts.c (added)
+++ cfe/trunk/test/Driver/clang_f_opts.c Tue Apr  7 18:51:44 2009
@@ -0,0 +1,10 @@
+// RUN: clang -### -S -x c /dev/null -fblocks -fbuiltin -fmath-errno -fcommon -fpascal-strings -fno-blocks -fno-builtin -fno-math-errno -fno-common -fno-pascal-strings -fblocks -fbuiltin -fmath-errno -fcommon -fpascal-strings %s 2> %t &&
+// RUN: grep -F '"-fblocks"' %t &&
+// RUN: grep -F '"--fmath-errno=1"' %t &&
+// RUN: grep -F '"-fpascal-strings"' %t &&
+// RUN: clang -### -S -x c /dev/null -fblocks -fbuiltin -fmath-errno -fcommon -fpascal-strings -fno-blocks -fno-builtin -fno-math-errno -fno-common -fno-pascal-strings %s 2> %t &&
+// RUN: grep -F '"-fblocks=0"' %t &&
+// RUN: grep -F '"-fbuiltin=0"' %t &&
+// RUN: grep -F '"-fno-common"' %t &&
+// RUN: grep -F '"--fmath-errno=0"' %t &&
+// RUN: true





More information about the cfe-commits mailing list