diff options
author | Matthias Braun <matze@braunis.de> | 2022-11-04 16:19:18 -0700 |
---|---|---|
committer | Matthias Braun <matze@braunis.de> | 2022-11-07 12:31:28 -0800 |
commit | cafe50daf525971ffc3b8c5f2f6343d24e381384 (patch) | |
tree | 75a8c19829a14e3f88f44f0afde3ba2acc2fd51b /clang/lib/CodeGen/CodeGenAction.cpp | |
parent | 463da45892e2d2a262277b91b96f5f8c05dc25d0 (diff) | |
download | llvm-cafe50daf525971ffc3b8c5f2f6343d24e381384.zip llvm-cafe50daf525971ffc3b8c5f2f6343d24e381384.tar.gz llvm-cafe50daf525971ffc3b8c5f2f6343d24e381384.tar.bz2 |
Explicitly initialize opaque pointer mode in CodeGenAction
Explicitly call `LLVMContext::setOpaquePointers` in `CodeGenAction`
before loading any IR files. With this we use the mode specified on the
command-line rather than lazily initializing it based on the contents of
the IR.
This helps when using `-fthinlto-index` which may end up mixing files
with typed and opaque pointer types which fails when the first file
happened to use typed pointers since we cannot downgrade IR with opaque
pointer types to typed pointer types.
Differential Revision: https://reviews.llvm.org/D137475
Diffstat (limited to 'clang/lib/CodeGen/CodeGenAction.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenAction.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CodeGenAction.cpp b/clang/lib/CodeGen/CodeGenAction.cpp index 52d0417..b723a52f 100644 --- a/clang/lib/CodeGen/CodeGenAction.cpp +++ b/clang/lib/CodeGen/CodeGenAction.cpp @@ -1102,6 +1102,8 @@ CodeGenAction::loadModule(MemoryBufferRef MBRef) { CompilerInstance &CI = getCompilerInstance(); SourceManager &SM = CI.getSourceManager(); + VMContext->setOpaquePointers(CI.getCodeGenOpts().OpaquePointers); + // For ThinLTO backend invocations, ensure that the context // merges types based on ODR identifiers. We also need to read // the correct module out of a multi-module bitcode file. |