diff options
author | Augie Fackler <augie@google.com> | 2022-03-29 11:14:07 -0400 |
---|---|---|
committer | Augie Fackler <augie@google.com> | 2022-05-31 10:01:17 -0400 |
commit | 42861faa8e17058f0b4a027bba13ef59a600e051 (patch) | |
tree | fcb7d24e0edcc6469b161bf6991e466575291fb3 /llvm/lib/Bitcode/Reader/BitcodeReader.cpp | |
parent | b9443cb6fa6ba0be030cb0ed5f556d69c7f7de56 (diff) | |
download | llvm-42861faa8e17058f0b4a027bba13ef59a600e051.zip llvm-42861faa8e17058f0b4a027bba13ef59a600e051.tar.gz llvm-42861faa8e17058f0b4a027bba13ef59a600e051.tar.bz2 |
attributes: introduce allockind attr for describing allocator fn behavior
I chose to encode the allockind information in a string constant because
otherwise we would get a bit of an explosion of keywords to deal with
the possible permutations of allocation function types.
I'm not sure that CodeGen.h is the correct place for this enum, but it
seemed to kind of match the UWTableKind enum so I put it in the same
place. Constructive suggestions on a better location most certainly
encouraged.
Differential Revision: https://reviews.llvm.org/D123088
Diffstat (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.cpp')
-rw-r--r-- | llvm/lib/Bitcode/Reader/BitcodeReader.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp index cc58929..9dd2b128 100644 --- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp @@ -1536,6 +1536,8 @@ static Attribute::AttrKind getAttrFromCode(uint64_t Code) { return Attribute::DereferenceableOrNull; case bitc::ATTR_KIND_ALLOC_ALIGN: return Attribute::AllocAlign; + case bitc::ATTR_KIND_ALLOC_KIND: + return Attribute::AllocKind; case bitc::ATTR_KIND_ALLOC_SIZE: return Attribute::AllocSize; case bitc::ATTR_KIND_ALLOCATED_POINTER: @@ -1736,6 +1738,8 @@ Error BitcodeReader::parseAttributeGroupBlock() { B.addVScaleRangeAttrFromRawRepr(Record[++i]); else if (Kind == Attribute::UWTable) B.addUWTableAttr(UWTableKind(Record[++i])); + else if (Kind == Attribute::AllocKind) + B.addAllocKindAttr(static_cast<AllocFnKind>(Record[++i])); } else if (Record[i] == 3 || Record[i] == 4) { // String attribute bool HasValue = (Record[i++] == 4); SmallString<64> KindStr; |