[llvm] 5696927 - [DWARF] Use std::optional in DWARFFormValue.cpp (NFC)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 25 11:45:52 PST 2022


Author: Kazu Hirata
Date: 2022-11-25T11:45:47-08:00
New Revision: 56969279b9988594ac9a49e880d07c0dd6ba3a28

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

LOG: [DWARF] Use std::optional in DWARFFormValue.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/DebugInfo/DWARF/DWARFFormValue.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp b/llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp
index 1fecd5ee6902..bd8c9d6b4ba9 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp
@@ -25,6 +25,7 @@
 #include <cinttypes>
 #include <cstdint>
 #include <limits>
+#include <optional>
 
 using namespace llvm;
 using namespace dwarf;
@@ -635,7 +636,7 @@ Expected<const char *> DWARFFormValue::getAsCString() const {
     return make_error<StringError>("Unsupported form for string attribute",
                                    inconvertibleErrorCode());
   uint64_t Offset = Value.uval;
-  Optional<uint32_t> Index;
+  std::optional<uint32_t> Index;
   if (Form == DW_FORM_GNU_str_index || Form == DW_FORM_strx ||
       Form == DW_FORM_strx1 || Form == DW_FORM_strx2 || Form == DW_FORM_strx3 ||
       Form == DW_FORM_strx4) {


        


More information about the llvm-commits mailing list