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(char* triple); + /** Get the host CPU as a string. The result needs to be disposed with LLVMDisposeMessage. */ char* LLVMGetHostCPUName(void); 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(char* triple) { + return strdup(Triple::normalize(StringRef(triple)).c_str()); +} + char *LLVMGetHostCPUName(void) { return strdup(sys::getHostCPUName().data()); }