aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenAction.cpp
diff options
context:
space:
mode:
authorBen Langmuir <blangmuir@apple.com>2025-01-22 16:24:56 -0800
committerGitHub <noreply@github.com>2025-01-22 16:24:56 -0800
commit9fbf5cfebcd770fbe0e453f36ee7c74809339f18 (patch)
treed5c356aa31366787f181148413606d015780bafb /clang/lib/CodeGen/CodeGenAction.cpp
parent96dbd0006c3c4c9de5f1fe4f3bbac3c74acac436 (diff)
downloadllvm-9fbf5cfebcd770fbe0e453f36ee7c74809339f18.zip
llvm-9fbf5cfebcd770fbe0e453f36ee7c74809339f18.tar.gz
llvm-9fbf5cfebcd770fbe0e453f36ee7c74809339f18.tar.bz2
[clang][modules] Partially revert 48d0eb518 to fix -gmodules output (#124003)
With the changes in 48d0eb518, the CodeGenOptions used to emit .pcm files with -fmodule-format=obj (-gmodules) were the ones from the original invocation, rather than the ones specifically crafted for outputting the pcm. This was causing the pcm to be written with only the debug info and without the __clangast section in some cases (e.g. -O2). This unforunately was not covered by existing tests, because compiling and loading a module within a single compilation load the ast content from the in-memory module cache rather than reading it from the pcm file that was written. This broke bootstrapping a build of clang with modules enabled on Darwin. rdar://143418834
Diffstat (limited to 'clang/lib/CodeGen/CodeGenAction.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenAction.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/CodeGenAction.cpp b/clang/lib/CodeGen/CodeGenAction.cpp
index 15311fb..7aa3639 100644
--- a/clang/lib/CodeGen/CodeGenAction.cpp
+++ b/clang/lib/CodeGen/CodeGenAction.cpp
@@ -312,7 +312,8 @@ void BackendConsumer::HandleTranslationUnit(ASTContext &C) {
EmbedBitcode(getModule(), CodeGenOpts, llvm::MemoryBufferRef());
- emitBackendOutput(CI, C.getTargetInfo().getDataLayoutString(), getModule(),
+ emitBackendOutput(CI, CI.getCodeGenOpts(),
+ C.getTargetInfo().getDataLayoutString(), getModule(),
Action, FS, std::move(AsmOutStream), this);
Ctx.setDiagnosticHandler(std::move(OldDiagnosticHandler));
@@ -1173,8 +1174,9 @@ void CodeGenAction::ExecuteAction() {
std::unique_ptr<llvm::ToolOutputFile> OptRecordFile =
std::move(*OptRecordFileOrErr);
- emitBackendOutput(CI, CI.getTarget().getDataLayoutString(), TheModule.get(),
- BA, CI.getFileManager().getVirtualFileSystemPtr(),
+ emitBackendOutput(CI, CI.getCodeGenOpts(),
+ CI.getTarget().getDataLayoutString(), TheModule.get(), BA,
+ CI.getFileManager().getVirtualFileSystemPtr(),
std::move(OS));
if (OptRecordFile)
OptRecordFile->keep();