[cfe-commits] r63816 - in /cfe/trunk/tools/ccc: ccclib/Tools.py test/ccc/O.c

Daniel Dunbar daniel at zuster.org
Wed Feb 4 18:43:39 PST 2009


Author: ddunbar
Date: Wed Feb  4 20:43:38 2009
New Revision: 63816

URL: http://llvm.org/viewvc/llvm-project?rev=63816&view=rev
Log:
ccc: Translate -O to -O1 for clang, and only pass last -O option.

Added:
    cfe/trunk/tools/ccc/test/ccc/O.c
Modified:
    cfe/trunk/tools/ccc/ccclib/Tools.py

Modified: cfe/trunk/tools/ccc/ccclib/Tools.py
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/ccc/ccclib/Tools.py?rev=63816&r1=63815&r2=63816&view=diff

==============================================================================
--- cfe/trunk/tools/ccc/ccclib/Tools.py (original)
+++ cfe/trunk/tools/ccc/ccclib/Tools.py Wed Feb  4 20:43:38 2009
@@ -307,7 +307,14 @@
 
         arglist.addAllArgs(cmd_args, arglist.parser.fblocksGroup)
 
-        arglist.addAllArgs(cmd_args, arglist.parser.OOption)
+        # Manually translate -O to -O1; let clang reject others.
+        arg = arglist.getLastArg(arglist.parser.OOption)
+        if arg:
+            if arglist.getValue(arg) == '':
+                cmd_args.append('-O1')
+            else:
+                cmd_args.extend(arglist.render(arg))
+
         arglist.addAllArgs2(cmd_args, arglist.parser.ClangWGroup, arglist.parser.pedanticGroup)
         arglist.addLastArg(cmd_args, arglist.parser.wOption)
         arglist.addAllArgs3(cmd_args, arglist.parser.stdOption, arglist.parser.ansiOption, arglist.parser.trigraphsOption)

Added: cfe/trunk/tools/ccc/test/ccc/O.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/ccc/test/ccc/O.c?rev=63816&view=auto

==============================================================================
--- cfe/trunk/tools/ccc/test/ccc/O.c (added)
+++ cfe/trunk/tools/ccc/test/ccc/O.c Wed Feb  4 20:43:38 2009
@@ -0,0 +1,4 @@
+// Just check that clang accepts these.
+
+// RUN: xcc -fsyntax-only -O1 -O2 %s &&
+// RUN: xcc -fsyntax-only -O %s





More information about the cfe-commits mailing list