[llvm] 8dd2416 - [Coroutines] Use std::optional in CoroFrame.cpp (NFC)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 25 23:18:22 PST 2022


Author: Kazu Hirata
Date: 2022-11-25T23:18:17-08:00
New Revision: 8dd2416e44de18d078b7c88411c1c6466aa44a6f

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

LOG: [Coroutines] Use std::optional in CoroFrame.cpp (NFC)

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716

Added: 
    

Modified: 
    llvm/lib/Transforms/Coroutines/CoroFrame.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Coroutines/CoroFrame.cpp b/llvm/lib/Transforms/Coroutines/CoroFrame.cpp
index 4973ecdff71b..de3d4422b3ce 100644
--- a/llvm/lib/Transforms/Coroutines/CoroFrame.cpp
+++ b/llvm/lib/Transforms/Coroutines/CoroFrame.cpp
@@ -37,6 +37,7 @@
 #include "llvm/Transforms/Utils/Local.h"
 #include "llvm/Transforms/Utils/PromoteMemToReg.h"
 #include <algorithm>
+#include <optional>
 
 using namespace llvm;
 
@@ -1137,7 +1138,7 @@ static StructType *buildFrameType(Function &F, coro::Shape &Shape,
   FrameTypeBuilder B(C, DL, MaxFrameAlignment);
 
   AllocaInst *PromiseAlloca = Shape.getPromiseAlloca();
-  Optional<FieldIDType> SwitchIndexFieldId;
+  std::optional<FieldIDType> SwitchIndexFieldId;
 
   if (Shape.ABI == coro::ABI::Switch) {
     auto *FramePtrTy = FrameTy->getPointerTo();


        


More information about the llvm-commits mailing list