Add support of -x objc-cpp-output, -x objc++-cpp-output to the Driver.

Matches gcc, and is also required for using ccache with clang.

llvm-svn: 137563
This commit is contained in:
Nico Weber 2011-08-13 23:13:37 +00:00
parent 6858b344ed
commit ed8080cb9f
5 changed files with 25 additions and 6 deletions

View File

@ -44,10 +44,12 @@ TYPE("c", C, PP_C, 0, "u")
TYPE("cl", CL, PP_C, 0, "u")
TYPE("cuda", CUDA, PP_CXX, 0, "u")
TYPE("objective-c-cpp-output", PP_ObjC, INVALID, "mi", "u")
TYPE("objc-cpp-output", PP_ObjC_Alias, INVALID, "mi", "u")
TYPE("objective-c", ObjC, PP_ObjC, 0, "u")
TYPE("c++-cpp-output", PP_CXX, INVALID, "ii", "u")
TYPE("c++", CXX, PP_CXX, 0, "u")
TYPE("objective-c++-cpp-output", PP_ObjCXX, INVALID, "mii", "u")
TYPE("objc++-cpp-output", PP_ObjCXX_Alias, INVALID, "mii", "u")
TYPE("objective-c++", ObjCXX, PP_ObjCXX, 0, "u")
// C family input files to precompile.

View File

@ -2400,13 +2400,15 @@ const char *darwin::CC1::getCC1Name(types::ID Type) const {
case types::TY_PP_C: case types::TY_PP_CHeader:
return "cc1";
case types::TY_ObjC: case types::TY_ObjCHeader:
case types::TY_PP_ObjC: case types::TY_PP_ObjCHeader:
case types::TY_PP_ObjC: case types::TY_PP_ObjC_Alias:
case types::TY_PP_ObjCHeader:
return "cc1obj";
case types::TY_CXX: case types::TY_CXXHeader:
case types::TY_PP_CXX: case types::TY_PP_CXXHeader:
return "cc1plus";
case types::TY_ObjCXX: case types::TY_ObjCXXHeader:
case types::TY_PP_ObjCXX: case types::TY_PP_ObjCXXHeader:
case types::TY_PP_ObjCXX: case types::TY_PP_ObjCXX_Alias:
case types::TY_PP_ObjCXXHeader:
return "cc1objplus";
}
}

View File

@ -79,9 +79,9 @@ bool types::isAcceptedByClang(ID Id) {
case TY_C: case TY_PP_C:
case TY_CL:
case TY_CUDA:
case TY_ObjC: case TY_PP_ObjC:
case TY_ObjC: case TY_PP_ObjC: case TY_PP_ObjC_Alias:
case TY_CXX: case TY_PP_CXX:
case TY_ObjCXX: case TY_PP_ObjCXX:
case TY_ObjCXX: case TY_PP_ObjCXX: case TY_PP_ObjCXX_Alias:
case TY_CHeader: case TY_PP_CHeader:
case TY_ObjCHeader: case TY_PP_ObjCHeader:
case TY_CXXHeader: case TY_PP_CXXHeader:
@ -110,10 +110,10 @@ bool types::isObjC(ID Id) {
default:
return false;
case TY_ObjC: case TY_PP_ObjC:
case TY_ObjC: case TY_PP_ObjC: case TY_PP_ObjC_Alias:
case TY_ObjCXX: case TY_PP_ObjCXX:
case TY_ObjCHeader: case TY_PP_ObjCHeader:
case TY_ObjCXXHeader: case TY_PP_ObjCXXHeader:
case TY_ObjCXXHeader: case TY_PP_ObjCXXHeader: case TY_PP_ObjCXX_Alias:
return true;
}
}

View File

@ -0,0 +1,8 @@
// RUN: %clang -x objc++-cpp-output -c %s -o /dev/null
// Should compile without errors
@protocol P
- (void)m;
@end
void f() {}
class C {};

View File

@ -0,0 +1,7 @@
// RUN: %clang -x objc-cpp-output -c %s -o /dev/null
// Should compile without errors
@protocol P
- (void)m;
@end
void f() {}