[llvm] 470910c - [OpaquePtr][BitcodeReader] Explicitly turn off opaque pointers if we see a typed pointer

Arthur Eubanks via llvm-commits llvm-commits at lists.llvm.org
Tue May 17 08:44:39 PDT 2022


Author: Arthur Eubanks
Date: 2022-05-17T08:43:02-07:00
New Revision: 470910c4ad8af2555c49aec16409630d2a3246b6

URL: https://github.com/llvm/llvm-project/commit/470910c4ad8af2555c49aec16409630d2a3246b6
DIFF: https://github.com/llvm/llvm-project/commit/470910c4ad8af2555c49aec16409630d2a3246b6.diff

LOG: [OpaquePtr][BitcodeReader] Explicitly turn off opaque pointers if we see a typed pointer

Followup to D125735 on the bitcode reader side.

Reviewed By: #opaque-pointers, nikic

Differential Revision: https://reviews.llvm.org/D125736

Added: 
    

Modified: 
    llvm/lib/Bitcode/Reader/BitcodeReader.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
index 901c1173fe4fb..9d49a96522b29 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -1890,6 +1890,8 @@ 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;


        


More information about the llvm-commits mailing list