llvm.org GIT mirror llvm / 1907eb8
[LLVM-C] Add target triple normalization to the C API. rL333307 was introduced to remove automatic target triple normalization when calling sys::getDefaultTargetTriple(), arguing that users of the latter already called Triple::normalize() if necessary. However, users of the C API currently have no way of doing target triple normalization. This patch introduces an LLVMNormalizeTargetTriple function to the C API which wraps Triple::normalize() and can be used on the result of LLVMGetDefaultTargetTriple to achieve the same effect. Differential Revision: https://reviews.llvm.org/D49414 Reviewed By: whitequark git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337263 91177308-0d34-0410-b5e6-96231b3b80d8 whitequark 1 year, 2 months ago
2 changed file(s) with 8 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
136136 disposed with LLVMDisposeMessage. */
137137 char* LLVMGetDefaultTargetTriple(void);
138138
139 /** Normalize a target triple. The result needs to be disposed with
140 LLVMDisposeMessage. */
141 char* LLVMNormalizeTargetTriple(const char* triple);
142
139143 /** Get the host CPU as a string. The result needs to be disposed with
140144 LLVMDisposeMessage. */
141145 char* LLVMGetHostCPUName(void);
237237 return strdup(sys::getDefaultTargetTriple().c_str());
238238 }
239239
240 char *LLVMNormalizeTargetTriple(const char* triple) {
241 return strdup(Triple::normalize(StringRef(triple)).c_str());
242 }
243
240244 char *LLVMGetHostCPUName(void) {
241245 return strdup(sys::getHostCPUName().data());
242246 }