summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/LLVMContextImpl.h
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2018-05-31 13:29:58 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2018-05-31 13:29:58 +0000
commit0deb9a9a1f9a02bc0c63d1bc4d881bfb1f46bca4 (patch)
treed22716759a31167ef8f0bfdb57c835d41ed73d50 /llvm/lib/IR/LLVMContextImpl.h
parente37a5ce1489e54f4143d384b559107fe7eef9257 (diff)
downloadbcm5719-llvm-0deb9a9a1f9a02bc0c63d1bc4d881bfb1f46bca4.tar.gz
bcm5719-llvm-0deb9a9a1f9a02bc0c63d1bc4d881bfb1f46bca4.zip
Extend the GlobalObject metadata interface
- Make eraseMetadata return whether it changed something - Wire getMetadata for a single MDNode efficiently into the attachment map - Add hasMetadata, which is less weird than checking getMetadata == nullptr on a multimap. Use it to simplify code. llvm-svn: 333649
Diffstat (limited to 'llvm/lib/IR/LLVMContextImpl.h')
-rw-r--r--llvm/lib/IR/LLVMContextImpl.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/llvm/lib/IR/LLVMContextImpl.h b/llvm/lib/IR/LLVMContextImpl.h
index 7ceeca6e347..d5046d64418 100644
--- a/llvm/lib/IR/LLVMContextImpl.h
+++ b/llvm/lib/IR/LLVMContextImpl.h
@@ -1164,7 +1164,7 @@ public:
/// Remove an attachment.
///
/// Remove the attachment at \c ID, if any.
- void erase(unsigned ID);
+ bool erase(unsigned ID);
/// Copy out all the attachments.
///
@@ -1197,10 +1197,14 @@ public:
/// Appends all attachments with the given ID to \c Result in insertion order.
/// If the global has no attachments with the given ID, or if ID is invalid,
/// leaves Result unchanged.
- void get(unsigned ID, SmallVectorImpl<MDNode *> &Result);
+ void get(unsigned ID, SmallVectorImpl<MDNode *> &Result) const;
+
+ /// Returns the first attachment with the given ID or nullptr if no such
+ /// attachment exists.
+ MDNode *lookup(unsigned ID) const;
void insert(unsigned ID, MDNode &MD);
- void erase(unsigned ID);
+ bool erase(unsigned ID);
/// Appends all attachments for the global to \c Result, sorting by attachment
/// ID. Attachments with the same ID appear in insertion order. This function
OpenPOWER on IntegriCloud