Add the allocsize attribute to LLVM.
`allocsize` is a function attribute that allows users to request that LLVM treat arbitrary functions as allocation functions. This patch makes LLVM accept the `allocsize` attribute, and makes `@llvm.objectsize` recognize said attribute. The review for this was split into two patches for ease of reviewing: D18974 and D14933. As promised on the revisions, I'm landing both patches as a single commit. Differential Revision: http://reviews.llvm.org/D14933 llvm-svn: 266032
This commit is contained in:
@@ -1288,6 +1288,8 @@ static Attribute::AttrKind getAttrFromCode(uint64_t Code) {
|
||||
return Attribute::Dereferenceable;
|
||||
case bitc::ATTR_KIND_DEREFERENCEABLE_OR_NULL:
|
||||
return Attribute::DereferenceableOrNull;
|
||||
case bitc::ATTR_KIND_ALLOC_SIZE:
|
||||
return Attribute::AllocSize;
|
||||
case bitc::ATTR_KIND_NO_RED_ZONE:
|
||||
return Attribute::NoRedZone;
|
||||
case bitc::ATTR_KIND_NO_RETURN:
|
||||
@@ -1412,6 +1414,8 @@ std::error_code BitcodeReader::parseAttributeGroupBlock() {
|
||||
B.addDereferenceableAttr(Record[++i]);
|
||||
else if (Kind == Attribute::DereferenceableOrNull)
|
||||
B.addDereferenceableOrNullAttr(Record[++i]);
|
||||
else if (Kind == Attribute::AllocSize)
|
||||
B.addAllocSizeAttrFromRawRepr(Record[++i]);
|
||||
} else { // String attribute
|
||||
assert((Record[i] == 3 || Record[i] == 4) &&
|
||||
"Invalid attribute group entry");
|
||||
|
||||
Reference in New Issue
Block a user