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

files".

llvm-svn: 63727
This commit is contained in:
Daniel Dunbar 2009-02-04 08:01:01 +00:00
parent 6e3b7df125
commit 3ba943ed7a
2 changed files with 20 additions and 0 deletions

View File

@ -376,6 +376,19 @@ class Driver(object):
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

View File

@ -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++
@interface A
@end