diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index 9a4253113488d..e4ac2ddc93073 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -5897,7 +5897,7 @@ def resource_dir : Separate<["-"], "resource-dir">, HelpText<"The directory which holds the compiler resource files">, MarshallingInfoString>; def resource_dir_EQ : Joined<["-"], "resource-dir=">, Flags<[NoXarchOption]>, - Visibility<[ClangOption, CLOption, DXCOption, FlangOption]>, + Visibility<[ClangOption, CC1Option, CLOption, DXCOption, FlangOption]>, Alias; def rpath : Separate<["-"], "rpath">, Flags<[LinkerInput]>, Group, Visibility<[ClangOption, FlangOption]>; diff --git a/clang/unittests/Tooling/ToolingTest.cpp b/clang/unittests/Tooling/ToolingTest.cpp index 8cdfffb54390e..9969656b00956 100644 --- a/clang/unittests/Tooling/ToolingTest.cpp +++ b/clang/unittests/Tooling/ToolingTest.cpp @@ -771,6 +771,25 @@ TEST(ClangToolTest, BaseVirtualFileSystemUsage) { EXPECT_EQ(0, Tool.run(Action.get())); } +// Check -cc1 command doesn't fail. +TEST(ClangToolTest, CC1Arg) { + FixedCompilationDatabase Compilations("/", {"-cc1"}); + llvm::IntrusiveRefCntPtr OverlayFileSystem( + new llvm::vfs::OverlayFileSystem(llvm::vfs::getRealFileSystem())); + llvm::IntrusiveRefCntPtr InMemoryFileSystem( + new llvm::vfs::InMemoryFileSystem); + OverlayFileSystem->pushOverlay(InMemoryFileSystem); + + InMemoryFileSystem->addFile( + "a.cpp", 0, llvm::MemoryBuffer::getMemBuffer("int main() {}")); + + ClangTool Tool(Compilations, std::vector(1, "a.cpp"), + std::make_shared(), OverlayFileSystem); + std::unique_ptr Action( + newFrontendActionFactory()); + EXPECT_EQ(0, Tool.run(Action.get())); +} + // Check getClangStripDependencyFileAdjuster doesn't strip args after -MD/-MMD. TEST(ClangToolTest, StripDependencyFileAdjuster) { FixedCompilationDatabase Compilations("/", {"-MD", "-c", "-MMD", "-w"});