Skip to content

Commit 70513a0

Browse files
committed
Make pretty-print emit metafunctions as comment, updates #840
And update a few stray regression test results post-merges
1 parent aaab6af commit 70513a0

File tree

4 files changed

+15
-11
lines changed

4 files changed

+15
-11
lines changed

regression-tests/test-results/pure2-print.cpp2.output

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
pure2-print.cpp2...
22

3-
outer: type =
3+
outer:/* @print */ type =
44
{
55
object_alias: <T: type> T requires (true) == 42;
66
mytype: final type =

regression-tests/test-results/version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
cppfront compiler v0.3.0 Build 8C20:1314
2+
cppfront compiler v0.3.0 Build 8C28:1634
33
Copyright(c) Herb Sutter All rights reserved
44

55
SPDX-License-Identifier: CC-BY-NC-ND-4.0

source/build.info

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
"8C20:1314"
1+
"8C28:1634"

source/parse.h

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4961,15 +4961,19 @@ auto pretty_print_visualize(declaration_node const& n, int indent, bool include_
49614961
// First compute the common parts
49624962

49634963
auto metafunctions = std::string{};
4964-
for (auto& meta : n.metafunctions)
49654964
{
4966-
if (
4967-
include_metafunctions_list
4968-
|| meta->to_string() == "struct"
4969-
)
4970-
{
4971-
metafunctions += " @" + pretty_print_visualize(*meta, indent);
4972-
}
4965+
auto as_comment =
4966+
!n.metafunctions.empty()
4967+
&& !include_metafunctions_list;
4968+
if (as_comment) {
4969+
metafunctions += "/*";
4970+
}
4971+
for (auto& meta : n.metafunctions) {
4972+
metafunctions += " @" + pretty_print_visualize(*meta, indent);
4973+
}
4974+
if (as_comment) {
4975+
metafunctions += " */";
4976+
}
49734977
}
49744978

49754979
auto template_params = std::string{};

0 commit comments

Comments
 (0)