diff options
author | Kazu Hirata <kazu@google.com> | 2022-12-04 17:40:28 -0800 |
---|---|---|
committer | Kazu Hirata <kazu@google.com> | 2022-12-04 17:40:28 -0800 |
commit | 7c2b77368f006f7d4a92b0786adc3f38969d9e2d (patch) | |
tree | 0de10d89b3f134931ddff3507ba246923fb62580 | |
parent | 9f252e5567041bcafe20980263381e4ad3c8986e (diff) | |
download | llvm-7c2b77368f006f7d4a92b0786adc3f38969d9e2d.zip llvm-7c2b77368f006f7d4a92b0786adc3f38969d9e2d.tar.gz llvm-7c2b77368f006f7d4a92b0786adc3f38969d9e2d.tar.bz2 |
[clang-tools-extra] Use std::nullopt 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
-rw-r--r-- | clang-tools-extra/clang-tidy/utils/IncludeSorter.h | 5 | ||||
-rw-r--r-- | clang-tools-extra/clangd/AST.cpp | 4 | ||||
-rw-r--r-- | clang-tools-extra/clangd/Headers.h | 2 | ||||
-rw-r--r-- | clang-tools-extra/clangd/IncludeFixer.h | 2 | ||||
-rw-r--r-- | clang-tools-extra/clangd/index/dex/PostingList.cpp | 2 | ||||
-rw-r--r-- | clang-tools-extra/clangd/refactor/Rename.h | 2 | ||||
-rw-r--r-- | clang-tools-extra/clangd/refactor/tweaks/DefineOutline.cpp | 2 | ||||
-rw-r--r-- | clang-tools-extra/clangd/unittests/tweaks/TweakTesting.cpp | 2 | ||||
-rw-r--r-- | clang-tools-extra/pseudo/include/clang-pseudo/grammar/LRTable.h | 4 | ||||
-rw-r--r-- | clang-tools-extra/pseudo/lib/DirectiveTree.cpp | 3 |
10 files changed, 15 insertions, 13 deletions
diff --git a/clang-tools-extra/clang-tidy/utils/IncludeSorter.h b/clang-tools-extra/clang-tidy/utils/IncludeSorter.h index ecde60d..ac76fcd 100644 --- a/clang-tools-extra/clang-tidy/utils/IncludeSorter.h +++ b/clang-tools-extra/clang-tidy/utils/IncludeSorter.h @@ -44,8 +44,9 @@ public: void addInclude(StringRef FileName, bool IsAngled, SourceLocation HashLocation, SourceLocation EndLocation); - /// Creates a quoted inclusion directive in the right sort order. Returns None - /// on error or if header inclusion directive for header already exists. + /// Creates a quoted inclusion directive in the right sort order. Returns + /// std::nullopt on error or if header inclusion directive for header already + /// exists. Optional<FixItHint> createIncludeInsertion(StringRef FileName, bool IsAngled); private: diff --git a/clang-tools-extra/clangd/AST.cpp b/clang-tools-extra/clangd/AST.cpp index 92afa98..a0b52ad 100644 --- a/clang-tools-extra/clangd/AST.cpp +++ b/clang-tools-extra/clangd/AST.cpp @@ -63,8 +63,8 @@ getTemplateSpecializationArgLocs(const NamedDecl &ND) { if (auto *Args = Var->getTemplateArgsInfo()) return Args->arguments(); } - // We return None for ClassTemplateSpecializationDecls because it does not - // contain TemplateArgumentLoc information. + // We return std::nullopt for ClassTemplateSpecializationDecls because it does + // not contain TemplateArgumentLoc information. return std::nullopt; } diff --git a/clang-tools-extra/clangd/Headers.h b/clang-tools-extra/clangd/Headers.h index ff3f063..72a75de 100644 --- a/clang-tools-extra/clangd/Headers.h +++ b/clang-tools-extra/clangd/Headers.h @@ -238,7 +238,7 @@ public: llvm::StringRef IncludingFile) const; /// Calculates an edit that inserts \p VerbatimHeader into code. If the header - /// is already included, this returns None. + /// is already included, this returns std::nullopt. llvm::Optional<TextEdit> insert(llvm::StringRef VerbatimHeader) const; private: diff --git a/clang-tools-extra/clangd/IncludeFixer.h b/clang-tools-extra/clangd/IncludeFixer.h index 2bb6c22..0756ee7 100644 --- a/clang-tools-extra/clangd/IncludeFixer.h +++ b/clang-tools-extra/clangd/IncludeFixer.h @@ -88,7 +88,7 @@ private: // index requests. mutable llvm::StringMap<SymbolSlab> FuzzyFindCache; mutable llvm::DenseMap<SymbolID, SymbolSlab> LookupCache; - // Returns None if the number of index requests has reached the limit. + // Returns std::nullopt if the number of index requests has reached the limit. llvm::Optional<const SymbolSlab *> fuzzyFindCached(const FuzzyFindRequest &Req) const; llvm::Optional<const SymbolSlab *> lookupCached(const SymbolID &ID) const; diff --git a/clang-tools-extra/clangd/index/dex/PostingList.cpp b/clang-tools-extra/clangd/index/dex/PostingList.cpp index c1bd338..06511cf 100644 --- a/clang-tools-extra/clangd/index/dex/PostingList.cpp +++ b/clang-tools-extra/clangd/index/dex/PostingList.cpp @@ -181,7 +181,7 @@ std::vector<Chunk> encodeStream(llvm::ArrayRef<DocID> Documents) { } /// Reads variable length DocID from the buffer and updates the buffer size. If -/// the stream is terminated, return None. +/// the stream is terminated, return std::nullopt. llvm::Optional<DocID> readVByte(llvm::ArrayRef<uint8_t> &Bytes) { if (Bytes.front() == 0 || Bytes.empty()) return std::nullopt; diff --git a/clang-tools-extra/clangd/refactor/Rename.h b/clang-tools-extra/clangd/refactor/Rename.h index 036594e..c10aa5a 100644 --- a/clang-tools-extra/clangd/refactor/Rename.h +++ b/clang-tools-extra/clangd/refactor/Rename.h @@ -88,7 +88,7 @@ adjustRenameRanges(llvm::StringRef DraftCode, llvm::StringRef Identifier, std::vector<Range> Indexed, const LangOptions &LangOpts); /// Calculates the lexed occurrences that the given indexed occurrences map to. -/// Returns None if we don't find a mapping. +/// Returns std::nullopt if we don't find a mapping. /// /// Exposed for testing only. /// diff --git a/clang-tools-extra/clangd/refactor/tweaks/DefineOutline.cpp b/clang-tools-extra/clangd/refactor/tweaks/DefineOutline.cpp index 93c1e3f..e07a54b 100644 --- a/clang-tools-extra/clangd/refactor/tweaks/DefineOutline.cpp +++ b/clang-tools-extra/clangd/refactor/tweaks/DefineOutline.cpp @@ -69,7 +69,7 @@ llvm::Optional<Path> getSourceFile(llvm::StringRef FileName, // Synthesize a DeclContext for TargetNS from CurContext. TargetNS must be empty // for global namespace, and endwith "::" otherwise. -// Returns None if TargetNS is not a prefix of CurContext. +// Returns std::nullopt if TargetNS is not a prefix of CurContext. llvm::Optional<const DeclContext *> findContextForNS(llvm::StringRef TargetNS, const DeclContext *CurContext) { assert(TargetNS.empty() || TargetNS.endswith("::")); diff --git a/clang-tools-extra/clangd/unittests/tweaks/TweakTesting.cpp b/clang-tools-extra/clangd/unittests/tweaks/TweakTesting.cpp index 726e2b8..59885ce 100644 --- a/clang-tools-extra/clangd/unittests/tweaks/TweakTesting.cpp +++ b/clang-tools-extra/clangd/unittests/tweaks/TweakTesting.cpp @@ -59,7 +59,7 @@ llvm::Annotations::Range rangeOrPoint(const llvm::Annotations &A) { } // Prepare and apply the specified tweak based on the selection in Input. -// Returns None if and only if prepare() failed. +// Returns std::nullopt if and only if prepare() failed. llvm::Optional<llvm::Expected<Tweak::Effect>> applyTweak(ParsedAST &AST, llvm::Annotations::Range Range, StringRef TweakID, const SymbolIndex *Index, llvm::vfs::FileSystem *FS) { diff --git a/clang-tools-extra/pseudo/include/clang-pseudo/grammar/LRTable.h b/clang-tools-extra/pseudo/include/clang-pseudo/grammar/LRTable.h index ac911be..f704ae4 100644 --- a/clang-tools-extra/pseudo/include/clang-pseudo/grammar/LRTable.h +++ b/clang-tools-extra/pseudo/include/clang-pseudo/grammar/LRTable.h @@ -74,14 +74,14 @@ public: // Returns the state after we reduce a nonterminal. // Expected to be called by LR parsers. - // If the nonterminal is invalid here, returns None. + // If the nonterminal is invalid here, returns std::nullopt. llvm::Optional<StateID> getGoToState(StateID State, SymbolID Nonterminal) const { return Gotos.get(gotoIndex(State, Nonterminal, numStates())); } // Returns the state after we shift a terminal. // Expected to be called by LR parsers. - // If the terminal is invalid here, returns None. + // If the terminal is invalid here, returns std::nullopt. llvm::Optional<StateID> getShiftState(StateID State, SymbolID Terminal) const { return Shifts.get(shiftIndex(State, Terminal, numStates())); diff --git a/clang-tools-extra/pseudo/lib/DirectiveTree.cpp b/clang-tools-extra/pseudo/lib/DirectiveTree.cpp index 2d0199c..b479ecf 100644 --- a/clang-tools-extra/pseudo/lib/DirectiveTree.cpp +++ b/clang-tools-extra/pseudo/lib/DirectiveTree.cpp @@ -45,7 +45,8 @@ private: // Parses tokens starting at Tok into Tree. // If we reach an End or Else directive that ends Tree, returns it. - // If TopLevel is true, then we do not expect End and always return None. + // If TopLevel is true, then we do not expect End and always return + // std::nullopt. llvm::Optional<DirectiveTree::Directive> parse(DirectiveTree *Tree, bool TopLevel) { auto StartsDirective = |