aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/logic.cc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2024-07-24 19:46:58 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2024-07-24 19:46:58 +0200
commitd2fc64c85788c135419cc3dcf5b4fa64558af547 (patch)
tree6d6765e087e28271032f414575315fce29a579dc /gcc/cp/logic.cc
parent679086172b84be18c55fdbb9cda7e97806e7c083 (diff)
downloadgcc-d2fc64c85788c135419cc3dcf5b4fa64558af547.zip
gcc-d2fc64c85788c135419cc3dcf5b4fa64558af547.tar.gz
gcc-d2fc64c85788c135419cc3dcf5b4fa64558af547.tar.bz2
c++: Mostly concepts related formatting fixes
When playing with P2963R3, while reading and/or modifying code I've fixed various comment or code formatting issues (and in 3 spots also comment wording), but including that in the WIP P2963R3 patch made that patch totally unreadable because these changes were 4 times the size of the actual code changes. So, here it is separated to a pure formatting + comment wording patch. 2024-07-24 Jakub Jelinek <jakub@redhat.com> * constraint.cc (subst_info::quiet, subst_info::noisy): Formatting fixes. (known_non_bool_p): Comment formatting fixes. (unpack_concept_check): Likewise. (resolve_function_concept_overload): Likewise. (resolve_function_concept_check): Likewise. (resolve_concept_check): Likewise. (deduce_constrained_parameter): Likewise. (finish_type_constraints): Likewise. (get_returned_expression): Likewise. (get_variable_initializer): Likewise. (norm_info::update_context, norm_info::ctx_params): Formatting fixes. (norm_info::context): Comment formatting fixes. (normalize_logical_operation): Likewise. Formatting fix. (normalize_concept_check): Comment formatting fixes. (normalize_atom): Likewise. (normalize_expression): Likewise. (get_normalized_constraints_from_info): Likewise. (get_normalized_constraints_from_decl): Likewise. Formatting fixes. (atomic_constraints_identical_p): Comment formatting fixes. (constraints_equivalent_p): Formatting fixes. (inchash::add_constraint): Likewise. (associate_classtype_constraints): Comment formatting fixes. (get_constraints): Likewise. (set_constraints): Likewise. (build_concept_check_arguments): Likewise. (build_function_check): Likewise. (build_concept_check): Likewise. (finish_shorthand_constraint): Likewise. (get_shorthand_constraints): Likewise. (check_constraint_variables): Likewise. (tsubst_constraint_variables): Likewise. (tsubst_requires_expr): Likewise. (get_mapped_args): Likewise. Formatting fixes. (satisfy_atom): Comment formatting fixes. (satisfy_constraint_r): Comment wording and formatting fixes. (satisfy_normalized_constraints): Comment formatting fixes. (satisfy_declaration_constraints): Likewise. (evaluate_concept_check): Likewise. (finish_requires_expr): Likewise. (finish_compound_requirement): Likewise. (check_function_concept): Likewise. (equivalently_constrained): Likewise. (more_constrained): Likewise. (diagnose_atomic_constraint): Likewise. * cp-tree.h (TREE_LANG_FLAG_0): Fix a comment error, FOLD_EXPR_MODIFY_P instead of FOLD_EXPR_MODOP_P. (DECL_MAIN_FREESTANDING_P, DECL_MAIN_P): Comment formatting fixes. (enum cpp0x_warn_str): Likewise. (enum composite_pointer_operation): Likewise. (enum expr_list_kind): Likewise. (enum impl_conv_rhs): Likewise. (enum impl_conv_void): Likewise. (struct deferred_access_check): Likewise. (ATOMIC_CONSTR_EXPR): Likewise. (FUNCTION_REF_QUALIFIED): Likewise. (DECL_DEPENDENT_P): Likewise. (FOLD_EXPR_MODIFY_P): Likewise. (FOLD_EXPR_OP_RAW): Likewise. (FOLD_EXPR_PACK): Likewise. (FOLD_EXPR_INIT): Likewise. (TYPE_WAS_UNNAMED): Likewise. (class cp_unevaluated): Likewise. (struct ovl_op_info_t assertion): Likewise. (cp_declarator::function::requires_clause): Likewise. (variable_template_p): Likewise. (concept_definition_p): Likewise. * logic.cc (clause::clause): Likewise. (clause::replace): Likewise. (clause::insert): Likewise. Formatting fixes. (struct formula): Comment formatting fixes. (formula::branch): Likewise. (debug): Formatting fixes. (dnf_size_r): Comment formatting fixes. (cnf_size_r): Likewise. (dnf_size): Likewise. (cnf_size): Likewise. (branch_clause): Likewise. (decompose_term): Likewise. Formatting fixes. (struct subsumption_entry): Comment formatting fixes. (subsumption_cache): Likewise. (save_subsumption): Likewise. Formatting fixes. (subsumes_constraints_nonnull): Formatting fixes.
Diffstat (limited to 'gcc/cp/logic.cc')
-rw-r--r--gcc/cp/logic.cc99
1 files changed, 49 insertions, 50 deletions
diff --git a/gcc/cp/logic.cc b/gcc/cp/logic.cc
index 5466dbe..fab2c35 100644
--- a/gcc/cp/logic.cc
+++ b/gcc/cp/logic.cc
@@ -69,7 +69,7 @@ struct clause
m_current = m_terms.begin ();
}
- /* Create a copy of the current term. The current
+ /* Create a copy of the current term. The current
iterator is set to point to the same position in the
copied list of terms. */
@@ -96,7 +96,7 @@ struct clause
/* Replaces the current term at position ITER with T. If
T is an atomic constraint that already appears in the
- clause, remove but do not replace ITER. Returns a pair
+ clause, remove but do not replace ITER. Returns a pair
containing an iterator to the replace object or past
the erased object and a boolean value which is true if
an object was erased. */
@@ -113,24 +113,23 @@ struct clause
return std::make_pair (iter, false);
}
- /* Inserts T before ITER in the list of terms. If T has
- already is an atomic constraint that already appears in
- the clause, no action is taken, and the current iterator
- is returned. Returns a pair of an iterator to the inserted
- object or ITER if no insertion occurred and a boolean
+ /* Inserts T before ITER in the list of terms. If T is an atomic
+ constraint that already appears in the clause, no action is taken,
+ and the current iterator is returned. Returns a pair of an iterator
+ to the inserted object or ITER if no insertion occurred and a boolean
value which is true if an object was inserted. */
std::pair<iterator, bool> insert (iterator iter, tree t)
{
if (TREE_CODE (t) == ATOMIC_CONSTR)
- {
- if (m_set.add (t))
- return std::make_pair (iter, false);
- }
+ {
+ if (m_set.add (t))
+ return std::make_pair (iter, false);
+ }
return std::make_pair (m_terms.insert (iter, t), true);
}
- /* Replaces the current term with T. In the case where the
+ /* Replaces the current term with T. In the case where the
current term is erased (because T is redundant), update
the position of the current term to the next term. */
@@ -143,7 +142,7 @@ struct clause
void replace (tree t1, tree t2)
{
- /* Replace the current term with t1. Ensure that iter points
+ /* Replace the current term with t1. Ensure that iter points
to the term before which t2 will be inserted. Update the
current term as needed. */
std::pair<iterator, bool> rep = replace (m_current, t1);
@@ -152,7 +151,7 @@ struct clause
else
++rep.first;
- /* Insert the t2. Make this the current term if we erased
+ /* Insert the t2. Make this the current term if we erased
the prior term. */
std::pair<iterator, bool> ins = insert (rep.first, t2);
if (rep.second && ins.second)
@@ -210,8 +209,8 @@ struct clause
/* A proof state owns a list of goals and tracks the
- current sub-goal. The class also provides facilities
- for managing subgoals and constructing term lists. */
+ current sub-goal. The class also provides facilities
+ for managing subgoals and constructing term lists. */
struct formula
{
@@ -240,7 +239,7 @@ struct formula
++m_current;
}
- /* Insert a copy of clause into the formula. This corresponds
+ /* Insert a copy of clause into the formula. This corresponds
to a distribution of one logical operation over the other. */
clause& branch ()
@@ -299,14 +298,14 @@ struct formula
void
debug (clause& c)
{
- for (clause::iterator i = c.begin(); i != c.end(); ++i)
+ for (clause::iterator i = c.begin (); i != c.end (); ++i)
verbatim (" # %E", *i);
}
void
debug (formula& f)
{
- for (formula::iterator i = f.begin(); i != f.end(); ++i)
+ for (formula::iterator i = f.begin (); i != f.end (); ++i)
{
/* Format punctuators via %s to avoid -Wformat-diag. */
verbatim ("%s", "(((");
@@ -315,7 +314,7 @@ debug (formula& f)
}
}
-/* The logical rules used to analyze a logical formula. The
+/* The logical rules used to analyze a logical formula. The
"left" and "right" refer to the position of formula in a
sequent (as in sequent calculus). */
@@ -345,9 +344,9 @@ atomic_p (tree t)
}
/* Recursively count the number of clauses produced when converting T
- to DNF. Returns a pair containing the number of clauses and a bool
+ to DNF. Returns a pair containing the number of clauses and a bool
value signifying that the tree would be rewritten as a result of
- distributing. In general, a conjunction for which this flag is set
+ distributing. In general, a conjunction for which this flag is set
is considered a disjunction for the purpose of counting. */
static std::pair<int, bool>
@@ -368,10 +367,10 @@ dnf_size_r (tree t)
if (disjunction_p (t))
{
- /* Matches constraints of the form P \/ Q. Disjunctions contribute
+ /* Matches constraints of the form P \/ Q. Disjunctions contribute
linearly to the number of constraints. When both P and Q are
- disjunctions, clauses are added. When only one of P and Q
- is a disjunction, an additional clause is produced. When neither
+ disjunctions, clauses are added. When only one of P and Q
+ is a disjunction, an additional clause is produced. When neither
P nor Q are disjunctions, two clauses are produced. */
if (disjunction_p (lhs))
{
@@ -410,10 +409,10 @@ dnf_size_r (tree t)
else /* conjunction_p (t) */
{
/* Matches constraints of the form P /\ Q, possibly resulting
- in the distribution of one side over the other. When both
+ in the distribution of one side over the other. When both
P and Q are disjunctions, the number of clauses are multiplied.
When only one of P and Q is a disjunction, the number of
- clauses are added. Otherwise, neither side is a disjunction and
+ clauses are added. Otherwise, neither side is a disjunction and
no clauses are created. */
if (disjunction_p (lhs))
{
@@ -453,9 +452,9 @@ dnf_size_r (tree t)
}
/* Recursively count the number of clauses produced when converting T
- to CNF. Returns a pair containing the number of clauses and a bool
+ to CNF. Returns a pair containing the number of clauses and a bool
value signifying that the tree would be rewritten as a result of
- distributing. In general, a disjunction for which this flag is set
+ distributing. In general, a disjunction for which this flag is set
is considered a conjunction for the purpose of counting. */
static std::pair<int, bool>
@@ -477,10 +476,10 @@ cnf_size_r (tree t)
if (disjunction_p (t))
{
/* Matches constraints of the form P \/ Q, possibly resulting
- in the distribution of one side over the other. When both
+ in the distribution of one side over the other. When both
P and Q are conjunctions, the number of clauses are multiplied.
When only one of P and Q is a conjunction, the number of
- clauses are added. Otherwise, neither side is a conjunction and
+ clauses are added. Otherwise, neither side is a conjunction and
no clauses are created. */
if (disjunction_p (lhs))
{
@@ -517,10 +516,10 @@ cnf_size_r (tree t)
}
else /* conjunction_p (t) */
{
- /* Matches constraints of the form P /\ Q. Conjunctions contribute
+ /* Matches constraints of the form P /\ Q. Conjunctions contribute
linearly to the number of constraints. When both P and Q are
- conjunctions, clauses are added. When only one of P and Q
- is a conjunction, an additional clause is produced. When neither
+ conjunctions, clauses are added. When only one of P and Q
+ is a conjunction, an additional clause is produced. When neither
P nor Q are conjunctions, two clauses are produced. */
if (disjunction_p (lhs))
{
@@ -559,7 +558,7 @@ cnf_size_r (tree t)
}
/* Count the number conjunctive clauses that would be created
- when rewriting T to DNF. */
+ when rewriting T to DNF. */
static int
dnf_size (tree t)
@@ -570,7 +569,7 @@ dnf_size (tree t)
/* Count the number disjunctive clauses that would be created
- when rewriting T to CNF. */
+ when rewriting T to CNF. */
static int
cnf_size (tree t)
@@ -591,7 +590,7 @@ replace_term (clause& c, tree t)
}
/* Create a new clause in the formula by copying the current
- clause. In the current clause, the term at CI is replaced
+ clause. In the current clause, the term at CI is replaced
by the first operand, and in the new clause, it is replaced
by the second. */
@@ -635,19 +634,19 @@ decompose_atom (clause& c)
}
/* Decompose a term of clause C (in formula F) according to the
- logical rules R. */
+ logical rules R. */
void
decompose_term (formula& f, clause& c, tree t, rules r)
{
switch (TREE_CODE (t))
{
- case CONJ_CONSTR:
- return decompose_conjuntion (f, c, t, r);
- case DISJ_CONSTR:
- return decompose_disjunction (f, c, t, r);
- default:
- return decompose_atom (c);
+ case CONJ_CONSTR:
+ return decompose_conjuntion (f, c, t, r);
+ case DISJ_CONSTR:
+ return decompose_disjunction (f, c, t, r);
+ default:
+ return decompose_atom (c);
}
}
@@ -714,7 +713,7 @@ derive_proof (clause& c, tree t, rules r)
}
}
-/* Key/value pair for caching subsumption results. This associates a pair of
+/* Key/value pair for caching subsumption results. This associates a pair of
constraints with a boolean value indicating the result. */
struct GTY((for_user)) subsumption_entry
@@ -746,11 +745,11 @@ struct subsumption_hasher : ggc_ptr_hash<subsumption_entry>
}
};
-/* Caches the results of subsumes_non_null(t1, t1). */
+/* Caches the results of subsumes_constraints_nonnull (t1, t1). */
static GTY ((deletable)) hash_table<subsumption_hasher> *subsumption_cache;
-/* Search for a previously cached subsumption result. */
+/* Search for a previously cached subsumption result. */
static bool*
lookup_subsumption (tree t1, tree t2)
@@ -765,13 +764,13 @@ lookup_subsumption (tree t1, tree t2)
return 0;
}
-/* Save a subsumption result. */
+/* Save a subsumption result. */
static bool
save_subsumption (tree t1, tree t2, bool result)
{
if (!subsumption_cache)
- subsumption_cache = hash_table<subsumption_hasher>::create_ggc(31);
+ subsumption_cache = hash_table<subsumption_hasher>::create_ggc (31);
subsumption_entry elt = {t1, t2, result};
subsumption_entry** slot = subsumption_cache->find_slot (&elt, INSERT);
subsumption_entry* entry = ggc_alloc<subsumption_entry> ();
@@ -790,7 +789,7 @@ subsumes_constraints_nonnull (tree lhs, tree rhs)
{
auto_timevar time (TV_CONSTRAINT_SUB);
- if (bool *b = lookup_subsumption(lhs, rhs))
+ if (bool *b = lookup_subsumption (lhs, rhs))
return *b;
tree x, y;