aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/DataLayout.cpp
diff options
context:
space:
mode:
authorFangrui Song <i@maskray.me>2022-12-05 04:13:11 +0000
committerFangrui Song <i@maskray.me>2022-12-05 04:13:11 +0000
commit89fae41ef142892d8d6c20ead28465a34e12172b (patch)
tree95d80b9764e5d1d25bf8485a8426e6a409930b50 /llvm/lib/IR/DataLayout.cpp
parent768cae4a5ab3a564b25ed36c379423f71b42d9d0 (diff)
downloadllvm-89fae41ef142892d8d6c20ead28465a34e12172b.zip
llvm-89fae41ef142892d8d6c20ead28465a34e12172b.tar.gz
llvm-89fae41ef142892d8d6c20ead28465a34e12172b.tar.bz2
[IR] llvm::Optional => std::optional
Many llvm/IR/* files have been migrated by other contributors. This migrates most remaining files.
Diffstat (limited to 'llvm/lib/IR/DataLayout.cpp')
-rw-r--r--llvm/lib/IR/DataLayout.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/IR/DataLayout.cpp b/llvm/lib/IR/DataLayout.cpp
index e451234..4bd0887 100644
--- a/llvm/lib/IR/DataLayout.cpp
+++ b/llvm/lib/IR/DataLayout.cpp
@@ -925,8 +925,8 @@ static APInt getElementIndex(TypeSize ElemSize, APInt &Offset) {
return Index;
}
-Optional<APInt> DataLayout::getGEPIndexForOffset(Type *&ElemTy,
- APInt &Offset) const {
+std::optional<APInt> DataLayout::getGEPIndexForOffset(Type *&ElemTy,
+ APInt &Offset) const {
if (auto *ArrTy = dyn_cast<ArrayType>(ElemTy)) {
ElemTy = ArrTy->getElementType();
return getElementIndex(getTypeAllocSize(ElemTy), Offset);
@@ -964,7 +964,7 @@ SmallVector<APInt> DataLayout::getGEPIndicesForOffset(Type *&ElemTy,
SmallVector<APInt> Indices;
Indices.push_back(getElementIndex(getTypeAllocSize(ElemTy), Offset));
while (Offset != 0) {
- Optional<APInt> Index = getGEPIndexForOffset(ElemTy, Offset);
+ std::optional<APInt> Index = getGEPIndexForOffset(ElemTy, Offset);
if (!Index)
break;
Indices.push_back(*Index);