[PATCH] D49414: Add target triple normalization to the C API

Markus Lindström via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 17 03:58:03 PDT 2018


mhlindstr updated this revision to Diff 155840.
mhlindstr added a comment.

Fixed the patch so that the LLVMNormalizeTargetTriple takes a const char* argument. Sorry about that.


https://reviews.llvm.org/D49414

Files:
  include/llvm-c/TargetMachine.h
  lib/Target/TargetMachineC.cpp


Index: lib/Target/TargetMachineC.cpp
===================================================================
--- lib/Target/TargetMachineC.cpp
+++ lib/Target/TargetMachineC.cpp
@@ -238,6 +238,10 @@
   return strdup(sys::getDefaultTargetTriple().c_str());
 }
 
+char *LLVMNormalizeTargetTriple(const char* triple) {
+  return strdup(Triple::normalize(StringRef(triple)).c_str());
+}
+
 char *LLVMGetHostCPUName(void) {
   return strdup(sys::getHostCPUName().data());
 }
Index: include/llvm-c/TargetMachine.h
===================================================================
--- include/llvm-c/TargetMachine.h
+++ include/llvm-c/TargetMachine.h
@@ -137,6 +137,10 @@
   disposed with LLVMDisposeMessage. */
 char* LLVMGetDefaultTargetTriple(void);
 
+/** Normalize a target triple. The result needs to be disposed with
+  LLVMDisposeMessage. */
+char* LLVMNormalizeTargetTriple(const char* triple);
+
 /** Get the host CPU as a string. The result needs to be disposed with
   LLVMDisposeMessage. */
 char* LLVMGetHostCPUName(void);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49414.155840.patch
Type: text/x-patch
Size: 1027 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180717/605bb0fd/attachment.bin>


More information about the llvm-commits mailing list