Skip to content

Commit fbf08a6

Browse files
authored
[ObjectiveC] -rewrite-objc was treating inputs as preprocessed files (#137623)
`-rewrite-objc` passes `-x objective-c++-cpp-output` as input type to the preprocessor job. This is not correct since we would be preprocessing a preprocessed file. The correct input type is `objective-c++`.
1 parent ca3121b commit fbf08a6

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,7 @@ static void addDashXForInput(const ArgList &Args, const InputInfo &Input,
521521

522522
CmdArgs.push_back("-x");
523523
if (Args.hasArg(options::OPT_rewrite_objc))
524-
CmdArgs.push_back(types::getTypeName(types::TY_PP_ObjCXX));
524+
CmdArgs.push_back(types::getTypeName(types::TY_ObjCXX));
525525
else {
526526
// Map the driver type to the frontend type. This is mostly an identity
527527
// mapping, except that the distinction between module interface units
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// RUN: %clang --target=x86_64-apple-macosx10.7.0 -rewrite-objc %s -o - -### 2>&1 | \
2+
// RUN: FileCheck %s
3+
//
4+
// Check that we're running a preprocessing stage passing a not-preprocessed objective-c++ file as input
5+
// CHECK: "-E"{{.*}}"-x" "objective-c++"

0 commit comments

Comments
 (0)