[clang-tools-extra] 8310bec - [clangd] Migrate uses of operator<<(raw_ostream &OS, const Optional<T> &O) to std::optional
Fangrui Song via cfe-commits
cfe-commits at lists.llvm.org
Fri Dec 16 11:46:06 PST 2022
Author: Fangrui Song
Date: 2022-12-16T19:46:01Z
New Revision: 8310bec5687c0396d5b230203cf9debdc489710f
URL: https://github.com/llvm/llvm-project/commit/8310bec5687c0396d5b230203cf9debdc489710f
DIFF: https://github.com/llvm/llvm-project/commit/8310bec5687c0396d5b230203cf9debdc489710f.diff
LOG: [clangd] Migrate uses of operator<<(raw_ostream &OS, const Optional<T> &O) to std::optional
Added:
Modified:
clang-tools-extra/clangd/Hover.h
clang-tools-extra/clangd/unittests/XRefsTests.cpp
Removed:
################################################################################
diff --git a/clang-tools-extra/clangd/Hover.h b/clang-tools-extra/clangd/Hover.h
index 4f9950d7bd061..4565e6446db16 100644
--- a/clang-tools-extra/clangd/Hover.h
+++ b/clang-tools-extra/clangd/Hover.h
@@ -45,7 +45,7 @@ struct HoverInfo {
/// TemplateParameters), might be std::nullopt for macro parameters.
llvm::Optional<PrintedType> Type;
/// std::nullopt for unnamed parameters.
- llvm::Optional<std::string> Name;
+ std::optional<std::string> Name;
/// std::nullopt if no default is provided.
llvm::Optional<std::string> Default;
};
diff --git a/clang-tools-extra/clangd/unittests/XRefsTests.cpp b/clang-tools-extra/clangd/unittests/XRefsTests.cpp
index f91c469ddc9b6..0f06a22ee6c97 100644
--- a/clang-tools-extra/clangd/unittests/XRefsTests.cpp
+++ b/clang-tools-extra/clangd/unittests/XRefsTests.cpp
@@ -288,11 +288,11 @@ MATCHER_P3(sym, Name, Decl, DefOrNone, "") {
return false;
}
if (!Def && arg.Definition) {
- *result_listener << "Definition is " << llvm::to_string(arg.Definition);
+ *result_listener << "Definition is " << llvm::to_string(*arg.Definition);
return false;
}
if (arg.Definition->range != *Def) {
- *result_listener << "Definition is " << llvm::to_string(arg.Definition);
+ *result_listener << "Definition is " << llvm::to_string(*arg.Definition);
return false;
}
return true;
More information about the cfe-commits
mailing list