From 8bc3959537adae26b470c8223845555ea26693cc Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Sun, 15 Jan 2023 12:10:05 -0800 Subject: [PATCH] Use raw module format to fix -gmodules crash To avoid `llvm::report_fatal_error("unknown module format")` in getPCHContainerWriter. See https://github.com/llvm/llvm-project/commit/a3e2ff19e59c587ea14611eb64400c6d0ecabcee --- src/clang_tu.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/clang_tu.cc b/src/clang_tu.cc index 9e026652..2762aa8c 100644 --- a/src/clang_tu.cc +++ b/src/clang_tu.cc @@ -175,6 +175,8 @@ buildCompilerInvocation(const std::string &main, std::vector args, ci->getPreprocessorOpts().ImplicitPCHInclude.clear(); ci->getPreprocessorOpts().PrecompiledPreambleBytes = {0, false}; ci->getPreprocessorOpts().PCHThroughHeader.clear(); + + ci->getHeaderSearchOpts().ModuleFormat = "raw"; return ci; }