Compare commits

...

3 Commits

Author SHA1 Message Date
Bartek Kryza
7cf61a98aa Ignore Wdangling-reference warnings on GCC 13 2023-10-25 14:02:35 +02:00
Bartek Kryza
79801b2936 Fix handling of template template arguments which are not expressions (#199) 2023-10-24 18:29:47 +02:00
Bartek Kryza
57bc2f7309 Merge pull request #198 from bkryza/v0.4.1
V0.4.1
2023-10-22 19:46:41 +02:00
6 changed files with 32 additions and 8 deletions

View File

@@ -3,6 +3,7 @@ output_directory: docs/diagrams
comment_parser: clang
remove_compile_flags:
- -Wno-class-memaccess
- -Wno-dangling-reference
generate_links:
link: "{% if existsIn(element, \"doxygen_link\") %}{{ element.doxygen_link }}{% endif %}"
tooltip: "{% if existsIn(element, \"comment\") and existsIn(element.comment, \"brief\") %}{{ abbrv(trim(replace(element.comment.brief.0, \"\\n+\", \" \")), 256) }}{% else %}{{ element.name }}{% endif %}"

View File

@@ -136,14 +136,21 @@ endif()
# Setup custom compile options depending on various compiler
# and environment quirks
#
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "13.0")
# Workaround over Wdangling-reference false positives in libfmt
set(CUSTOM_COMPILE_OPTIONS ${CUSTOM_COMPILE_OPTIONS} -Wno-dangling-reference)
endif()
endif()
if(LLVM_VERSION_MAJOR GREATER_EQUAL 17)
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(CUSTOM_COMPILE_OPTIONS "-Wno-class-memaccess")
set(CUSTOM_COMPILE_OPTIONS ${CUSTOM_COMPILE_OPTIONS} -Wno-class-memaccess)
endif()
endif()
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
set(CUSTOM_COMPILE_OPTIONS
"${CUSTOM_COMPILE_OPTIONS} -Wno-unused-private-field")
${CUSTOM_COMPILE_OPTIONS} -Wno-unused-private-field)
endif()
#
@@ -219,4 +226,4 @@ option(BUILD_TESTS "" ON)
if(BUILD_TESTS)
enable_testing()
add_subdirectory(tests)
endif(BUILD_TESTS)
endif(BUILD_TESTS)

View File

@@ -238,6 +238,11 @@ std::string to_string(const clang::Expr *expr)
return result;
}
std::string to_string(const clang::ValueDecl *val)
{
return val->getQualifiedNameAsString();
}
std::string to_string(const clang::Stmt *stmt)
{
const clang::LangOptions lang_options;

View File

@@ -111,6 +111,8 @@ std::string to_string(
std::string to_string(const clang::Expr *expr);
std::string to_string(const clang::ValueDecl *val);
std::string to_string(const clang::Stmt *stmt);
std::string to_string(const clang::FunctionTemplateDecl *decl);

View File

@@ -76,7 +76,7 @@ clang::ASTContext *call_expression_context::get_ast_context() const
}
if (current_method_decl_ != nullptr) {
return &current_function_decl_->getASTContext();
return &current_method_decl_->getASTContext();
}
return nullptr;

View File

@@ -1601,11 +1601,20 @@ bool translation_unit_visitor::process_template_parameters(
clang::dyn_cast_or_null<clang::TemplateTemplateParmDecl>(
parameter);
std::optional<std::string> default_arg;
if (template_template_parameter->hasDefaultArgument())
default_arg = common::to_string(
if (template_template_parameter->hasDefaultArgument()) {
const auto &def_arg =
template_template_parameter->getDefaultArgument()
.getArgument()
.getAsExpr());
.getArgument();
if (def_arg.getKind() ==
clang::TemplateArgument::ArgKind::Expression) {
default_arg = common::to_string(def_arg.getAsExpr());
}
else if (def_arg.getKind() ==
clang::TemplateArgument::ArgKind::Declaration) {
default_arg = common::to_string(def_arg.getAsDecl());
}
}
auto ct = template_parameter::make_template_template_type(
template_template_parameter->getNameAsString(), default_arg,
template_template_parameter->isParameterPack());