Skip to content

Feature: Proper type prettification #110

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 130 commits into from
May 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
130 commits
Select commit Hold shift + click to select a range
efe38d5
feat: util::prefix_range
DNKpp Mar 22, 2025
4ddd08a
feat: util::concat_array
DNKpp Mar 22, 2025
a670439
feat: printing::type::lexing::NameLexer
DNKpp Mar 23, 2025
d779753
chore: enhance VariantEqualsMatcher
DNKpp Mar 25, 2025
30b0282
chore: rework NameLexer.hpp
DNKpp Apr 5, 2025
5dea60d
feat: util::projected_value_t c++26-backport
DNKpp Apr 5, 2025
1f8e6fb
fix: add utilities/C++26Backports.hpp to Utilities.hpp
DNKpp Apr 5, 2025
0ea426b
fix: NameLexer handles << and >> correctly
DNKpp Apr 5, 2025
1d34b38
feat: util::contains
DNKpp Apr 8, 2025
7ac7f15
feat: lexing::keyword::text and lexing::operator_or_punctuator::text
DNKpp Apr 8, 2025
34825f1
fix: remove invalid constexpr specification
DNKpp Apr 14, 2025
7615c2a
feat: printing::type::parsing::NameParser, which handles identifiers
DNKpp Apr 14, 2025
01235b8
refactor: enhance usability of match_suffix with single suffix-element
DNKpp Apr 14, 2025
c8e2158
feat: type::parsing::NameParser handles specs
DNKpp Apr 14, 2025
742e638
fix: correct impl of match_suffix with multiple suffix-elements
DNKpp Apr 14, 2025
19838a2
feat: type::parsing::NameParser handles templates
DNKpp Apr 14, 2025
bd06a84
chore: mark several functions as constexpr
DNKpp Apr 14, 2025
5ab16ee
feat: type::parsing::NameParser handles functions
DNKpp Apr 14, 2025
24d0615
fix: parsing::NameParser correctly detects function-types
DNKpp Apr 15, 2025
3d73aa3
feat: parsing::NameParser detects placeholders
DNKpp Apr 15, 2025
f4f56bc
refactor: overhaul function handling and introduce token::End as end-…
DNKpp Apr 15, 2025
a8e32ec
fix: make util::concat_array working on msvc
aunovis-koepke Apr 16, 2025
2948418
fix: please msvc
aunovis-koepke Apr 16, 2025
c8e516b
fix: remove obsolete function-info symbols from parsing::token::Ident…
DNKpp Apr 18, 2025
b65d4c2
fix: parsing::NameParser detects placeholders wrapped in parenthesis
DNKpp Apr 18, 2025
26a5f60
fix: remove constexpr from try_reduce_as_scope_sequence and thus plea…
DNKpp Apr 18, 2025
06d4320
test: remove constexpr from test result, so that they are actually ex…
DNKpp Apr 18, 2025
9adba18
test: remove constexpr from test input, so that they are actually exe…
DNKpp Apr 18, 2025
79171b2
feat: add FunctionContext token
DNKpp Apr 18, 2025
5829a35
feat: add `unrecognized` callback for reporting errors in parsing::Na…
DNKpp Apr 18, 2025
830a0ba
feat: parsing::NameParser detects simple function-ptrs
DNKpp Apr 18, 2025
3516490
fix: parsing::NameParser correctly detects function-ptrs as params
DNKpp Apr 18, 2025
7fcb855
fix: parsing::NameParser correctly detects function-ptrs as template …
DNKpp Apr 18, 2025
ccf9870
feat: parsing::NameParser handles function-ptr return-types
DNKpp Apr 22, 2025
14d6c1b
fix: remove invalid constexpr
DNKpp Apr 22, 2025
ed45a7d
chore: function and function-type tokens do not emit begin/end_type c…
DNKpp Apr 22, 2025
c3365bf
test: extend parsing::NameParser tests
DNKpp Apr 22, 2025
c2cade9
feat: extend lexer keyword collection
DNKpp Apr 22, 2025
521a420
feat: parsing::NameParser supports msvc-like function-scopes
DNKpp Apr 22, 2025
ddb329a
test: extend placeholder parsing test-case
DNKpp Apr 22, 2025
c5b6627
test: add parsing::NameParser cases for reserved identifier handling
DNKpp Apr 22, 2025
0d16b8c
feat: parsing::NameParser supports simple operators
DNKpp Apr 22, 2025
65448cd
feat: parsing::NameParser handles new, delete and co_await operators
DNKpp Apr 22, 2025
2a6608a
feat: parsing::NameParser handles conversion operators
DNKpp Apr 22, 2025
b98a570
fix: remove invalid constexpr
DNKpp Apr 22, 2025
bba45f2
fix: add missing include
DNKpp Apr 24, 2025
a14bf73
fix: parsing::NameParser omits void from function args `(void)`
DNKpp Apr 24, 2025
051bcbd
feat: printing::type::PrintVisitor sketchup
DNKpp Apr 24, 2025
0c153a1
chore: enable NameParser as type-printer backend
DNKpp Apr 24, 2025
3b98c4f
test: relax several test constraints
DNKpp Apr 25, 2025
0a9c278
fix: parsing::NameParser does not treat something like `(anonymous cl…
DNKpp Apr 25, 2025
a3f563e
fix: parsing::NameParser correctly handles nested templates and place…
DNKpp Apr 25, 2025
37d0935
fix: parsing::NameParser detects placeholders wrapped in ''
DNKpp Apr 25, 2025
380fc32
feat: PrintVisitor unwraps identifier in the form `'lambda\\d*'`
DNKpp Apr 25, 2025
baa92a6
fix: parsing::NameParser correctly handles `operator<<>`
DNKpp Apr 26, 2025
1398ed6
refactor: slightly overhaul parsing::token::Specs reference and noexc…
DNKpp Apr 26, 2025
e945c92
test: mark test as mayfail
DNKpp Apr 26, 2025
9829e45
cleanup: remove unnecessary placeholder reductions
DNKpp Apr 26, 2025
4fc5270
refactor: extract parsing tokens into NameParserTokens.hpp
DNKpp Apr 26, 2025
16b65b9
refactor: extract parsing reductions into NameParserReductions.hpp
DNKpp Apr 26, 2025
8ce8b35
cleanup: remove obsolete and deactivated tests from NameLexer
DNKpp Apr 26, 2025
e0b3304
test: add test-case for lexing::operator_or_punctuator::text
DNKpp Apr 26, 2025
9e3f03b
test: add test-case for lexing::keyword::text
DNKpp Apr 26, 2025
79b26df
chore: exclude compile-time only code from code-coverage
DNKpp Apr 26, 2025
3ee767c
fix: correct assertion
DNKpp Apr 26, 2025
51b66e7
feat: parsing::PrintVisitor ignores namespaces in form `\d+'
aunovis-koepke Apr 26, 2025
a6d25bb
feat: parsing::PrintVisitor prettifies msvc-like lambdas
aunovis-koepke Apr 26, 2025
c08987a
fix: parsing::PrintVisitor unwraps general msvc-like scope-sequences
aunovis-koepke Apr 26, 2025
1d39207
feat: parsing::PrintVisitor prettifies `anonymous-namespace' identifier
aunovis-koepke Apr 26, 2025
0126560
feat: parsing::PrintVisitor fully unwraps msvc-like placeholders
aunovis-koepke Apr 26, 2025
15ecc1b
fix: try_reduce_as_function_identifier ignores trailing spaces
aunovis-koepke Apr 26, 2025
dcf0498
fix: parsing::NameParser does not treat ::() as function-args
aunovis-koepke Apr 26, 2025
0502f02
fix: try_reduce_as_function_ptr ignores optional space
aunovis-koepke Apr 26, 2025
d6b66fd
fix: parsing::NameParser correctly handles function-types as template…
DNKpp Apr 27, 2025
404bdd0
chore: split operator() of parsing::NameParser into two separate func…
DNKpp Apr 28, 2025
af767c6
chore: split prettify_identifier into separate functions: prettify_ty…
DNKpp Apr 28, 2025
41c3391
fix: strenghten the condition for keeping reserved identifiers
aunovis-koepke Apr 26, 2025
811e272
chore: unify token::Specs reductions
aunovis-koepke Apr 28, 2025
a035ab4
fix: make token::Space filtering more reliable
aunovis-koepke Apr 28, 2025
8fd321d
test: extend parsing::NameParser test cases
aunovis-koepke Apr 28, 2025
1a364cf
chore: rework token::Specs handling
DNKpp Apr 28, 2025
553b49d
chore: parsing::NameParser keeps all identifiers, even the reserved ones
DNKpp Apr 28, 2025
04c006f
chore: parsing::NameParser does not store Space tokens
DNKpp Apr 28, 2025
8b4ac27
chore: rework token::FunctionContext and remove token::FunctionArgs
DNKpp Apr 28, 2025
9d34548
fix: parsing::NameParser never accepts two adjacent Type tokens
DNKpp Apr 28, 2025
2c160eb
fix: parsing::NameParser ignores non-name reserved-identifiers
DNKpp Apr 29, 2025
c2dca68
fix: define functions type::prettify_function and type::prettify_type…
DNKpp Apr 29, 2025
d5e70bd
test: add additional msvc-like test
DNKpp Apr 29, 2025
aad44a3
fix: parsing::NameParser does not treat placeholders as template- or …
DNKpp Apr 29, 2025
1372b60
fix: treat token::TypeContext as valid placeholder-prefix
aunovis-koepke Apr 29, 2025
2b3a2b2
fix: parsing::NameParser correctly handles placeholders
aunovis-koepke Apr 29, 2025
0d9224f
fix: parsing::NameParser ignores identifiers like `__ptr64` during ty…
aunovis-koepke Apr 29, 2025
d428e7b
fix: parsing::NameParser treats call-conventions as valid return-type…
aunovis-koepke Apr 29, 2025
38caefb
fix: parsing::NameParser detects function-ptrs decorated with call-co…
aunovis-koepke May 5, 2025
2b79ef6
fix: lexing::NameLexer recognizes `static` as keyword
aunovis-koepke May 5, 2025
679b57f
test: extend parsing::NameParser test with msvc-like case
DNKpp May 5, 2025
032f482
fix: correct test-case from previous commit
DNKpp May 5, 2025
9c42fbe
fix: please gcov
DNKpp May 5, 2025
352a74f
fix: remove unused value
DNKpp May 6, 2025
798f1fd
cleanup: remove obsolete parsing::token::Specs::Layer::merge function
DNKpp May 6, 2025
37bddfe
cleanup: remove obsolete character predicates
DNKpp May 6, 2025
b38f5b6
chore: improve parsing::NameParser::finalize
DNKpp May 6, 2025
ad113a2
refactor: simplify several token peeks
DNKpp May 6, 2025
4dcdcae
chore: slightly simplify parsing::NameParser::unwrap_msvc_like_function
DNKpp May 6, 2025
9224b1b
fix: parsing::NameParser handles msvc's std::stacktrace special chara…
aunovis-koepke May 6, 2025
d917bc5
cleanup: remove obsolete type-name post-processing symbols
DNKpp May 6, 2025
be06e70
fix: parsing::NameParser handles all builtin-types correctly
DNKpp May 6, 2025
0234e1f
fix: correct assertion condition
DNKpp May 6, 2025
68b97e5
fix: parsing::NameParser treats `__int64` as an alias for `long long`
aunovis-koepke May 6, 2025
52ec37e
fix: please AppleClang-16 and 17 by disabling case for char8_t
DNKpp May 6, 2025
f6908aa
test: add test case returning function-ptr
DNKpp May 6, 2025
74b34ba
test: add cases for printing::type::lexing::is_space
DNKpp May 6, 2025
52a0673
test: add cases for printing::type::lexing::is_digit
DNKpp May 6, 2025
1e2ea88
cleanup: remove obsolete code-branch
DNKpp May 6, 2025
441987b
fix: try_reduce_as_function_ptr ignores optional space
DNKpp May 6, 2025
c7abf3d
fix: try_reduce_as_function_ptr ignores call-convention
aunovis-koepke May 6, 2025
49d1f7f
test: add test-cases for msvc-like decorated function-ptrs
DNKpp May 6, 2025
442df7d
refactor: simplify get_or_emplace_specs
DNKpp May 6, 2025
4b51460
fix: revert changes from previous commit
aunovis-koepke May 6, 2025
bffaac2
feat: begin_template_args and begin_function_args reports their argum…
DNKpp May 10, 2025
222e200
fix: parsing::NameParser correctly handles conversion-operators
DNKpp May 10, 2025
405be1e
chore: adjust conversion-operator reduction
DNKpp May 10, 2025
476f50f
fix: correct operator related tests
DNKpp May 10, 2025
bcab2d9
fix: please clang
DNKpp May 10, 2025
34a3a57
fix: correct TestAssert.hpp integration
DNKpp May 10, 2025
e0c79b8
fix: make try_reduce_as_regular_type more robust
aunovis-koepke May 10, 2025
6388463
fix: reduce_as_conversion_operator_function_identifier is more permis…
aunovis-koepke May 10, 2025
f6b5527
chore: mark test case as mayfail on msvc
aunovis-koepke May 10, 2025
d4cf406
chore: adjust reduce_as_conversion_operator_function_identifier's han…
DNKpp May 10, 2025
ef2c1f8
test: make conversion-operator stacktrace test more permissive to mat…
aunovis-koepke May 10, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ enable_sanitizers(${TARGET_NAME})

find_package(Catch2 REQUIRED)
find_package(trompeloeil REQUIRED)
find_package(libassert REQUIRED)
target_link_libraries(${TARGET_NAME}
PRIVATE
mimicpp::mimicpp
Expand Down
2 changes: 1 addition & 1 deletion include/mimic++/Stacktrace.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ namespace mimicpp::stacktrace::detail
std::move(out),
"#L{}, `",
stacktrace.source_line(index));
out = printing::type::prettify_identifier(std::move(out), stacktrace.description(index));
out = printing::type::prettify_function(std::move(out), stacktrace.description(index));
out = format::format_to(std::move(out), "`");

