[llvm] 6312a75 - [BitcodeReader] Handle type attributes more explicitly (NFCI)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 20 12:08:26 PDT 2021


Author: Nikita Popov
Date: 2021-07-20T21:08:06+02:00
New Revision: 6312a75dbaaf2d4c968cfa3322fc9df60621d4ee

URL: https://github.com/llvm/llvm-project/commit/6312a75dbaaf2d4c968cfa3322fc9df60621d4ee
DIFF: https://github.com/llvm/llvm-project/commit/6312a75dbaaf2d4c968cfa3322fc9df60621d4ee.diff

LOG: [BitcodeReader] Handle type attributes more explicitly (NFCI)

For attributes in legacy bitcode that are now typed, explicitly
create a type attribute with nullptr type, the same as we do
for the attribute group representation. This is so we can assert
use of the correct constructor in the future.

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 42e17f018a16c..e16779270e156 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -1280,6 +1280,8 @@ static void addRawAttributeValue(AttrBuilder &B, uint64_t Val) {
         B.addAlignmentAttr(1ULL << ((A >> 16) - 1));
       else if (I == Attribute::StackAlignment)
         B.addStackAlignmentAttr(1ULL << ((A >> 26)-1));
+      else if (Attribute::isTypeAttrKind(I))
+        B.addTypeAttr(I, nullptr); // Type will be auto-upgraded.
       else
         B.addAttribute(I);
     }


        


More information about the llvm-commits mailing list