aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorEugen Wissner <belka@caraus.de>2026-07-19 23:23:22 +0200
committerEugen Wissner <belka@caraus.de>2026-07-20 00:48:12 +0200
commitd09cd98bd3df9920f0ecab97615048c0594e8f7f (patch)
tree6923b34ae6b603e19ede189098206cfe25feef35 /gcc
parentcdbc1695a93910df5729779de31912a3b4b4172b (diff)
downloadelna-d09cd98bd3df9920f0ecab97615048c0594e8f7f.tar.gz
Add clang-tidy support
Diffstat (limited to 'gcc')
-rw-r--r--gcc/Make-lang.in2
-rw-r--r--gcc/gcc/elna-generic.cc55
2 files changed, 29 insertions, 28 deletions
diff --git a/gcc/Make-lang.in b/gcc/Make-lang.in
index ecb0141..5b8b6a8 100644
--- a/gcc/Make-lang.in
+++ b/gcc/Make-lang.in
@@ -155,7 +155,7 @@ elna.stagefeedback: stagefeedback-start
-mv elna/*$(objext) stagefeedback/elna
ELNA_INCLUDES = -I $(srcdir)/elna/include -I elna/generated
-ELNA_CXXFLAGS = -std=c++17
+ELNA_CXXFLAGS = -std=c++20
elna/%.o: elna/boot/%.cc elna/generated/parser.hh elna/generated/location.hh
$(COMPILE) $(ELNA_CXXFLAGS) $(ELNA_INCLUDES) $<
diff --git a/gcc/gcc/elna-generic.cc b/gcc/gcc/elna-generic.cc
index b13fd2f..79207cc 100644
--- a/gcc/gcc/elna-generic.cc
+++ b/gcc/gcc/elna-generic.cc
@@ -17,6 +17,7 @@ along with GCC; see the file COPYING3. If not see
#include <array>
#include <cstring>
+#include <ranges>
#include "elna/boot/evaluator.h"
#include "elna/gcc/elna-diagnostic.h"
@@ -29,9 +30,7 @@ along with GCC; see the file COPYING3. If not see
#include "cgraph.h"
#include "gimplify.h"
#include "stringpool.h"
-#include "diagnostic.h"
#include "realmpfr.h"
-#include "varasm.h"
#include "fold-const.h"
#include "langhooks.h"
@@ -407,7 +406,7 @@ namespace elna::gcc
this->current_expression = build_int_cstu(elna_char_type_node, character->value);
}
- void generic_visitor::visit(boot::literal<nullptr_t> *)
+ void generic_visitor::visit(boot::literal<std::nullptr_t> *)
{
this->current_expression = elna_pointer_nil_node;
}
@@ -580,54 +579,55 @@ namespace elna::gcc
}
switch (expression->operation())
{
- case boot::binary_operator::sum:
+ using enum boot::binary_operator;
+ case sum:
this->current_expression = build_arithmetic_operation(expression, PLUS_EXPR, left, right);
break;
- case boot::binary_operator::subtraction:
+ case subtraction:
this->current_expression = build_arithmetic_operation(expression, MINUS_EXPR, left, right);
break;
- case boot::binary_operator::division:
+ case division:
this->current_expression = build_arithmetic_operation(expression, TRUNC_DIV_EXPR, left, right);
break;
- case boot::binary_operator::remainder:
+ case remainder:
this->current_expression = build_arithmetic_operation(expression, TRUNC_MOD_EXPR, left, right);
break;
- case boot::binary_operator::multiplication:
+ case multiplication:
this->current_expression = build_arithmetic_operation(expression, MULT_EXPR, left, right);
break;
- case boot::binary_operator::less:
+ case less:
this->current_expression = build_comparison_operation(expression, LT_EXPR, left, right);
break;
- case boot::binary_operator::greater:
+ case greater:
this->current_expression = build_comparison_operation(expression, GT_EXPR, left, right);
break;
- case boot::binary_operator::less_equal:
+ case less_equal:
this->current_expression = build_comparison_operation(expression, LE_EXPR, left, right);
break;
- case boot::binary_operator::greater_equal:
+ case greater_equal:
this->current_expression = build_comparison_operation(expression, GE_EXPR, left, right);
break;
- case boot::binary_operator::conjunction:
+ case conjunction:
this->current_expression = build_bit_logic_operation(expression, left, right);
break;
- case boot::binary_operator::disjunction:
+ case disjunction:
this->current_expression = build_bit_logic_operation(expression, left, right);
break;
- case boot::binary_operator::exclusive_disjunction:
+ case exclusive_disjunction:
this->current_expression = build_bit_logic_operation(expression, left, right);
break;
- case boot::binary_operator::equals:
+ case equals:
this->current_expression = build_equality_operation(expression, left, right);
break;
- case boot::binary_operator::not_equals:
+ case not_equals:
this->current_expression = build_equality_operation(expression, left, right);
break;
- case boot::binary_operator::shift_left:
+ case shift_left:
this->current_expression = build_binary_operation(
is_numeric_type(left_type) && right_type == elna_word_type_node,
expression, LSHIFT_EXPR, left, right, left_type);
break;
- case boot::binary_operator::shift_right:
+ case shift_right:
this->current_expression = build_binary_operation(
is_numeric_type(left_type) && right_type == elna_word_type_node,
expression, RSHIFT_EXPR, left, right, left_type);
@@ -642,7 +642,8 @@ namespace elna::gcc
switch (expression->operation())
{
- case boot::unary_operator::reference:
+ using enum boot::unary_operator;
+ case reference:
this->current_expression = prepare_rvalue(this->current_expression);
TREE_ADDRESSABLE(this->current_expression) = 1;
this->current_expression = build_fold_addr_expr_with_type_loc(location,
@@ -650,7 +651,7 @@ namespace elna::gcc
build_pointer_type(TREE_TYPE(this->current_expression)));
TREE_NO_TRAMPOLINE(this->current_expression) = 1;
break;
- case boot::unary_operator::negation:
+ case negation:
{
tree operand_type = TREE_TYPE(this->current_expression);
@@ -666,7 +667,7 @@ namespace elna::gcc
}
break;
}
- case boot::unary_operator::minus:
+ case minus:
{
tree operand_type = TREE_TYPE(this->current_expression);
@@ -674,7 +675,7 @@ namespace elna::gcc
operand_type, this->current_expression);
break;
}
- case boot::unary_operator::plus:
+ case plus:
// Identity: operand already in current_expression.
break;
}
@@ -1034,9 +1035,9 @@ namespace elna::gcc
}
auto& branches = statement->branches;
- for (auto it = branches.rbegin(); it != branches.rend(); ++it)
+ for (auto& branch : branches | std::views::reverse)
{
- result = make_if_branch(**it, result);
+ result = make_if_branch(*branch, result);
}
result = make_if_branch(statement->branch(), result);
@@ -1087,9 +1088,9 @@ namespace elna::gcc
tree result = NULL_TREE;
auto& branches = statement->branches;
- for (auto it = branches.rbegin(); it != branches.rend(); ++it)
+ for (auto& branch : branches | std::views::reverse)
{
- result = make_if_branch(**it, result, goto_check);
+ result = make_if_branch(*branch, result, goto_check);
}
result = make_if_branch(statement->branch(), result, goto_check);