Skip to content

Commit dcc4b94

Browse files
committed
[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.
1 parent a7802a8 commit dcc4b94

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

llvm/include/llvm-c/Core.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1391,9 +1391,9 @@ LLVMBool LLVMIsLiteralStruct(LLVMTypeRef StructTy);
13911391
*/
13921392

13931393
/**
1394-
* Obtain the type of elements within a sequential type.
1394+
* Obtain the element type of an array or vector type.
13951395
*
1396-
* This works on array, vector, and pointer types.
1396+
* This currently also works for pointer types, but this usage is deprecated.
13971397
*
13981398
* @see llvm::SequentialType::getElementType()
13991399
*/

llvm/lib/IR/Core.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -798,7 +798,7 @@ LLVMTypeRef LLVMScalableVectorType(LLVMTypeRef ElementType,
798798
LLVMTypeRef LLVMGetElementType(LLVMTypeRef WrappedTy) {
799799
auto *Ty = unwrap<Type>(WrappedTy);
800800
if (auto *PTy = dyn_cast<PointerType>(Ty))
801-
return wrap(PTy->getPointerElementType());
801+
return wrap(PTy->getNonOpaquePointerElementType());
802802
if (auto *ATy = dyn_cast<ArrayType>(Ty))
803803
return wrap(ATy->getElementType());
804804
return wrap(cast<VectorType>(Ty)->getElementType());

0 commit comments

Comments
 (0)