llvm.org GIT mirror llvm / f26b156
[LLVM-C] Deprecate the LLVMValueRef-returning metadata creation functions Summary: There is still some value in using these functions while the remaining LLVMValueRef-based accessors are still around, but LLVMMDNodeInContext in particular has some wonky semantics that make it worth replacing outright. Reviewers: whitequark, deadalnix Reviewed By: whitequark Subscribers: hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D60524 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359114 91177308-0d34-0410-b5e6-96231b3b80d8 Robert Widmann 3 months ago
2 changed file(s) with 38 addition(s) and 28 deletion(s). Raw diff Collapse all Expand all
27342734 */
27352735
27362736 /**
2737 * Obtain a MDString value from a context.
2738 *
2739 * The returned instance corresponds to the llvm::MDString class.
2740 *
2741 * The instance is specified by string data of a specified length. The
2742 * string content is copied, so the backing memory can be freed after
2743 * this function returns.
2744 */
2745 LLVMValueRef LLVMMDStringInContext(LLVMContextRef C, const char *Str,
2746 unsigned SLen);
2747
2748 /**
2749 * Obtain a MDString value from the global context.
2750 */
2751 LLVMValueRef LLVMMDString(const char *Str, unsigned SLen);
2752
2753 /**
2754 * Obtain a MDNode value from a context.
2755 *
2756 * The returned value corresponds to the llvm::MDNode class.
2757 */
2758 LLVMValueRef LLVMMDNodeInContext(LLVMContextRef C, LLVMValueRef *Vals,
2759 unsigned Count);
2760
2761 /**
2762 * Obtain a MDNode value from the global context.
2763 */
2764 LLVMValueRef LLVMMDNode(LLVMValueRef *Vals, unsigned Count);
2737 * Create an MDString value from a given string value.
2738 *
2739 * The MDString value does not take ownership of the given string, it remains
2740 * the responsibility of the caller to free it.
2741 *
2742 * @see llvm::MDString::get()
2743 */
2744 LLVMMetadataRef LLVMMDStringInContext2(LLVMContextRef C, const char *Str,
2745 size_t SLen);
2746
2747 /**
2748 * Create an MDNode value with the given array of operands.
2749 *
2750 * @see llvm::MDNode::get()
2751 */
2752 LLVMMetadataRef LLVMMDNodeInContext2(LLVMContextRef C, LLVMMetadataRef *MDs,
2753 size_t Count);
27652754
27662755 /**
27672756 * Obtain a Metadata as a Value.
28022791 * @param Dest Destination array for operands.
28032792 */
28042793 void LLVMGetMDNodeOperands(LLVMValueRef V, LLVMValueRef *Dest);
2794
2795 /** Deprecated: Use LLVMMDStringInContext2 instead. */
2796 LLVMValueRef LLVMMDStringInContext(LLVMContextRef C, const char *Str,
2797 unsigned SLen);
2798 /** Deprecated: Use LLVMMDStringInContext2 instead. */
2799 LLVMValueRef LLVMMDString(const char *Str, unsigned SLen);
2800 /** Deprecated: Use LLVMMDNodeInContext2 instead. */
2801 LLVMValueRef LLVMMDNodeInContext(LLVMContextRef C, LLVMValueRef *Vals,
2802 unsigned Count);
2803 /** Deprecated: Use LLVMMDNodeInContext2 instead. */
2804 LLVMValueRef LLVMMDNode(LLVMValueRef *Vals, unsigned Count);
28052805
28062806 /**
28072807 * @}
10341034 }
10351035
10361036 /*--.. Operations on metadata nodes ........................................--*/
1037
1038 LLVMMetadataRef LLVMMDStringInContext2(LLVMContextRef C, const char *Str,
1039 size_t SLen) {
1040 return wrap(MDString::get(*unwrap(C), StringRef(Str, SLen)));
1041 }
1042
1043 LLVMMetadataRef LLVMMDNodeInContext2(LLVMContextRef C, LLVMMetadataRef *MDs,
1044 size_t Count) {
1045 return wrap(MDNode::get(*unwrap(C), ArrayRef(unwrap(MDs), Count)));
1046 }
10371047
10381048 LLVMValueRef LLVMMDStringInContext(LLVMContextRef C, const char *Str,
10391049 unsigned SLen) {