diff options
author | George Burgess IV <george.burgess.iv@gmail.com> | 2016-04-12 01:05:35 +0000 |
---|---|---|
committer | George Burgess IV <george.burgess.iv@gmail.com> | 2016-04-12 01:05:35 +0000 |
commit | 274105b8b5b86060281e8dd13b7e146b08fc665f (patch) | |
tree | 120b029f99fc8059c210f1baeb2bd523b1423be4 /lib/IR/AttributeImpl.h | |
parent | c13dfaa1cd6aad8d7395834290d7a441c5f73c28 (diff) |
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
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@266032 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/IR/AttributeImpl.h')
-rw-r--r-- | lib/IR/AttributeImpl.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/IR/AttributeImpl.h b/lib/IR/AttributeImpl.h index 33250433988..7b4b3bb18e7 100644 --- a/lib/IR/AttributeImpl.h +++ b/lib/IR/AttributeImpl.h @@ -17,6 +17,7 @@ #define LLVM_LIB_IR_ATTRIBUTEIMPL_H #include "llvm/ADT/FoldingSet.h" +#include "llvm/ADT/Optional.h" #include "llvm/IR/Attributes.h" #include "llvm/Support/DataTypes.h" #include "llvm/Support/TrailingObjects.h" @@ -120,7 +121,8 @@ public: : EnumAttributeImpl(IntAttrEntry, Kind), Val(Val) { assert((Kind == Attribute::Alignment || Kind == Attribute::StackAlignment || Kind == Attribute::Dereferenceable || - Kind == Attribute::DereferenceableOrNull) && + Kind == Attribute::DereferenceableOrNull || + Kind == Attribute::AllocSize) && "Wrong kind for int attribute!"); } @@ -188,6 +190,7 @@ public: unsigned getStackAlignment() const; uint64_t getDereferenceableBytes() const; uint64_t getDereferenceableOrNullBytes() const; + std::pair<unsigned, Optional<unsigned>> getAllocSizeArgs() const; std::string getAsString(bool InAttrGrp) const; typedef const Attribute *iterator; |