aboutsummaryrefslogtreecommitdiff
path: root/include/llvm/IR/Instruction.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/llvm/IR/Instruction.h')
-rw-r--r--include/llvm/IR/Instruction.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/llvm/IR/Instruction.h b/include/llvm/IR/Instruction.h
index 6a9a74bd16f0..803f6977b32c 100644
--- a/include/llvm/IR/Instruction.h
+++ b/include/llvm/IR/Instruction.h
@@ -229,6 +229,16 @@ public:
return hasMetadataHashEntry();
}
+ /// Return true if this instruction has the given type of metadata attached.
+ bool hasMetadata(unsigned KindID) const {
+ return getMetadata(KindID) != nullptr;
+ }
+
+ /// Return true if this instruction has the given type of metadata attached.
+ bool hasMetadata(StringRef Kind) const {
+ return getMetadata(Kind) != nullptr;
+ }
+
/// Get the metadata of given kind attached to this Instruction.
/// If the metadata is not found then return null.
MDNode *getMetadata(unsigned KindID) const {