aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp
diff options
context:
space:
mode:
authorNico Weber <thakis@chromium.org>2021-04-19 13:39:20 -0400
committerNico Weber <thakis@chromium.org>2021-04-27 22:26:10 -0400
commit0f1137ba79c0b3f1ca638e01082443ba5ccde03c (patch)
tree23708767073c3cc358e9c147411927cae2184235 /clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp
parentc35fadceab382a30f4f2f0023fb688d31af58feb (diff)
downloadllvm-0f1137ba79c0b3f1ca638e01082443ba5ccde03c.zip
llvm-0f1137ba79c0b3f1ca638e01082443ba5ccde03c.tar.gz
llvm-0f1137ba79c0b3f1ca638e01082443ba5ccde03c.tar.bz2
[clang/Basic] Make TargetInfo.h not use DataLayout again
Reverts parts of https://reviews.llvm.org/D17183, but keeps the resetDataLayout() API and adds an assert that checks that datalayout string and user label prefix are in sync. Approach 1 in https://reviews.llvm.org/D17183#2653279 Reduces number of TUs build for 'clang-format' from 689 to 575. I also implemented approach 2 in D100764. If someone feels motivated to make us use DataLayout more, it's easy to revert this change here and go with D100764 instead. I don't plan on doing more work in this area though, so I prefer going with the smaller, more self-consistent change. Differential Revision: https://reviews.llvm.org/D100776
Diffstat (limited to 'clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp')
-rw-r--r--clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp b/clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp
index de5c1a4..1adf0ad 100644
--- a/clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp
+++ b/clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp
@@ -166,7 +166,7 @@ public:
Ctx = &Context;
VMContext.reset(new llvm::LLVMContext());
M.reset(new llvm::Module(MainFileName, *VMContext));
- M->setDataLayout(Ctx->getTargetInfo().getDataLayout());
+ M->setDataLayout(Ctx->getTargetInfo().getDataLayoutString());
Builder.reset(new CodeGen::CodeGenModule(
*Ctx, HeaderSearchOpts, PreprocessorOpts, CodeGenOpts, *M, Diags));
@@ -245,7 +245,7 @@ public:
return;
M->setTargetTriple(Ctx.getTargetInfo().getTriple().getTriple());
- M->setDataLayout(Ctx.getTargetInfo().getDataLayout());
+ M->setDataLayout(Ctx.getTargetInfo().getDataLayoutString());
// PCH files don't have a signature field in the control block,
// but LLVM detects DWO CUs by looking for a non-zero DWO id.
@@ -295,7 +295,7 @@ public:
llvm::SmallString<0> Buffer;
clang::EmitBackendOutput(
Diags, HeaderSearchOpts, CodeGenOpts, TargetOpts, LangOpts,
- Ctx.getTargetInfo().getDataLayout(), M.get(),
+ Ctx.getTargetInfo().getDataLayoutString(), M.get(),
BackendAction::Backend_EmitLL,
std::make_unique<llvm::raw_svector_ostream>(Buffer));
llvm::dbgs() << Buffer;
@@ -303,9 +303,9 @@ public:
// Use the LLVM backend to emit the pch container.
clang::EmitBackendOutput(Diags, HeaderSearchOpts, CodeGenOpts, TargetOpts,
- LangOpts, Ctx.getTargetInfo().getDataLayout(),
- M.get(), BackendAction::Backend_EmitObj,
- std::move(OS));
+ LangOpts,
+ Ctx.getTargetInfo().getDataLayoutString(), M.get(),
+ BackendAction::Backend_EmitObj, std::move(OS));
// Free the memory for the temporary buffer.
llvm::SmallVector<char, 0> Empty;