diff --git a/clang/include/clang/Driver/Types.def b/clang/include/clang/Driver/Types.def index f09a1dcaf26f..0c6b3a8910ff 100644 --- a/clang/include/clang/Driver/Types.def +++ b/clang/include/clang/Driver/Types.def @@ -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. diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp index 43c3fbd810bf..59e024e7a354 100644 --- a/clang/lib/Driver/Tools.cpp +++ b/clang/lib/Driver/Tools.cpp @@ -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"; } } diff --git a/clang/lib/Driver/Types.cpp b/clang/lib/Driver/Types.cpp index a6285ecd393c..24730182bc98 100644 --- a/clang/lib/Driver/Types.cpp +++ b/clang/lib/Driver/Types.cpp @@ -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; } } diff --git a/clang/test/Driver/objc++-cpp-output.mm b/clang/test/Driver/objc++-cpp-output.mm new file mode 100644 index 000000000000..bb8814428ac4 --- /dev/null +++ b/clang/test/Driver/objc++-cpp-output.mm @@ -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 {}; diff --git a/clang/test/Driver/objc-cpp-output.m b/clang/test/Driver/objc-cpp-output.m new file mode 100644 index 000000000000..6d974838c150 --- /dev/null +++ b/clang/test/Driver/objc-cpp-output.m @@ -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() {}