[clang-tools-extra] 38d8b1f - [clangd] Replace None with std::nullopt in comments (NFC)

Kazu Hirata via cfe-commits cfe-commits at lists.llvm.org
Sat May 6 00:03:07 PDT 2023


Author: Kazu Hirata
Date: 2023-05-06T00:02:53-07:00
New Revision: 38d8b1f2b4c41cb9b7559db971772885c1ef86ad

URL: https://github.com/llvm/llvm-project/commit/38d8b1f2b4c41cb9b7559db971772885c1ef86ad
DIFF: https://github.com/llvm/llvm-project/commit/38d8b1f2b4c41cb9b7559db971772885c1ef86ad.diff

LOG: [clangd] Replace None with std::nullopt 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: 
    clang-tools-extra/clangd/ClangdServer.h
    clang-tools-extra/clangd/ConfigFragment.h
    clang-tools-extra/clangd/Protocol.h
    clang-tools-extra/clangd/TUScheduler.cpp
    clang-tools-extra/clangd/TUScheduler.h
    clang-tools-extra/clangd/refactor/InsertionPoint.cpp
    clang-tools-extra/clangd/support/Threading.h

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/clangd/ClangdServer.h b/clang-tools-extra/clangd/ClangdServer.h
index f47216a051769..eee79abee7c9d 100644
--- a/clang-tools-extra/clangd/ClangdServer.h
+++ b/clang-tools-extra/clangd/ClangdServer.h
@@ -145,8 +145,9 @@ class ClangdServer {
 
     /// The resource directory is used to find internal headers, overriding
     /// defaults and -resource-dir compiler flag).
-    /// If None, ClangdServer calls CompilerInvocation::GetResourcePath() to
-    /// obtain the standard resource directory.
+    /// If std::nullopt, ClangdServer calls
+    /// CompilerInvocation::GetResourcePath() to obtain the standard resource
+    /// directory.
     std::optional<std::string> ResourceDir;
 
     /// Time to wait after a new file version before computing diagnostics.

diff  --git a/clang-tools-extra/clangd/ConfigFragment.h b/clang-tools-extra/clangd/ConfigFragment.h
index cfce4429532b5..c1bac1019641d 100644
--- a/clang-tools-extra/clangd/ConfigFragment.h
+++ b/clang-tools-extra/clangd/ConfigFragment.h
@@ -167,7 +167,7 @@ struct Fragment {
     /// etc). Valid values are:
     /// - A single path to a directory (absolute, or relative to the fragment)
     /// - Ancestors: search all parent directories (the default)
-    /// - None: do not use a compilation database, just default flags.
+    /// - std::nullopt: do not use a compilation database, just default flags.
     std::optional<Located<std::string>> CompilationDatabase;
   };
   CompileFlagsBlock CompileFlags;
@@ -232,7 +232,7 @@ struct Fragment {
     ///
     /// Valid values are:
     /// - Strict
-    /// - None
+    /// - std::nullopt
     std::optional<Located<std::string>> UnusedIncludes;
 
 
@@ -249,7 +249,7 @@ struct Fragment {
     ///
     /// Valid values are:
     /// - Strict
-    /// - None
+    /// - std::nullopt
     std::optional<Located<std::string>> MissingIncludes;
 
     /// Controls IncludeCleaner diagnostics.

diff  --git a/clang-tools-extra/clangd/Protocol.h b/clang-tools-extra/clangd/Protocol.h
index 1d6fccff6ea4d..511eae1940c6e 100644
--- a/clang-tools-extra/clangd/Protocol.h
+++ b/clang-tools-extra/clangd/Protocol.h
@@ -1492,7 +1492,7 @@ struct TypeHierarchyItem {
   /// Used to resolve a client provided item back.
   struct ResolveParams {
     SymbolID symbolID;
-    /// None means parents aren't resolved and empty is no parents.
+    /// std::nullopt means parents aren't resolved and empty is no parents.
     std::optional<std::vector<ResolveParams>> parents;
   };
   /// A data entry field that is preserved between a type hierarchy prepare and
@@ -1618,8 +1618,8 @@ struct InlayHintsParams {
 
   /// The visible document range for which inlay hints should be computed.
   ///
-  /// None is a clangd extension, which hints for computing hints on the whole
-  /// file.
+  /// std::nullopt is a clangd extension, which hints for computing hints on the
+  /// whole file.
   std::optional<Range> range;
 };
 bool fromJSON(const llvm::json::Value &, InlayHintsParams &, llvm::json::Path);

diff  --git a/clang-tools-extra/clangd/TUScheduler.cpp b/clang-tools-extra/clangd/TUScheduler.cpp
index 9b366cdd43eb2..126937ff49e90 100644
--- a/clang-tools-extra/clangd/TUScheduler.cpp
+++ b/clang-tools-extra/clangd/TUScheduler.cpp
@@ -740,8 +740,8 @@ class ASTWorker {
   mutable std::condition_variable RequestsCV;
   std::shared_ptr<const ASTSignals> LatestASTSignals; /* GUARDED_BY(Mutex) */
   /// Latest build preamble for current TU.
-  /// None means no builds yet, null means there was an error while building.
-  /// Only written by ASTWorker's thread.
+  /// std::nullopt means no builds yet, null means there was an error while
+  /// building. Only written by ASTWorker's thread.
   std::optional<std::shared_ptr<const PreambleData>> LatestPreamble;
   std::deque<Request> PreambleRequests; /* GUARDED_BY(Mutex) */
   /// Signaled whenever LatestPreamble changes state or there's a new

diff  --git a/clang-tools-extra/clangd/TUScheduler.h b/clang-tools-extra/clangd/TUScheduler.h
index b82bbde3bd4db..8c52ec951ba5f 100644
--- a/clang-tools-extra/clangd/TUScheduler.h
+++ b/clang-tools-extra/clangd/TUScheduler.h
@@ -368,8 +368,8 @@ class TUScheduler {
   llvm::StringMap<std::unique_ptr<FileData>> Files;
   std::unique_ptr<ASTCache> IdleASTs;
   std::unique_ptr<HeaderIncluderCache> HeaderIncluders;
-  // None when running tasks synchronously and non-None when running tasks
-  // asynchronously.
+  // std::nullopt when running tasks synchronously and non-std::nullopt when
+  // running tasks asynchronously.
   std::optional<AsyncTaskRunner> PreambleTasks;
   std::optional<AsyncTaskRunner> WorkerThreads;
   // Used to create contexts for operations that are not bound to a particular

diff  --git a/clang-tools-extra/clangd/refactor/InsertionPoint.cpp b/clang-tools-extra/clangd/refactor/InsertionPoint.cpp
index 7f042c0cacb92..4b04021a5bd46 100644
--- a/clang-tools-extra/clangd/refactor/InsertionPoint.cpp
+++ b/clang-tools-extra/clangd/refactor/InsertionPoint.cpp
@@ -21,7 +21,7 @@ namespace {
 
 // Choose the decl to insert before, according to an anchor.
 // Nullptr means insert at end of DC.
-// None means no valid place to insert.
+// std::nullopt means no valid place to insert.
 std::optional<const Decl *> insertionDecl(const DeclContext &DC,
                                           const Anchor &A) {
   bool LastMatched = false;

diff  --git a/clang-tools-extra/clangd/support/Threading.h b/clang-tools-extra/clangd/support/Threading.h
index 1be27820513e5..78ab54101fe4f 100644
--- a/clang-tools-extra/clangd/support/Threading.h
+++ b/clang-tools-extra/clangd/support/Threading.h
@@ -70,7 +70,7 @@ class Deadline {
   std::chrono::steady_clock::time_point Time;
 };
 
-/// Makes a deadline from a timeout in seconds. None means wait forever.
+/// Makes a deadline from a timeout in seconds. std::nullopt means wait forever.
 Deadline timeoutSeconds(std::optional<double> Seconds);
 /// Wait once on CV for the specified duration.
 void wait(std::unique_lock<std::mutex> &Lock, std::condition_variable &CV,


        


More information about the cfe-commits mailing list