aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2021-07-20 21:05:07 +0200
committerNikita Popov <nikita.ppv@gmail.com>2021-07-20 21:08:06 +0200
commit6312a75dbaaf2d4c968cfa3322fc9df60621d4ee (patch)
tree43b62aba3793827b40fcf9706bf960fdc67c6431 /llvm/lib/Bitcode/Reader/BitcodeReader.cpp
parenta7f183afe7cc792c50d64b3b9ea22269c87ec35f (diff)
downloadllvm-6312a75dbaaf2d4c968cfa3322fc9df60621d4ee.zip
llvm-6312a75dbaaf2d4c968cfa3322fc9df60621d4ee.tar.gz
llvm-6312a75dbaaf2d4c968cfa3322fc9df60621d4ee.tar.bz2
[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.
Diffstat (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.cpp')
-rw-r--r--llvm/lib/Bitcode/Reader/BitcodeReader.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
index 42e17f0..e167792 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);
}