[clang-tools-extra] [clangd] Migrate away from std::nullopt (NFC) (PR #145841)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 25 22:56:58 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clangd
Author: Kazu Hirata (kazutakahirata)
<details>
<summary>Changes</summary>
ArrayRef has a constructor that accepts std::nullopt. This
constructor dates back to the days when we still had llvm::Optional.
Since the use of std::nullopt outside the context of std::optional is
kind of abuse and not intuitive to new comers, I would like to move
away from the constructor and eventually remove it.
This patch replaces std::nullopt with {}.
---
Full diff: https://github.com/llvm/llvm-project/pull/145841.diff
1 Files Affected:
- (modified) clang-tools-extra/clangd/AST.cpp (+1-1)
``````````diff
diff --git a/clang-tools-extra/clangd/AST.cpp b/clang-tools-extra/clangd/AST.cpp
index 3b991e5e9013f..e274236527817 100644
--- a/clang-tools-extra/clangd/AST.cpp
+++ b/clang-tools-extra/clangd/AST.cpp
@@ -440,7 +440,7 @@ QualType declaredType(const TypeDecl *D) {
if (const auto *Args = CTSD->getTemplateArgsAsWritten())
return Context.getTemplateSpecializationType(
TemplateName(CTSD->getSpecializedTemplate()), Args->arguments(),
- /*CanonicalArgs=*/std::nullopt);
+ /*CanonicalArgs=*/{});
return Context.getTypeDeclType(D);
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/145841
More information about the cfe-commits
mailing list