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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137563 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/clang/Driver/Types.def b/include/clang/Driver/Types.def
index f09a1dc..0c6b3a8 100644
--- a/include/clang/Driver/Types.def
+++ b/include/clang/Driver/Types.def
@@ -44,10 +44,12 @@
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/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp
index 43c3fbd..59e024e 100644
--- a/lib/Driver/Tools.cpp
+++ b/lib/Driver/Tools.cpp
@@ -2400,13 +2400,15 @@
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/lib/Driver/Types.cpp b/lib/Driver/Types.cpp
index a6285ec..2473018 100644
--- a/lib/Driver/Types.cpp
+++ b/lib/Driver/Types.cpp
@@ -79,9 +79,9 @@
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 @@
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/test/Driver/objc++-cpp-output.mm b/test/Driver/objc++-cpp-output.mm
new file mode 100644
index 0000000..bb88144
--- /dev/null
+++ b/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/test/Driver/objc-cpp-output.m b/test/Driver/objc-cpp-output.m
new file mode 100644
index 0000000..6d97483
--- /dev/null
+++ b/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() {}