Explicitly initialize opaque pointer mode in CodeGenAction
authorMatthias Braun <matze@braunis.de>
Fri, 4 Nov 2022 23:19:18 +0000 (16:19 -0700)
committerMatthias Braun <matze@braunis.de>
Mon, 7 Nov 2022 20:31:28 +0000 (12:31 -0800)
commitcafe50daf525971ffc3b8c5f2f6343d24e381384
tree75a8c19829a14e3f88f44f0afde3ba2acc2fd51b
parent463da45892e2d2a262277b91b96f5f8c05dc25d0
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
clang/lib/CodeGen/CodeGenAction.cpp
clang/test/CodeGen/Inputs/thinlto-opaque.ll [new file with mode: 0644]
clang/test/CodeGen/thinlto-distributed-cfi-devirt.ll
clang/test/CodeGen/thinlto-opaque-typed-mix.ll [new file with mode: 0644]