@@ -771,6 +771,25 @@ TEST(ClangToolTest, BaseVirtualFileSystemUsage) {
771771 EXPECT_EQ (0 , Tool.run (Action.get ()));
772772}
773773
774+ // Check -cc1 command doesn't fail.
775+ TEST (ClangToolTest, CC1Arg) {
776+ FixedCompilationDatabase Compilations (" /" , {" -cc1" });
777+ llvm::IntrusiveRefCntPtr<llvm::vfs::OverlayFileSystem> OverlayFileSystem (
778+ new llvm::vfs::OverlayFileSystem (llvm::vfs::getRealFileSystem ()));
779+ llvm::IntrusiveRefCntPtr<llvm::vfs::InMemoryFileSystem> InMemoryFileSystem (
780+ new llvm::vfs::InMemoryFileSystem);
781+ OverlayFileSystem->pushOverlay (InMemoryFileSystem);
782+
783+ InMemoryFileSystem->addFile (
784+ " a.cpp" , 0 , llvm::MemoryBuffer::getMemBuffer (" int main() {}" ));
785+
786+ ClangTool Tool (Compilations, std::vector<std::string>(1 , " a.cpp" ),
787+ std::make_shared<PCHContainerOperations>(), OverlayFileSystem);
788+ std::unique_ptr<FrontendActionFactory> Action (
789+ newFrontendActionFactory<SyntaxOnlyAction>());
790+ EXPECT_EQ (0 , Tool.run (Action.get ()));
791+ }
792+
774793// Check getClangStripDependencyFileAdjuster doesn't strip args after -MD/-MMD.
775794TEST (ClangToolTest, StripDependencyFileAdjuster) {
776795 FixedCompilationDatabase Compilations (" /" , {" -MD" , " -c" , " -MMD" , " -w" });
0 commit comments