[Bitcode] Remove auto-detection for typed pointers
Always read bitcode according to the -opaque-pointers mode. Do not perform auto-detection to implicitly switch to typed pointers. This is a step towards removing typed pointer support, and also eliminates the class of problems where linking may fail if a typed pointer module is loaded before an opaque pointer module. (The latest place where this was encountered is D139924, but this has previously been fixed in other places doing bitcode linking as well.) Differential Revision: https://reviews.llvm.org/D139940
This commit is contained in:
@@ -2359,8 +2359,6 @@ Error BitcodeReader::parseTypeTableBody() {
|
||||
if (!ResultTy ||
|
||||
!PointerType::isValidElementType(ResultTy))
|
||||
return error("Invalid type");
|
||||
if (LLVM_UNLIKELY(!Context.hasSetOpaquePointersValue()))
|
||||
Context.setOpaquePointers(false);
|
||||
ContainedIDs.push_back(Record[0]);
|
||||
ResultTy = PointerType::get(ResultTy, AddressSpace);
|
||||
break;
|
||||
@@ -2368,9 +2366,7 @@ Error BitcodeReader::parseTypeTableBody() {
|
||||
case bitc::TYPE_CODE_OPAQUE_POINTER: { // OPAQUE_POINTER: [addrspace]
|
||||
if (Record.size() != 1)
|
||||
return error("Invalid opaque pointer record");
|
||||
if (LLVM_UNLIKELY(!Context.hasSetOpaquePointersValue())) {
|
||||
Context.setOpaquePointers(true);
|
||||
} else if (Context.supportsTypedPointers())
|
||||
if (Context.supportsTypedPointers())
|
||||
return error(
|
||||
"Opaque pointers are only supported in -opaque-pointers mode");
|
||||
unsigned AddressSpace = Record[0];
|
||||
|
||||
Reference in New Issue
Block a user