[clang-tools-extra] 2402c46 - [clang-tools-extra] Use std::nullopt instead of llvm::None (NFC)

Kazu Hirata via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 5 23:55:28 PST 2022


Author: Kazu Hirata
Date: 2022-12-05T23:55:23-08:00
New Revision: 2402c46b7155d04dc2a1ec618294fc6bb70f3e18

URL: https://github.com/llvm/llvm-project/commit/2402c46b7155d04dc2a1ec618294fc6bb70f3e18
DIFF: https://github.com/llvm/llvm-project/commit/2402c46b7155d04dc2a1ec618294fc6bb70f3e18.diff

LOG: [clang-tools-extra] Use std::nullopt instead of llvm::None (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/clang-tidy/utils/IncludeInserter.h
    clang-tools-extra/clang-tidy/utils/NamespaceAliaser.h
    clang-tools-extra/clang-tidy/utils/UsingInserter.h
    clang-tools-extra/clangd/ConfigCompile.cpp
    clang-tools-extra/clangd/DraftStore.h
    clang-tools-extra/clangd/TUScheduler.cpp
    clang-tools-extra/clangd/index/remote/server/Server.cpp

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/clang-tidy/utils/IncludeInserter.h b/clang-tools-extra/clang-tidy/utils/IncludeInserter.h
index c5649177b2286..8e7c5f76ff80f 100644
--- a/clang-tools-extra/clang-tidy/utils/IncludeInserter.h
+++ b/clang-tools-extra/clang-tidy/utils/IncludeInserter.h
@@ -69,7 +69,7 @@ class IncludeInserter {
   /// Creates a \p Header inclusion directive fixit in the File \p FileID.
   /// When \p Header is enclosed in angle brackets, uses angle brackets in the
   /// inclusion directive, otherwise uses quotes.
-  /// Returns ``llvm::None`` on error or if the inclusion directive already
+  /// Returns ``std::nullopt`` on error or if the inclusion directive already
   /// exists.
   llvm::Optional<FixItHint> createIncludeInsertion(FileID FileID,
                                                    llvm::StringRef Header);
@@ -77,7 +77,7 @@ class IncludeInserter {
   /// Creates a \p Header inclusion directive fixit in the main file.
   /// When \p Header is enclosed in angle brackets, uses angle brackets in the
   /// inclusion directive, otherwise uses quotes.
-  /// Returns ``llvm::None`` on error or if the inclusion directive already
+  /// Returns ``std::nullopt`` on error or if the inclusion directive already
   /// exists.
   llvm::Optional<FixItHint>
   createMainFileIncludeInsertion(llvm::StringRef Header);

diff  --git a/clang-tools-extra/clang-tidy/utils/NamespaceAliaser.h b/clang-tools-extra/clang-tidy/utils/NamespaceAliaser.h
index ab1b9781c0d22..177b0980c7459 100644
--- a/clang-tools-extra/clang-tidy/utils/NamespaceAliaser.h
+++ b/clang-tools-extra/clang-tidy/utils/NamespaceAliaser.h
@@ -27,7 +27,7 @@ class NamespaceAliaser {
   explicit NamespaceAliaser(const SourceManager &SourceMgr);
   // Adds a namespace alias for \p Namespace valid near \p
   // Statement. Picks the first available name from \p Abbreviations.
-  // Returns ``llvm::None`` if an alias already exists or there is an error.
+  // Returns ``std::nullopt`` if an alias already exists or there is an error.
   llvm::Optional<FixItHint>
   createAlias(ASTContext &Context, const Stmt &Statement,
               llvm::StringRef Namespace,

diff  --git a/clang-tools-extra/clang-tidy/utils/UsingInserter.h b/clang-tools-extra/clang-tidy/utils/UsingInserter.h
index 9d3c60ca59d07..dfdf5ed3488c9 100644
--- a/clang-tools-extra/clang-tidy/utils/UsingInserter.h
+++ b/clang-tools-extra/clang-tidy/utils/UsingInserter.h
@@ -26,7 +26,7 @@ class UsingInserter {
 public:
   UsingInserter(const SourceManager &SourceMgr);
 
-  // Creates a \p using declaration fixit. Returns ``llvm::None`` on error
+  // Creates a \p using declaration fixit. Returns ``std::nullopt`` on error
   // or if the using declaration already exists.
   llvm::Optional<FixItHint>
   createUsingDeclaration(ASTContext &Context, const Stmt &Statement,

diff  --git a/clang-tools-extra/clangd/ConfigCompile.cpp b/clang-tools-extra/clangd/ConfigCompile.cpp
index a663e5a04f956..bdcafd1449421 100644
--- a/clang-tools-extra/clangd/ConfigCompile.cpp
+++ b/clang-tools-extra/clangd/ConfigCompile.cpp
@@ -171,7 +171,7 @@ struct FragmentCompiler {
   };
 
   // Attempt to parse a specified string into an enum.
-  // Yields llvm::None and produces a diagnostic on failure.
+  // Yields std::nullopt and produces a diagnostic on failure.
   //
   // Optional<T> Value = compileEnum<En>("Foo", Frag.Foo)
   //    .map("Foo", Enum::Foo)

diff  --git a/clang-tools-extra/clangd/DraftStore.h b/clang-tools-extra/clangd/DraftStore.h
index 0bc860718fc73..9a46926214968 100644
--- a/clang-tools-extra/clangd/DraftStore.h
+++ b/clang-tools-extra/clangd/DraftStore.h
@@ -32,7 +32,7 @@ class DraftStore {
   };
 
   /// \return Contents of the stored document.
-  /// For untracked files, a llvm::None is returned.
+  /// For untracked files, a std::nullopt is returned.
   llvm::Optional<Draft> getDraft(PathRef File) const;
 
   /// \return List of names of the drafts in this store.

diff  --git a/clang-tools-extra/clangd/TUScheduler.cpp b/clang-tools-extra/clangd/TUScheduler.cpp
index 9bd48825cf077..87e5c37259cb9 100644
--- a/clang-tools-extra/clangd/TUScheduler.cpp
+++ b/clang-tools-extra/clangd/TUScheduler.cpp
@@ -180,7 +180,7 @@ class TUScheduler::ASTCache {
     ForCleanup.reset();
   }
 
-  /// Returns the cached value for \p K, or llvm::None if the value is not in
+  /// Returns the cached value for \p K, or std::nullopt if the value is not in
   /// the cache anymore. If nullptr was cached for \p K, this function will
   /// return a null unique_ptr wrapped into an optional.
   /// If \p AccessMetric is set records whether there was a hit or miss.

diff  --git a/clang-tools-extra/clangd/index/remote/server/Server.cpp b/clang-tools-extra/clangd/index/remote/server/Server.cpp
index ee1d74fe9cb30..00988a98bf68a 100644
--- a/clang-tools-extra/clangd/index/remote/server/Server.cpp
+++ b/clang-tools-extra/clangd/index/remote/server/Server.cpp
@@ -527,7 +527,7 @@ int main(int argc, char *argv[]) {
     TracingSession.emplace(*Tracer);
 
   clang::clangd::RealThreadsafeFS TFS;
-  auto FS = TFS.view(llvm::None);
+  auto FS = TFS.view(std::nullopt);
   auto Status = FS->status(IndexPath);
   if (!Status) {
     elog("{0} does not exist.", IndexPath);


        


More information about the cfe-commits mailing list