[llvm] ca161e0 - [IRBuilder] Deprecate CreateStructGEP() without element type

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Sat Jul 17 09:48:33 PDT 2021


Author: Nikita Popov
Date: 2021-07-17T18:48:22+02:00
New Revision: ca161e0c3503c7dce212e4e106c5c25d04fb8aa8

URL: https://github.com/llvm/llvm-project/commit/ca161e0c3503c7dce212e4e106c5c25d04fb8aa8
DIFF: https://github.com/llvm/llvm-project/commit/ca161e0c3503c7dce212e4e106c5c25d04fb8aa8.diff

LOG: [IRBuilder] Deprecate CreateStructGEP() without element type

This API is incompatible with opaque pointers and deprecated in
favor of the version that accepts an explicit element type.

Added: 
    

Modified: 
    llvm/include/llvm/IR/IRBuilder.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/IR/IRBuilder.h b/llvm/include/llvm/IR/IRBuilder.h
index 0c7843b158b2..3dc72c4388b0 100644
--- a/llvm/include/llvm/IR/IRBuilder.h
+++ b/llvm/include/llvm/IR/IRBuilder.h
@@ -1988,7 +1988,9 @@ class IRBuilderBase {
     return CreateConstInBoundsGEP2_32(Ty, Ptr, 0, Idx, Name);
   }
 
-  Value *CreateStructGEP(Value *Ptr, unsigned Idx, const Twine &Name = "") {
+  LLVM_ATTRIBUTE_DEPRECATED(
+      Value *CreateStructGEP(Value *Ptr, unsigned Idx, const Twine &Name = ""),
+      "Use the version with explicit element type instead") {
     return CreateConstInBoundsGEP2_32(
         Ptr->getType()->getScalarType()->getPointerElementType(), Ptr, 0, Idx,
         Name);


        


More information about the llvm-commits mailing list