Applied readability-implicit-bool-conversion fixes
This commit is contained in:
@@ -67,13 +67,13 @@ model::namespace_ get_tag_namespace(const clang::TagDecl &declaration)
|
||||
const auto *parent{declaration.getParent()};
|
||||
|
||||
// First walk up to the nearest namespace, e.g. from nested class or enum
|
||||
while (parent && !parent->isNamespace()) {
|
||||
while ((parent != nullptr) && !parent->isNamespace()) {
|
||||
parent = parent->getParent();
|
||||
}
|
||||
|
||||
// Now build up the namespace
|
||||
std::deque<std::string> namespace_tokens;
|
||||
while (parent && parent->isNamespace()) {
|
||||
while ((parent != nullptr) && parent->isNamespace()) {
|
||||
const auto *ns_decl = static_cast<const clang::NamespaceDecl *>(parent);
|
||||
if (!ns_decl->isInline() && !ns_decl->isAnonymousNamespace())
|
||||
namespace_tokens.push_front(ns_decl->getNameAsString());
|
||||
@@ -96,7 +96,8 @@ std::string get_tag_name(const clang::TagDecl &declaration)
|
||||
fmt::format("(anonymous_{})", std::to_string(declaration.getID()));
|
||||
}
|
||||
|
||||
if (declaration.getParent() && declaration.getParent()->isRecord()) {
|
||||
if ((declaration.getParent() != nullptr) &&
|
||||
declaration.getParent()->isRecord()) {
|
||||
// If the record is nested within another record (e.g. class or struct)
|
||||
// we have to maintain a containment namespace in order to ensure
|
||||
// unique names within the diagram
|
||||
@@ -190,7 +191,8 @@ std::string to_string(const clang::FunctionTemplateDecl *decl)
|
||||
std::vector<std::string> template_parameters;
|
||||
// Handle template function
|
||||
for (const auto *parameter : *decl->getTemplateParameters()) {
|
||||
if (clang::dyn_cast_or_null<clang::TemplateTypeParmDecl>(parameter)) {
|
||||
if (clang::dyn_cast_or_null<clang::TemplateTypeParmDecl>(parameter) !=
|
||||
nullptr) {
|
||||
const auto *template_type_parameter =
|
||||
clang::dyn_cast_or_null<clang::TemplateTypeParmDecl>(parameter);
|
||||
|
||||
@@ -282,11 +284,12 @@ template <> id_t to_id(const std::filesystem::path &file)
|
||||
template <> id_t to_id(const clang::TemplateArgument &template_argument)
|
||||
{
|
||||
if (template_argument.getKind() == clang::TemplateArgument::Type) {
|
||||
if (template_argument.getAsType()->getAs<clang::EnumType>())
|
||||
if (template_argument.getAsType()->getAs<clang::EnumType>() != nullptr)
|
||||
return to_id(*template_argument.getAsType()
|
||||
->getAs<clang::EnumType>()
|
||||
->getAsTagDecl());
|
||||
if (template_argument.getAsType()->getAs<clang::RecordType>())
|
||||
if (template_argument.getAsType()->getAs<clang::RecordType>() !=
|
||||
nullptr)
|
||||
return to_id(*template_argument.getAsType()
|
||||
->getAs<clang::RecordType>()
|
||||
->getAsRecordDecl());
|
||||
|
||||
Reference in New Issue
Block a user