[llvm] 1a92355 - [IR] Suppress getGetElementPtr() deprecation in more places (#228364)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 2 02:29:55 PDT 2026
Author: Nikita Popov
Date: 2026-10-02T09:29:47Z
New Revision: 1a92355c0354b9a3b62be64a42f6acc0484518a3
URL: https://github.com/llvm/llvm-project/commit/1a92355c0354b9a3b62be64a42f6acc0484518a3
DIFF: https://github.com/llvm/llvm-project/commit/1a92355c0354b9a3b62be64a42f6acc0484518a3.diff
LOG: [IR] Suppress getGetElementPtr() deprecation in more places (#228364)
These methods are themselves deprecated. Clang does not warn for
them, but MSVC does.
Added:
Modified:
llvm/lib/IR/Constants.cpp
Removed:
################################################################################
diff --git a/llvm/lib/IR/Constants.cpp b/llvm/lib/IR/Constants.cpp
index 5c4d2e85e7fc3..59c2a97a851ab 100644
--- a/llvm/lib/IR/Constants.cpp
+++ b/llvm/lib/IR/Constants.cpp
@@ -2669,9 +2669,11 @@ Constant *ConstantExpr::getSizeOf(Type* Ty) {
// sizeof is implemented as: (i64) gep (Ty*)null, 1
// Note that a non-inbounds gep is used, as null isn't within any object.
Constant *GEPIdx = ConstantInt::get(Type::getInt32Ty(Ty->getContext()), 1);
+ LLVM_SUPPRESS_DEPRECATED_DECLARATIONS_PUSH
Constant *GEP = getGetElementPtr(
Ty, Constant::getNullValue(PointerType::getUnqual(Ty->getContext())),
GEPIdx);
+ LLVM_SUPPRESS_DEPRECATED_DECLARATIONS_POP
return getPtrToInt(GEP,
Type::getInt64Ty(Ty->getContext()));
}
@@ -2685,7 +2687,9 @@ Constant *ConstantExpr::getAlignOf(Type* Ty) {
Constant *Zero = ConstantInt::get(Type::getInt64Ty(Ty->getContext()), 0);
Constant *One = ConstantInt::get(Type::getInt32Ty(Ty->getContext()), 1);
Constant *Indices[2] = {Zero, One};
+ LLVM_SUPPRESS_DEPRECATED_DECLARATIONS_PUSH
Constant *GEP = getGetElementPtr(AligningTy, NullPtr, Indices);
+ LLVM_SUPPRESS_DEPRECATED_DECLARATIONS_POP
return getPtrToInt(GEP, Type::getInt64Ty(Ty->getContext()));
}
More information about the llvm-commits
mailing list