[lldb] Remove remaining uses of llvm::Optional (NFC)
authorKazu Hirata <kazu@google.com>
Sat, 7 Jan 2023 22:36:35 +0000 (14:36 -0800)
committerKazu Hirata <kazu@google.com>
Sat, 7 Jan 2023 22:36:35 +0000 (14:36 -0800)
This patch removes the unused "using" declarations, updates comments,
and removes #include "llvm/ADT/Optional.h".

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

47 files changed:
lldb/include/lldb/Breakpoint/BreakpointID.h
lldb/include/lldb/Core/SourceLocationSpec.h
lldb/include/lldb/Core/ValueObject.h
lldb/include/lldb/Core/ValueObjectChild.h
lldb/include/lldb/Host/FileSystem.h
lldb/include/lldb/Host/linux/Host.h
lldb/include/lldb/Symbol/ObjectFile.h
lldb/include/lldb/Target/MemoryRegionInfo.h
lldb/include/lldb/Target/MemoryTagMap.h
lldb/include/lldb/Target/UnixSignals.h
lldb/include/lldb/Utility/Diagnostics.h
lldb/include/lldb/Utility/SelectHelper.h
lldb/include/lldb/Utility/Timeout.h
lldb/include/lldb/Utility/UriParser.h
lldb/include/lldb/Utility/UserIDResolver.h
lldb/source/Core/DumpDataExtractor.cpp
lldb/source/Core/IOHandler.cpp
lldb/source/Expression/DWARFExpression.cpp
lldb/source/Plugins/ABI/ARC/ABISysV_arc.h
lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.h
lldb/source/Plugins/Instruction/RISCV/RISCVInstructions.h
lldb/source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.cpp
lldb/source/Plugins/Language/CPlusPlus/CPlusPlusNameParser.h
lldb/source/Plugins/Language/CPlusPlus/LibCxxVariant.cpp
lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.h
lldb/source/Plugins/Platform/Android/PlatformAndroidRemoteGDBServer.h
lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.h
lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h
lldb/source/Plugins/Platform/MacOSX/objcxx/PlatformiOSSimulatorCoreSimulatorSupport.h
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.h
lldb/source/Plugins/Process/minidump/MinidumpParser.h
lldb/source/Plugins/Process/minidump/MinidumpTypes.h
lldb/source/Plugins/SymbolFile/DWARF/DIERef.h
lldb/source/Plugins/SymbolFile/DWARF/DWARFContext.h
lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.h
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/source/Plugins/SymbolFile/NativePDB/CompileUnitIndex.h
lldb/source/Plugins/SymbolFile/NativePDB/PdbIndex.h
lldb/source/Plugins/Trace/intel-pt/TraceIntelPTConstants.h
lldb/source/Plugins/Trace/intel-pt/TraceIntelPTJSONStructs.h
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
lldb/source/Utility/SelectHelper.cpp
lldb/tools/lldb-vscode/JSONUtils.cpp
lldb/unittests/DataFormatter/StringPrinterTests.cpp
lldb/unittests/Process/minidump/MinidumpParserTest.cpp
lldb/unittests/tools/lldb-server/tests/TestClient.h

index dff9011..a623230 100644 (file)
@@ -12,7 +12,6 @@
 #include "lldb/lldb-private.h"
 
 #include "llvm/ADT/ArrayRef.h"
-#include "llvm/ADT/Optional.h"
 #include "llvm/ADT/StringRef.h"
 #include <optional>
 
index 3550dc0..9c2512b 100644 (file)
@@ -11,7 +11,6 @@
 
 #include "lldb/Core/Declaration.h"
 #include "lldb/lldb-defines.h"
-#include "llvm/ADT/Optional.h"
 
 #include <optional>
 #include <string>
index 398c6e9..a666d0b 100644 (file)
@@ -26,7 +26,6 @@
 #include "lldb/lldb-types.h"
 
 #include "llvm/ADT/ArrayRef.h"
-#include "llvm/ADT/Optional.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringRef.h"
 
index a655911..07b37aa 100644 (file)
@@ -18,8 +18,6 @@
 #include "lldb/lldb-private-enumerations.h"
 #include "lldb/lldb-types.h"
 
-#include "llvm/ADT/Optional.h"
-
 #include <cstddef>
 #include <cstdint>
 #include <optional>
index aefad00..823e771 100644 (file)
@@ -14,7 +14,6 @@
 #include "lldb/Utility/FileSpec.h"
 #include "lldb/Utility/Status.h"
 
-#include "llvm/ADT/Optional.h"
 #include "llvm/Support/Chrono.h"
 #include "llvm/Support/VirtualFileSystem.h"
 
index 08ac41b..ef1e74c 100644 (file)
@@ -10,7 +10,6 @@
 #define LLDB_HOST_LINUX_HOST_H
 
 #include "lldb/lldb-types.h"
-#include "llvm/ADT/Optional.h"
 #include <optional>
 
 namespace lldb_private {
index bae6e72..4d6c8f1 100644 (file)
@@ -19,7 +19,6 @@
 #include "lldb/Utility/FileSpec.h"
 #include "lldb/Utility/UUID.h"
 #include "lldb/lldb-private.h"
-#include "llvm/ADT/Optional.h"
 #include "llvm/Support/Threading.h"
 #include "llvm/Support/VersionTuple.h"
 #include <optional>
index 8d639a8..47d4c9d 100644 (file)
@@ -15,7 +15,6 @@
 
 #include "lldb/Utility/ConstString.h"
 #include "lldb/Utility/RangeMap.h"
-#include "llvm/ADT/Optional.h"
 #include "llvm/Support/FormatProviders.h"
 
 namespace lldb_private {
index 00543bb..272f722 100644 (file)
@@ -11,7 +11,6 @@
 
 #include "lldb/Target/MemoryTagManager.h"
 #include "lldb/lldb-private.h"
-#include "llvm/ADT/Optional.h"
 #include <map>
 #include <optional>
 
index c996723..ff9f1ac 100644 (file)
@@ -16,7 +16,6 @@
 
 #include "lldb/Utility/ConstString.h"
 #include "lldb/lldb-private.h"
-#include "llvm/ADT/Optional.h"
 #include "llvm/Support/JSON.h"
 
 namespace lldb_private {
index 225346a..5d23fa8 100644 (file)
@@ -11,7 +11,6 @@
 
 #include "lldb/Utility/FileSpec.h"
 #include "lldb/Utility/Log.h"
-#include "llvm/ADT/Optional.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringSet.h"
 #include "llvm/Support/Error.h"
index c1263f7..ea46c33 100644 (file)
@@ -13,7 +13,6 @@
 #include "lldb/lldb-types.h"
 
 #include "llvm/ADT/DenseMap.h"
-#include "llvm/ADT/Optional.h"
 
 #include <chrono>
 #include <optional>
index 3f7744e..85128c5 100644 (file)
@@ -9,7 +9,6 @@
 #ifndef LLDB_UTILITY_TIMEOUT_H
 #define LLDB_UTILITY_TIMEOUT_H
 
-#include "llvm/ADT/Optional.h"
 #include "llvm/Support/Chrono.h"
 #include "llvm/Support/FormatProviders.h"
 #include <optional>
index b109221..311cff9 100644 (file)
@@ -9,7 +9,6 @@
 #ifndef LLDB_UTILITY_URIPARSER_H
 #define LLDB_UTILITY_URIPARSER_H
 
-#include "llvm/ADT/Optional.h"
 #include "llvm/ADT/StringRef.h"
 #include <optional>
 
index e9f5836..45dad6b 100644 (file)
@@ -10,7 +10,6 @@
 #define LLDB_UTILITY_USERIDRESOLVER_H
 
 #include "llvm/ADT/DenseMap.h"
-#include "llvm/ADT/Optional.h"
 #include "llvm/ADT/StringRef.h"
 #include <mutex>
 #include <optional>
index 17025ef..7f6108f 100644 (file)
@@ -30,7 +30,6 @@
 #include "llvm/ADT/APFloat.h"
 #include "llvm/ADT/APInt.h"
 #include "llvm/ADT/ArrayRef.h"
-#include "llvm/ADT/Optional.h"
 #include "llvm/ADT/SmallVector.h"
 
 #include <limits>
index 443ca86..95957b6 100644 (file)
@@ -50,7 +50,6 @@
 
 using namespace lldb;
 using namespace lldb_private;
-using llvm::Optional;
 using llvm::StringRef;
 
 IOHandler::IOHandler(Debugger &debugger, IOHandler::Type type)
index 682ead9..47cef1b 100644 (file)
@@ -799,7 +799,7 @@ void UpdateValueTypeFromLocationDescription(Log *log, const DWARFUnit *dwarf_cu,
 /// \param so_addr out parameter, will be set to load address or section offset
 /// \param check_sectionoffset bool which determines if having a section offset
 ///                            but not a load address is considerd a success
-/// \returns llvm::Optional containing the load address if resolving and getting
+/// \returns std::optional containing the load address if resolving and getting
 ///          the load address succeed or an empty Optinal otherwise. If
 ///          check_sectionoffset is true we consider LLDB_INVALID_ADDRESS a
 ///          success if so_addr.IsSectionOffset() is true.
index d5358c1..de51345 100644 (file)
@@ -10,7 +10,6 @@
 #define liblldb_ABISysV_arc_h_
 
 // Other libraries and framework includes
-#include <llvm/ADT/Optional.h>
 #include <optional>
 
 // Project includes
index 6104e40..68ae3a3 100644 (file)
@@ -17,7 +17,6 @@
 #include "lldb/Core/Address.h"
 #include "lldb/Core/Disassembler.h"
 #include "lldb/Core/PluginManager.h"
-#include "llvm/ADT/Optional.h"
 
 class InstructionLLVMC;
 
index d9c2ffb..252cef8 100644 (file)
@@ -14,7 +14,6 @@
 #include <variant>
 
 #include "llvm/ADT/APFloat.h"
-#include "llvm/ADT/Optional.h"
 
 namespace lldb_private {
 
index a835f81..617181a 100644 (file)
@@ -16,7 +16,6 @@
 
 using namespace lldb;
 using namespace lldb_private;
-using llvm::Optional;
 using ParsedFunction = lldb_private::CPlusPlusNameParser::ParsedFunction;
 using ParsedName = lldb_private::CPlusPlusNameParser::ParsedName;
 namespace tok = clang::tok;
index 77482f6..326efb7 100644 (file)
@@ -10,7 +10,6 @@
 #define LLDB_SOURCE_PLUGINS_LANGUAGE_CPLUSPLUS_CPLUSPLUSNAMEPARSER_H
 
 #include "clang/Lex/Lexer.h"
-#include "llvm/ADT/Optional.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringRef.h"
 
index e4956b3..4e54e7b 100644 (file)
@@ -12,7 +12,6 @@
 #include "lldb/Symbol/CompilerType.h"
 #include "lldb/Utility/LLDBAssert.h"
 
-#include "llvm/ADT/Optional.h"
 #include "llvm/ADT/ScopeExit.h"
 #include <optional>
 
index 4c456dd..cfeec3d 100644 (file)
@@ -9,7 +9,6 @@
 #ifndef LLDB_SOURCE_PLUGINS_LANGUAGERUNTIME_OBJC_APPLEOBJCRUNTIME_APPLEOBJCRUNTIME_H
 #define LLDB_SOURCE_PLUGINS_LANGUAGERUNTIME_OBJC_APPLEOBJCRUNTIME_APPLEOBJCRUNTIME_H
 
-#include "llvm/ADT/Optional.h"
 
 #include "AppleObjCTrampolineHandler.h"
 #include "AppleThreadPlanStepThroughObjCTrampoline.h"
index eed8611..e5b75fd 100644 (file)
@@ -17,7 +17,6 @@
 #include "lldb/Utility/Status.h"
 #include "lldb/Utility/XcodeSDK.h"
 #include "lldb/lldb-forward.h"
-#include "llvm/ADT/Optional.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/Triple.h"
index 393d99f..4b564bb 100644 (file)
@@ -20,7 +20,6 @@
 #include "lldb/Utility/StructuredData.h"
 #include "lldb/Utility/XcodeSDK.h"
 #include "lldb/lldb-forward.h"
-#include "llvm/ADT/Optional.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringMap.h"
 #include "llvm/ADT/StringRef.h"
index 05d946f..1889be6 100644 (file)
@@ -25,7 +25,6 @@ typedef void *id;
 #include "lldb/Utility/ConstString.h"
 #include "lldb/Utility/Status.h"
 
-#include "llvm/ADT/Optional.h"
 
 // And now the actual magic
 namespace CoreSimulatorSupport {
index d3b0344..45ea2f2 100644 (file)
@@ -29,7 +29,6 @@
 #include "lldb/Host/windows/PosixApi.h"
 #endif
 
-#include "llvm/ADT/Optional.h"
 #include "llvm/Support/VersionTuple.h"
 
 namespace lldb_private {
index 97805f2..1853025 100644 (file)
@@ -17,7 +17,6 @@
 #include "GDBRemoteCommunicationServerCommon.h"
 #include "lldb/Host/Socket.h"
 
-#include "llvm/ADT/Optional.h"
 #include "llvm/Support/Error.h"
 
 namespace lldb_private {
index 0831314..050ba08 100644 (file)
@@ -19,7 +19,6 @@
 
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/DenseMap.h"
-#include "llvm/ADT/Optional.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Object/Minidump.h"
 
index 8c80a8c..fe99abf 100644 (file)
@@ -13,7 +13,6 @@
 
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/BitmaskEnum.h"
-#include "llvm/ADT/Optional.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/BinaryFormat/Minidump.h"
index 72238e3..af7e5e9 100644 (file)
@@ -10,7 +10,6 @@
 #define LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_DIEREF_H
 
 #include "lldb/Core/dwarf.h"
-#include "llvm/ADT/Optional.h"
 #include "llvm/Support/FormatProviders.h"
 #include <cassert>
 #include <optional>
index cc5168c..7df776b 100644 (file)
@@ -11,7 +11,6 @@
 
 #include "DWARFDataExtractor.h"
 #include "lldb/Core/Section.h"
-#include "llvm/ADT/Optional.h"
 #include "llvm/DebugInfo/DWARF/DWARFContext.h"
 #include "llvm/Support/Threading.h"
 #include <memory>
index 3cbfda4..90e07ea 100644 (file)
@@ -10,7 +10,6 @@
 #define LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_DWARFFORMVALUE_H
 
 #include "DWARFDataExtractor.h"
-#include "llvm/ADT/Optional.h"
 #include <cstddef>
 #include <optional>
 
index 4efa2c1..426e6b9 100644 (file)
@@ -8,7 +8,6 @@
 
 #include "SymbolFileDWARF.h"
 
-#include "llvm/ADT/Optional.h"
 #include "llvm/DebugInfo/DWARF/DWARFDebugLoc.h"
 #include "llvm/Support/Casting.h"
 #include "llvm/Support/Threading.h"
index ef9110b..c6e382d 100644 (file)
@@ -13,7 +13,6 @@
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/DenseSet.h"
 #include "llvm/ADT/IntervalMap.h"
-#include "llvm/ADT/Optional.h"
 #include "llvm/DebugInfo/CodeView/DebugInlineeLinesSubsection.h"
 #include "llvm/DebugInfo/CodeView/StringsAndChecksums.h"
 #include "llvm/DebugInfo/CodeView/SymbolRecord.h"
index 57d6822..796aa4c 100644 (file)
@@ -11,7 +11,6 @@
 
 #include "lldb/lldb-types.h"
 #include "llvm/ADT/IntervalMap.h"
-#include "llvm/ADT/Optional.h"
 #include "llvm/DebugInfo/PDB/Native/PDBFile.h"
 #include "llvm/DebugInfo/PDB/PDBTypes.h"
 
index 303a112..e1a35c6 100644 (file)
@@ -11,7 +11,6 @@
 
 #include "lldb/lldb-types.h"
 #include <cstddef>
-#include <llvm/ADT/Optional.h>
 #include <optional>
 
 namespace lldb_private {
index 3f6fcd2..93156aa 100644 (file)
@@ -11,7 +11,6 @@
 
 #include "lldb/Utility/TraceIntelPTGDBRemotePackets.h"
 #include "lldb/lldb-types.h"
-#include "llvm/ADT/Optional.h"
 #include "llvm/Support/JSON.h"
 #include <intel-pt.h>
 #include <optional>
index 2f30b56..74daecb 100644 (file)
@@ -1159,7 +1159,7 @@ public:
   };
 
   /// Alias for requesting the default scratch TypeSystemClang in GetForTarget.
-  // This isn't constexpr as gtest/llvm::Optional comparison logic is trying
+  // This isn't constexpr as gtest/std::optional comparison logic is trying
   // to get the address of this for pretty-printing.
   static const std::nullopt_t DefaultAST;
 
index a6032a3..b7d9e19 100644 (file)
@@ -20,7 +20,6 @@
 #include "lldb/lldb-types.h"
 
 #include "llvm/ADT/DenseMap.h"
-#include "llvm/ADT/Optional.h"
 
 #include <algorithm>
 #include <chrono>
index 82f5911..8ec38a4 100644 (file)
@@ -12,7 +12,6 @@
 #include <sstream>
 #include <string.h>
 
-#include "llvm/ADT/Optional.h"
 #include "llvm/Support/FormatAdapters.h"
 #include "llvm/Support/Path.h"
 #include "llvm/Support/ScopedPrinter.h"
index 5badd82..ac41161 100644 (file)
@@ -10,7 +10,6 @@
 #include "lldb/Utility/DataExtractor.h"
 #include "lldb/Utility/Endian.h"
 #include "lldb/Utility/StreamString.h"
-#include "llvm/ADT/Optional.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/raw_ostream.h"
 #include "gtest/gtest.h"
@@ -20,7 +19,6 @@
 using namespace lldb;
 using namespace lldb_private;
 using lldb_private::formatters::StringPrinter;
-using llvm::Optional;
 using llvm::StringRef;
 
 #define QUOTE(x) std::string("\"" x "\"")
index eded318..632a7fd 100644 (file)
@@ -19,7 +19,6 @@
 #include "lldb/Utility/DataExtractor.h"
 #include "lldb/Utility/FileSpec.h"
 #include "llvm/ADT/ArrayRef.h"
-#include "llvm/ADT/Optional.h"
 #include "llvm/ObjectYAML/yaml2obj.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/MemoryBuffer.h"
index 09d7131..9a1831d 100644 (file)
@@ -14,7 +14,6 @@
 #include "lldb/Host/ProcessLaunchInfo.h"
 #include "lldb/Utility/ArchSpec.h"
 #include "lldb/Utility/Connection.h"
-#include "llvm/ADT/Optional.h"
 #include "llvm/Support/Casting.h"
 #include "llvm/Support/FormatVariadic.h"
 #include <memory>