[LLVMContext] Replace enableOpaquePointers() with setOpaquePointers()

This allows both explicitly enabling and explicitly disabling
opaque pointers, in anticipation of the default switching at some
point.

This also slightly changes the rules by allowing calls if either
the opaque pointer mode has not yet been set (explicitly or
implicitly) or if the value remains unchanged.
This commit is contained in:
Nikita Popov
2022-04-05 11:36:06 +02:00
parent 302fe7b3c4
commit 46cfbe561b
8 changed files with 18 additions and 15 deletions

View File

@@ -1884,7 +1884,7 @@ Error BitcodeReader::parseTypeTableBody() {
if (Record.size() != 1)
return error("Invalid opaque pointer record");
if (LLVM_UNLIKELY(!Context.hasSetOpaquePointersValue())) {
Context.enableOpaquePointers();
Context.setOpaquePointers(true);
} else if (Context.supportsTypedPointers())
return error(
"Opaque pointers are only supported in -opaque-pointers mode");