diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2016-08-17 19:33:52 +0000 | 
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2016-08-17 19:33:52 +0000 | 
| commit | a7fe922b98bb45be7dce7c1cfe668ec27eeddc74 (patch) | |
| tree | e9648f5bddc775b842e53141d7c9748482f7115a /lib/IR/Core.cpp | |
| parent | c3aee98e721333f265a88d6bf348e6e468f027d4 (diff) | |
Notes
Diffstat (limited to 'lib/IR/Core.cpp')
| -rw-r--r-- | lib/IR/Core.cpp | 28 | 
1 files changed, 28 insertions, 0 deletions
diff --git a/lib/IR/Core.cpp b/lib/IR/Core.cpp index a55361489ada..3c4b0cf2f8ff 100644 --- a/lib/IR/Core.cpp +++ b/lib/IR/Core.cpp @@ -16,6 +16,7 @@  #include "llvm/ADT/StringSwitch.h"  #include "llvm/Bitcode/ReaderWriter.h"  #include "llvm/IR/Attributes.h" +#include "AttributeSetNode.h"  #include "llvm/IR/CallSite.h"  #include "llvm/IR/Constants.h"  #include "llvm/IR/DerivedTypes.h" @@ -1844,6 +1845,18 @@ void LLVMAddAttributeAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx,    unwrap<Function>(F)->addAttribute(Idx, unwrap(A));  } +unsigned LLVMGetAttributeCountAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx) { +  auto *ASN = AttributeSetNode::get(unwrap<Function>(F)->getAttributes(), Idx); +  return ASN->getNumAttributes(); +} + +void LLVMGetAttributesAtIndex(LLVMValueRef F, LLVMAttributeIndex Idx, +                              LLVMAttributeRef *Attrs) { +  auto *ASN = AttributeSetNode::get(unwrap<Function>(F)->getAttributes(), Idx); +  for (auto A: make_range(ASN->begin(), ASN->end())) +    *Attrs++ = wrap(A); +} +  LLVMAttributeRef LLVMGetEnumAttributeAtIndex(LLVMValueRef F,                                               LLVMAttributeIndex Idx,                                               unsigned KindID) { @@ -2216,6 +2229,21 @@ void LLVMAddCallSiteAttribute(LLVMValueRef C, LLVMAttributeIndex Idx,    CallSite(unwrap<Instruction>(C)).addAttribute(Idx, unwrap(A));  } +unsigned LLVMGetCallSiteAttributeCount(LLVMValueRef C, +                                       LLVMAttributeIndex Idx) { +  auto CS = CallSite(unwrap<Instruction>(C)); +  auto *ASN = AttributeSetNode::get(CS.getAttributes(), Idx); +  return ASN->getNumAttributes(); +} + +void LLVMGetCallSiteAttributes(LLVMValueRef C, LLVMAttributeIndex Idx, +                               LLVMAttributeRef *Attrs) { +  auto CS = CallSite(unwrap<Instruction>(C)); +  auto *ASN = AttributeSetNode::get(CS.getAttributes(), Idx); +  for (auto A: make_range(ASN->begin(), ASN->end())) +    *Attrs++ = wrap(A); +} +  LLVMAttributeRef LLVMGetCallSiteEnumAttribute(LLVMValueRef C,                                                LLVMAttributeIndex Idx,                                                unsigned KindID) {  | 