return out;
Expand Down
1 change: 1 addition & 0 deletions include/mimic++/Utilities.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "mimic++/utilities/Algorithm.hpp"
#include "mimic++/utilities/AlwaysFalse.hpp"
#include "mimic++/utilities/C++23Backports.hpp"
#include "mimic++/utilities/C++26Backports.hpp"
#include "mimic++/utilities/Concepts.hpp"
#include "mimic++/utilities/PriorityTag.hpp"
#include "mimic++/utilities/SourceLocation.hpp"
Expand Down
3 changes: 3 additions & 0 deletions include/mimic++/printing/TypePrinter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
#define MIMICPP_PRINTING_TYPE_PRINTER_HPP

#include "mimic++/printing/type/CommonTypes.hpp"
#include "mimic++/printing/type/NameLexer.hpp"
#include "mimic++/printing/type/NameParser.hpp"
#include "mimic++/printing/type/NamePrintVisitor.hpp"
#include "mimic++/printing/type/PrintType.hpp"
#include "mimic++/printing/type/Signature.hpp"
#include "mimic++/printing/type/Templated.hpp"
Expand Down
4 changes: 2 additions & 2 deletions include/mimic++/printing/state/CommonTypes.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include "mimic++/printing/Fwd.hpp"
#include "mimic++/printing/PathPrinter.hpp"
#include "mimic++/printing/state/Print.hpp"
#include "mimic++/printing/type/PostProcessing.hpp"
#include "mimic++/printing/type/PrintType.hpp"
#include "mimic++/utilities/C++23Backports.hpp" // unreachable

#include <algorithm>
Expand Down Expand Up @@ -45,7 +45,7 @@ namespace mimicpp::printing::detail::state
std::move(out),
"#L{}, `",
loc.line());
out = type::prettify_identifier(std::move(out), loc.function_name());
out = type::prettify_function(std::move(out), loc.function_name());
out = format::format_to(std::move(out), "`");

return out;
Expand Down
Loading
Loading