[llvm] r239029 - [C API] Add LLVMStructGetTypeAtIndex.

Peter Zotov whitequark at whitequark.org
Thu Jun 4 02:09:53 PDT 2015


Author: whitequark
Date: Thu Jun  4 04:09:53 2015
New Revision: 239029

URL: http://llvm.org/viewvc/llvm-project?rev=239029&view=rev
Log:
[C API] Add LLVMStructGetTypeAtIndex.

Patch by deadalnix (Amaury SECHET).

Modified:
    llvm/trunk/include/llvm-c/Core.h
    llvm/trunk/lib/IR/Core.cpp

Modified: llvm/trunk/include/llvm-c/Core.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/Core.h?rev=239029&r1=239028&r2=239029&view=diff
==============================================================================
--- llvm/trunk/include/llvm-c/Core.h (original)
+++ llvm/trunk/include/llvm-c/Core.h Thu Jun  4 04:09:53 2015
@@ -998,6 +998,13 @@ unsigned LLVMCountStructElementTypes(LLV
 void LLVMGetStructElementTypes(LLVMTypeRef StructTy, LLVMTypeRef *Dest);
 
 /**
+ * Get the type of the element at a given index in the structure.
+ *
+ * @see llvm::StructType::getTypeAtIndex()
+ */
+LLVMTypeRef LLVMStructGetTypeAtIndex(LLVMTypeRef StructTy, unsigned i);
+
+/**
  * Determine whether a structure is packed.
  *
  * @see llvm::StructType::isPacked()

Modified: llvm/trunk/lib/IR/Core.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Core.cpp?rev=239029&r1=239028&r2=239029&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Core.cpp (original)
+++ llvm/trunk/lib/IR/Core.cpp Thu Jun  4 04:09:53 2015
@@ -461,6 +461,11 @@ void LLVMGetStructElementTypes(LLVMTypeR
     *Dest++ = wrap(*I);
 }
 
+LLVMTypeRef LLVMStructGetTypeAtIndex(LLVMTypeRef StructTy, unsigned i) {
+  StructType *Ty = unwrap<StructType>(StructTy);
+  return wrap(Ty->getTypeAtIndex(i));
+}
+
 LLVMBool LLVMIsPackedStruct(LLVMTypeRef StructTy) {
   return unwrap<StructType>(StructTy)->isPacked();
 }





More information about the llvm-commits mailing list