[llvm] [C API] Add getters for Target Extension Types to C API (PR #96447)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 24 02:41:10 PDT 2024


================
@@ -954,6 +954,32 @@ LLVMTypeRef LLVMTargetExtTypeInContext(LLVMContextRef C, const char *Name,
       TargetExtType::get(*unwrap(C), Name, TypeParamArray, IntParamArray));
 }
 
+const char *LLVMGetTargetExtTypeName(LLVMTypeRef TargetExtTy) {
+  TargetExtType *Type = unwrap<TargetExtType>(TargetExtTy);
+  return Type->getName().data();
----------------
nikic wrote:

This looked iffy, but apparently StringSaver used to store the name guarantees null termination, so this should be safe.

https://github.com/llvm/llvm-project/pull/96447


More information about the llvm-commits mailing list