[Lldb-commits] [lldb] 0b44bb8 - [lldb][NFC] Minor cleanup in CxxModuleHandler::tryInstantiateStdTemplate
Raphael Isemann via lldb-commits
lldb-commits at lists.llvm.org
Mon Sep 28 04:04:09 PDT 2020
Author: Raphael Isemann
Date: 2020-09-28T13:03:45+02:00
New Revision: 0b44bb8d40af9c634203a778fe34a9a4459d288f
URL: https://github.com/llvm/llvm-project/commit/0b44bb8d40af9c634203a778fe34a9a4459d288f
DIFF: https://github.com/llvm/llvm-project/commit/0b44bb8d40af9c634203a778fe34a9a4459d288f.diff
LOG: [lldb][NFC] Minor cleanup in CxxModuleHandler::tryInstantiateStdTemplate
Using llvm::None and `contains` instead of `find`.
Added:
Modified:
lldb/source/Plugins/ExpressionParser/Clang/CxxModuleHandler.cpp
Removed:
################################################################################
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/CxxModuleHandler.cpp b/lldb/source/Plugins/ExpressionParser/Clang/CxxModuleHandler.cpp
index 38d9f8d1e4b8..8a8450245990 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/CxxModuleHandler.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/CxxModuleHandler.cpp
@@ -181,21 +181,21 @@ llvm::Optional<Decl *> CxxModuleHandler::tryInstantiateStdTemplate(Decl *d) {
// If we don't have a template to instiantiate, then there is nothing to do.
auto td = dyn_cast<ClassTemplateSpecializationDecl>(d);
if (!td)
- return {};
+ return llvm::None;
// We only care about templates in the std namespace.
if (!td->getDeclContext()->isStdNamespace())
- return {};
+ return llvm::None;
// We have a list of supported template names.
- if (m_supported_templates.find(td->getName()) == m_supported_templates.end())
- return {};
+ if (!m_supported_templates.contains(td->getName()))
+ return llvm::None;
// Early check if we even support instantiating this template. We do this
// before we import anything into the target AST.
auto &foreign_args = td->getTemplateInstantiationArgs();
if (!templateArgsAreSupported(foreign_args.asArray()))
- return {};
+ return llvm::None;
// Find the local DeclContext that corresponds to the DeclContext of our
// decl we want to import.
@@ -206,7 +206,7 @@ llvm::Optional<Decl *> CxxModuleHandler::tryInstantiateStdTemplate(Decl *d) {
"Got error while searching equal local DeclContext for decl "
"'{1}':\n{0}",
td->getName());
- return {};
+ return llvm::None;
}
// Look up the template in our local context.
@@ -219,7 +219,7 @@ llvm::Optional<Decl *> CxxModuleHandler::tryInstantiateStdTemplate(Decl *d) {
break;
}
if (!new_class_template)
- return {};
+ return llvm::None;
// Import the foreign template arguments.
llvm::SmallVector<TemplateArgument, 4> imported_args;
@@ -231,7 +231,7 @@ llvm::Optional<Decl *> CxxModuleHandler::tryInstantiateStdTemplate(Decl *d) {
llvm::Expected<QualType> type = m_importer->Import(arg.getAsType());
if (!type) {
LLDB_LOG_ERROR(log, type.takeError(), "Couldn't import type: {0}");
- return {};
+ return llvm::None;
}
imported_args.push_back(TemplateArgument(*type));
break;
@@ -242,7 +242,7 @@ llvm::Optional<Decl *> CxxModuleHandler::tryInstantiateStdTemplate(Decl *d) {
m_importer->Import(arg.getIntegralType());
if (!type) {
LLDB_LOG_ERROR(log, type.takeError(), "Couldn't import type: {0}");
- return {};
+ return llvm::None;
}
imported_args.push_back(
TemplateArgument(d->getASTContext(), integral, *type));
More information about the lldb-commits
mailing list