aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.cpp')
-rw-r--r--llvm/lib/Bitcode/Reader/BitcodeReader.cpp20
1 files changed, 13 insertions, 7 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
index 4b8b0ec..9bdac5c4 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -1303,6 +1303,9 @@ static uint64_t getRawAttributeMask(Attribute::AttrKind Val) {
case Attribute::SanitizeMemTag:
llvm_unreachable("sanitize_memtag attribute not supported in raw format");
break;
+ case Attribute::Preallocated:
+ llvm_unreachable("preallocated attribute not supported in raw format");
+ break;
}
llvm_unreachable("Unsupported attribute type");
}
@@ -1312,12 +1315,10 @@ static void addRawAttributeValue(AttrBuilder &B, uint64_t Val) {
for (Attribute::AttrKind I = Attribute::None; I != Attribute::EndAttrKinds;
I = Attribute::AttrKind(I + 1)) {
- if (I == Attribute::SanitizeMemTag ||
- I == Attribute::Dereferenceable ||
- I == Attribute::DereferenceableOrNull ||
- I == Attribute::ArgMemOnly ||
- I == Attribute::AllocSize ||
- I == Attribute::NoSync)
+ if (I == Attribute::SanitizeMemTag || I == Attribute::Dereferenceable ||
+ I == Attribute::DereferenceableOrNull || I == Attribute::ArgMemOnly ||
+ I == Attribute::AllocSize || I == Attribute::NoSync ||
+ I == Attribute::Preallocated)
continue;
if (uint64_t A = (Val & getRawAttributeMask(I))) {
if (I == Attribute::Alignment)
@@ -1544,6 +1545,8 @@ static Attribute::AttrKind getAttrFromCode(uint64_t Code) {
return Attribute::ImmArg;
case bitc::ATTR_KIND_SANITIZE_MEMTAG:
return Attribute::SanitizeMemTag;
+ case bitc::ATTR_KIND_PREALLOCATED:
+ return Attribute::Preallocated;
}
}
@@ -1659,8 +1662,11 @@ Error BitcodeReader::parseAttributeGroupBlock() {
Attribute::AttrKind Kind;
if (Error Err = parseAttrKind(Record[++i], &Kind))
return Err;
- if (Kind == Attribute::ByVal)
+ if (Kind == Attribute::ByVal) {
B.addByValAttr(HasType ? getTypeByID(Record[++i]) : nullptr);
+ } else if (Kind == Attribute::Preallocated) {
+ B.addPreallocatedAttr(getTypeByID(Record[++i]));
+ }
}
}