[cfe-commits] r63727 - in /cfe/trunk/tools/ccc: ccclib/Driver.py test/ccc/ObjC.c

Daniel Dunbar daniel at zuster.org
Wed Feb 4 00:01:04 PST 2009


Author: ddunbar
Date: Wed Feb  4 02:01:01 2009
New Revision: 63727

URL: http://llvm.org/viewvc/llvm-project?rev=63727&view=rev
Log:
ccc: -ObjC and -ObjC++ change default language, but only for "source
files".

Added:
    cfe/trunk/tools/ccc/test/ccc/ObjC.c
Modified:
    cfe/trunk/tools/ccc/ccclib/Driver.py

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

==============================================================================
--- cfe/trunk/tools/ccc/ccclib/Driver.py (original)
+++ cfe/trunk/tools/ccc/ccclib/Driver.py Wed Feb  4 02:01:01 2009
@@ -376,6 +376,19 @@
                     base,ext = os.path.splitext(inputValue)
                     if ext and ext in Types.kTypeSuffixMap:
                         klass = Types.kTypeSuffixMap[ext]
+
+                        # -ObjC and -ObjC++ over-ride the default
+                        # language, but only for "source files". We
+                        # just treat everything that isn't a linker
+                        # input as a source file.
+                        #
+                        # FIXME: Clean this up if we move the phase
+                        # sequence into the type.
+                        if klass is not Types.ObjectType:
+                            if args.getLastArg(self.parser.ObjCOption):
+                                klass = Types.ObjCType
+                            elif args.getLastArg(self.parser.ObjCXXOption):
+                                klass = Types.ObjCType
                     else:
                         # FIXME: Its not clear why we shouldn't just
                         # revert to unknown. I think this is more likely a

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

==============================================================================
--- cfe/trunk/tools/ccc/test/ccc/ObjC.c (added)
+++ cfe/trunk/tools/ccc/test/ccc/ObjC.c Wed Feb  4 02:01:01 2009
@@ -0,0 +1,7 @@
+// RUN: xcc -fsyntax-only %s -ObjC &&
+// RUN: ! xcc -fsyntax-only -x c %s -ObjC &&
+// RUN: xcc -fsyntax-only %s -ObjC++ &&
+// RUN: ! xcc -fsyntax-only -x c %s -ObjC++
+
+ at interface A
+ at end





More information about the cfe-commits mailing list