aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Bitcode
diff options
context:
space:
mode:
authorAugie Fackler <augie@google.com>2022-02-24 10:40:20 -0500
committerAugie Fackler <augie@google.com>2022-04-26 13:57:11 -0400
commita907d36cfe8069ce191ffada3b84e37ca50e05b6 (patch)
tree18b83da9db957fb528610cb2b1dd56e34c3ccdf9 /llvm/lib/Bitcode
parent3a9ae9cf7c341ff329550a5bcac8362715d3f4b3 (diff)
downloadllvm-a907d36cfe8069ce191ffada3b84e37ca50e05b6.zip
llvm-a907d36cfe8069ce191ffada3b84e37ca50e05b6.tar.gz
llvm-a907d36cfe8069ce191ffada3b84e37ca50e05b6.tar.bz2
Attributes: add a new `allocptr` attribute
This continues the push away from hard-coded knowledge about functions towards attributes. We'll use this to annotate free(), realloc() and cousins and obviate the hard-coded list of free functions. Differential Revision: https://reviews.llvm.org/D123083
Diffstat (limited to 'llvm/lib/Bitcode')
-rw-r--r--llvm/lib/Bitcode/Reader/BitcodeReader.cpp2
-rw-r--r--llvm/lib/Bitcode/Writer/BitcodeWriter.cpp2
2 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
index 62d9904..901c117 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -1538,6 +1538,8 @@ static Attribute::AttrKind getAttrFromCode(uint64_t Code) {
return Attribute::AllocAlign;
case bitc::ATTR_KIND_ALLOC_SIZE:
return Attribute::AllocSize;
+ case bitc::ATTR_KIND_ALLOCATED_POINTER:
+ return Attribute::AllocatedPointer;
case bitc::ATTR_KIND_NO_RED_ZONE:
return Attribute::NoRedZone;
case bitc::ATTR_KIND_NO_RETURN:
diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
index e773ba8..dcfe12a 100644
--- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
+++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
@@ -647,6 +647,8 @@ static uint64_t getAttrKindEncoding(Attribute::AttrKind Kind) {
return bitc::ATTR_KIND_JUMP_TABLE;
case Attribute::MinSize:
return bitc::ATTR_KIND_MIN_SIZE;
+ case Attribute::AllocatedPointer:
+ return bitc::ATTR_KIND_ALLOCATED_POINTER;
case Attribute::Naked:
return bitc::ATTR_KIND_NAKED;
case Attribute::Nest: