Author: Kazu Hirata Date: 2022-12-10T17:06:43-08:00 New Revision: 8b5c302efb26634126bb57c20727a13ec2237558
URL: https://github.com/llvm/llvm-project/commit/8b5c302efb26634126bb57c20727a13ec2237558 DIFF: https://github.com/llvm/llvm-project/commit/8b5c302efb26634126bb57c20727a13ec2237558.diff LOG: [lldb] Use std::optional instead of None in comments (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: lldb/include/lldb/Target/TraceCursor.h lldb/include/lldb/Target/UnixSignals.h lldb/include/lldb/Utility/Predicate.h lldb/include/lldb/Utility/TraceGDBRemotePackets.h lldb/source/Plugins/ExpressionParser/Clang/CppModuleConfiguration.cpp lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.cpp lldb/source/Plugins/Process/Linux/IntelPTProcessTrace.h lldb/source/Plugins/Trace/intel-pt/LibiptDecoder.h lldb/source/Plugins/Trace/intel-pt/TraceCursorIntelPT.h lldb/source/Plugins/Trace/intel-pt/TraceIntelPTBundleSaver.cpp lldb/source/Plugins/Trace/intel-pt/TraceIntelPTMultiCpuDecoder.h lldb/source/Plugins/TraceExporter/common/TraceHTR.h lldb/source/Target/TraceDumper.cpp Removed: ################################################################################ diff --git a/lldb/include/lldb/Target/TraceCursor.h b/lldb/include/lldb/Target/TraceCursor.h index ee5014f375beb..dfb113fa8b900 100644 --- a/lldb/include/lldb/Target/TraceCursor.h +++ b/lldb/include/lldb/Target/TraceCursor.h @@ -278,7 +278,8 @@ class TraceCursor { /// /// \return /// A string representing some metadata associated with a - /// \a eTraceEventSyncPoint event. \b None if no metadata is available. + /// \a eTraceEventSyncPoint event. \b std::nullopt if no metadata is + /// available. virtual llvm::Optional<std::string> GetSyncPointMetadata() const = 0; /// \} diff --git a/lldb/include/lldb/Target/UnixSignals.h b/lldb/include/lldb/Target/UnixSignals.h index 34f4e30d13505..6646078d78352 100644 --- a/lldb/include/lldb/Target/UnixSignals.h +++ b/lldb/include/lldb/Target/UnixSignals.h @@ -101,8 +101,8 @@ class UnixSignals { uint64_t GetVersion() const; // Returns a vector of signals that meet criteria provided in arguments. Each - // should_[suppress|stop|notify] flag can be None - no filtering by this - // flag true - only signals that have it set to true are returned false - + // should_[suppress|stop|notify] flag can be std::nullopt - no filtering by + // this flag true - only signals that have it set to true are returned false - // only signals that have it set to true are returned std::vector<int32_t> GetFilteredSignals(llvm::Optional<bool> should_suppress, llvm::Optional<bool> should_stop, diff --git a/lldb/include/lldb/Utility/Predicate.h b/lldb/include/lldb/Utility/Predicate.h index 3496aff8ee95c..9b65ec1a0094e 100644 --- a/lldb/include/lldb/Utility/Predicate.h +++ b/lldb/include/lldb/Utility/Predicate.h @@ -116,7 +116,8 @@ template <class T> class Predicate { /// How long to wait for the condition to hold. /// /// \return - /// m_value if Cond(m_value) is true, None otherwise (timeout occurred). + /// m_value if Cond(m_value) is true, std::nullopt otherwise (timeout + /// occurred). template <typename C> llvm::Optional<T> WaitFor(C Cond, const Timeout<std::micro> &timeout) { std::unique_lock<std::mutex> lock(m_mutex); @@ -177,7 +178,8 @@ template <class T> class Predicate { /// How long to wait for the condition to hold. /// /// \return - /// m_value if m_value != value, None otherwise (timeout occurred). + /// m_value if m_value != value, std::nullopt otherwise (timeout + /// occurred). llvm::Optional<T> WaitForValueNotEqualTo(T value, const Timeout<std::micro> &timeout = std::nullopt) { diff --git a/lldb/include/lldb/Utility/TraceGDBRemotePackets.h b/lldb/include/lldb/Utility/TraceGDBRemotePackets.h index bfa68219ab4ef..1b35b051e438e 100644 --- a/lldb/include/lldb/Utility/TraceGDBRemotePackets.h +++ b/lldb/include/lldb/Utility/TraceGDBRemotePackets.h @@ -49,7 +49,7 @@ struct TraceStartRequest { llvm::Optional<std::vector<lldb::tid_t>> tids; /// \return - /// \b true if \a tids is \a None, i.e. whole process tracing. + /// \b true if \a tids is \a std::nullopt, i.e. whole process tracing. bool IsProcessTracing() const; }; diff --git a/lldb/source/Plugins/ExpressionParser/Clang/CppModuleConfiguration.cpp b/lldb/source/Plugins/ExpressionParser/Clang/CppModuleConfiguration.cpp index 65ad74862467a..36ecc592547e9 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/CppModuleConfiguration.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/CppModuleConfiguration.cpp @@ -46,7 +46,7 @@ getTargetIncludePaths(const llvm::Triple &triple) { } /// Returns the include path matching the given pattern for the given file -/// path (or None if the path doesn't match the pattern). +/// path (or std::nullopt if the path doesn't match the pattern). static llvm::Optional<llvm::StringRef> guessIncludePath(llvm::StringRef path_to_file, llvm::StringRef pattern) { if (pattern.empty()) diff --git a/lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.cpp b/lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.cpp index 96d2c3fc1b004..b3fefb2f481fa 100644 --- a/lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.cpp +++ b/lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.cpp @@ -32,7 +32,7 @@ LLDB_PLUGIN_DEFINE_ADV(EmulateInstructionRISCV, InstructionRISCV) namespace lldb_private { /// Returns all values wrapped in Optional, or std::nullopt if any of the values -/// is None. +/// is std::nullopt. template <typename... Ts> static llvm::Optional<std::tuple<Ts...>> zipOpt(llvm::Optional<Ts> &&...ts) { if ((ts.has_value() && ...)) diff --git a/lldb/source/Plugins/Process/Linux/IntelPTProcessTrace.h b/lldb/source/Plugins/Process/Linux/IntelPTProcessTrace.h index 2fa6d8576c9a0..bc2ef8cffc5d8 100644 --- a/lldb/source/Plugins/Process/Linux/IntelPTProcessTrace.h +++ b/lldb/source/Plugins/Process/Linux/IntelPTProcessTrace.h @@ -37,9 +37,9 @@ class IntelPTProcessTrace { virtual llvm::Error TraceStop(lldb::tid_t tid) = 0; /// \return - /// \b None if this instance doesn't support the requested data, an \a - /// llvm::Error if this isntance supports it but fails at fetching it, and - /// \b Error::success() otherwise. + /// \b std::nullopt if this instance doesn't support the requested data, an + /// \a llvm::Error if this isntance supports it but fails at fetching it, + /// and \b Error::success() otherwise. virtual llvm::Expected<llvm::Optional<std::vector<uint8_t>>> TryGetBinaryData(const TraceGetBinaryDataRequest &request) = 0; }; diff --git a/lldb/source/Plugins/Trace/intel-pt/LibiptDecoder.h b/lldb/source/Plugins/Trace/intel-pt/LibiptDecoder.h index 78fc2c7a96ea7..ac79d1848452d 100644 --- a/lldb/source/Plugins/Trace/intel-pt/LibiptDecoder.h +++ b/lldb/source/Plugins/Trace/intel-pt/LibiptDecoder.h @@ -29,9 +29,9 @@ struct PSBBlock { /// Size in bytes of this block uint64_t size; /// The first ip for this PSB block. - /// This is \a None if tracing was disabled when the PSB block was emitted. - /// This means that eventually there's be an enablement event that will come - /// with an ip. + /// This is \a std::nullopt if tracing was disabled when the PSB block was + /// emitted. This means that eventually there's be an enablement event that + /// will come with an ip. llvm::Optional<lldb::addr_t> starting_ip; }; diff --git a/lldb/source/Plugins/Trace/intel-pt/TraceCursorIntelPT.h b/lldb/source/Plugins/Trace/intel-pt/TraceCursorIntelPT.h index e1159a06c54d7..984d7632d45b6 100644 --- a/lldb/source/Plugins/Trace/intel-pt/TraceCursorIntelPT.h +++ b/lldb/source/Plugins/Trace/intel-pt/TraceCursorIntelPT.h @@ -69,17 +69,17 @@ class TraceCursorIntelPT : public TraceCursor { /// Timing information and cached values. /// \{ - /// TSC -> nanos conversion utility. \a None if not available at all. + /// TSC -> nanos conversion utility. \a std::nullopt if not available at all. llvm::Optional<LinuxPerfZeroTscConversion> m_tsc_conversion; - /// Lowest nanoseconds timestamp seen in any thread trace, \a None if not - /// available at all. + /// Lowest nanoseconds timestamp seen in any thread trace, \a std::nullopt if + /// not available at all. llvm::Optional<uint64_t> m_beginning_of_time_nanos; /// Range of trace items with the same TSC that includes the current trace - /// item, \a None if not calculated or not available. + /// item, \a std::nullopt if not calculated or not available. llvm::Optional<DecodedThread::TSCRange> mutable m_tsc_range; bool mutable m_tsc_range_calculated = false; /// Range of trace items with the same non-interpolated timestamps in - /// nanoseconds that includes the current trace item, \a None if not + /// nanoseconds that includes the current trace item, \a std::nullopt if not /// calculated or not available. llvm::Optional<DecodedThread::NanosecondsRange> mutable m_nanoseconds_range; bool mutable m_nanoseconds_range_calculated = false; diff --git a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTBundleSaver.cpp b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTBundleSaver.cpp index 653cdde203d45..731e4d15957e9 100644 --- a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTBundleSaver.cpp +++ b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTBundleSaver.cpp @@ -130,9 +130,9 @@ BuildThreadsSection(Process &process, FileSpec directory) { } /// \return -/// an \a llvm::Error in case of failures, \a None if the trace is not written -/// to disk because the trace is empty and the \p compact flag is present, or -/// the FileSpec of the trace file on disk. +/// an \a llvm::Error in case of failures, \a std::nullopt if the trace is not +/// written to disk because the trace is empty and the \p compact flag is +/// present, or the FileSpec of the trace file on disk. static Expected<Optional<FileSpec>> WriteContextSwitchTrace(TraceIntelPT &trace_ipt, lldb::cpu_id_t cpu_id, const FileSpec &cpus_dir, bool compact) { diff --git a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTMultiCpuDecoder.h b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTMultiCpuDecoder.h index 00657abe4bd0f..f7b3e1abd91a6 100644 --- a/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTMultiCpuDecoder.h +++ b/lldb/source/Plugins/Trace/intel-pt/TraceIntelPTMultiCpuDecoder.h @@ -96,8 +96,8 @@ class TraceIntelPTMultiCpuDecoder { llvm::DenseMap<lldb::tid_t, std::vector<IntelPTThreadContinousExecution>>> m_continuous_executions_per_thread; llvm::DenseMap<lldb::tid_t, DecodedThreadSP> m_decoded_threads; - /// This variable will be non-None if a severe error happened during the setup - /// of the decoder and we don't want decoding to be reattempted. + /// This variable will not be std::nullopt if a severe error happened during + /// the setup of the decoder and we don't want decoding to be reattempted. llvm::Optional<std::string> m_setup_error; uint64_t m_unattributed_psb_blocks = 0; uint64_t m_total_psb_blocks = 0; diff --git a/lldb/source/Plugins/TraceExporter/common/TraceHTR.h b/lldb/source/Plugins/TraceExporter/common/TraceHTR.h index 3f5d6f237afba..75f3bd302de6e 100644 --- a/lldb/source/Plugins/TraceExporter/common/TraceHTR.h +++ b/lldb/source/Plugins/TraceExporter/common/TraceHTR.h @@ -57,7 +57,7 @@ class HTRBlockMetadata { /// /// \return /// The name of the function that is called the most from this block or - /// None if no function is called from this block. + /// std::nullopt if no function is called from this block. llvm::Optional<llvm::StringRef> GetMostFrequentlyCalledFunction() const; /// Get the load address of the first instruction in the block. @@ -233,8 +233,8 @@ class HTRInstructionLayer : public IHTRLayer { // most instructions don't contain useful metadata // This map contains the load address of all the call instructions. - // load address maps to the name of the function it calls (None if function - // name can't be determined) + // load address maps to the name of the function it calls (std::nullopt if + // function name can't be determined) std::unordered_map<lldb::addr_t, llvm::Optional<ConstString>> m_call_isns; }; diff --git a/lldb/source/Target/TraceDumper.cpp b/lldb/source/Target/TraceDumper.cpp index 374c8ad922650..1f581011959e0 100644 --- a/lldb/source/Target/TraceDumper.cpp +++ b/lldb/source/Target/TraceDumper.cpp @@ -19,7 +19,7 @@ using namespace lldb_private; using namespace llvm; /// \return -/// The given string or \b None if it's empty. +/// The given string or \b std::nullopt if it's empty. static Optional<const char *> ToOptionalString(const char *s) { if (!s) return std::nullopt; _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits