ccc: -ObjC and -ObjC++ change default language, but only for "source
files".


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63727 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/ccc/ccclib/Driver.py b/tools/ccc/ccclib/Driver.py
index 2f4cc14..30e2ae7 100644
--- a/tools/ccc/ccclib/Driver.py
+++ b/tools/ccc/ccclib/Driver.py
@@ -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