https://github.com/jmmartinez created https://github.com/llvm/llvm-project/pull/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++`. From 956cc2087449f8ade95ad33fa2bb86402454ca29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Manuel=20Martinez=20Caama=C3=B1o?= <juama...@amd.com> Date: Mon, 28 Apr 2025 13:13:27 +0200 Subject: [PATCH 1/2] Pre-commit test: [ObjectiveC] -rewrite-objc was treating inputs as preprocessed files --- clang/test/Driver/rewrite-objc-preproc.m | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 clang/test/Driver/rewrite-objc-preproc.m diff --git a/clang/test/Driver/rewrite-objc-preproc.m b/clang/test/Driver/rewrite-objc-preproc.m new file mode 100644 index 0000000000000..30b69afc66f76 --- /dev/null +++ b/clang/test/Driver/rewrite-objc-preproc.m @@ -0,0 +1,5 @@ +// RUN: %clang --target=x86_64-apple-macosx10.7.0 -rewrite-objc %s -o - -### 2>&1 | \ +// RUN: FileCheck %s +// +// Check that we're running a preprocessing stage passing a preprocessed file as input +// CHECK: "-E"{{.*}}"-x"{{.*}}cpp-output From 8e3e149de3c2d7ef7efb0abc82cf11040730ec46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Manuel=20Martinez=20Caama=C3=B1o?= <juama...@amd.com> Date: Mon, 28 Apr 2025 13:04:16 +0200 Subject: [PATCH 2/2] [ObjectiveC] -rewrite-objc was treating inputs as preprocessed files --- clang/lib/Driver/ToolChains/Clang.cpp | 2 +- clang/test/Driver/rewrite-objc-preproc.m | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index f98cd389509cd..4c3d55a62f66d 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -521,7 +521,7 @@ static void addDashXForInput(const ArgList &Args, const InputInfo &Input, CmdArgs.push_back("-x"); if (Args.hasArg(options::OPT_rewrite_objc)) - CmdArgs.push_back(types::getTypeName(types::TY_PP_ObjCXX)); + CmdArgs.push_back(types::getTypeName(types::TY_ObjCXX)); else { // Map the driver type to the frontend type. This is mostly an identity // mapping, except that the distinction between module interface units diff --git a/clang/test/Driver/rewrite-objc-preproc.m b/clang/test/Driver/rewrite-objc-preproc.m index 30b69afc66f76..f32d09c5a15f3 100644 --- a/clang/test/Driver/rewrite-objc-preproc.m +++ b/clang/test/Driver/rewrite-objc-preproc.m @@ -1,5 +1,5 @@ // RUN: %clang --target=x86_64-apple-macosx10.7.0 -rewrite-objc %s -o - -### 2>&1 | \ // RUN: FileCheck %s // -// Check that we're running a preprocessing stage passing a preprocessed file as input -// CHECK: "-E"{{.*}}"-x"{{.*}}cpp-output +// Check that we're running a preprocessing stage passing a not-preprocessed objective-c++ file as input +// CHECK: "-E"{{.*}}"-x" "objective-c++" _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits