[llvm-c] Document that LLVMGetElementType on pointers is deprecated (NFC)

We can't actually deprecate the function, because it is also used
for arrays and vectors, so we can only document this.
This commit is contained in:
Nikita Popov 2022-03-11 09:27:22 +01:00
parent a7802a806d
commit dcc4b94d94
2 changed files with 3 additions and 3 deletions

View File

@ -1391,9 +1391,9 @@ LLVMBool LLVMIsLiteralStruct(LLVMTypeRef StructTy);
*/
/**
* Obtain the type of elements within a sequential type.
* Obtain the element type of an array or vector type.
*
* This works on array, vector, and pointer types.
* This currently also works for pointer types, but this usage is deprecated.
*
* @see llvm::SequentialType::getElementType()
*/

View File

@ -798,7 +798,7 @@ LLVMTypeRef LLVMScalableVectorType(LLVMTypeRef ElementType,
LLVMTypeRef LLVMGetElementType(LLVMTypeRef WrappedTy) {
auto *Ty = unwrap<Type>(WrappedTy);
if (auto *PTy = dyn_cast<PointerType>(Ty))
return wrap(PTy->getPointerElementType());
return wrap(PTy->getNonOpaquePointerElementType());
if (auto *ATy = dyn_cast<ArrayType>(Ty))
return wrap(ATy->getElementType());
return wrap(cast<VectorType>(Ty)->getElementType());