diff options
author | Patrick Palka <ppalka@redhat.com> | 2024-08-09 21:13:03 -0400 |
---|---|---|
committer | Patrick Palka <ppalka@redhat.com> | 2024-08-09 21:13:03 -0400 |
commit | cf7feae517d4819cd33ef6bb123217ea39845fd1 (patch) | |
tree | 22655cecf39e90133460994c6388ff79178f7116 /gcc/cp/parser.cc | |
parent | 6b4b27a0f57c9b44a3d2c5aded17f37543821039 (diff) | |
download | gcc-cf7feae517d4819cd33ef6bb123217ea39845fd1.zip gcc-cf7feae517d4819cd33ef6bb123217ea39845fd1.tar.gz gcc-cf7feae517d4819cd33ef6bb123217ea39845fd1.tar.bz2 |
c++: clean up cp_identifier_kind checks
The predicates for checking an IDENTIFIER node's cp_identifier_kind
currently directly test the three flag bits that encode the kind. This
patch instead makes the checks first reconstruct the cp_identifier_kind
in its entirety and then compare that.
gcc/cp/ChangeLog:
* cp-tree.h (get_identifier_kind): Define.
(IDENTIFIER_KEYWORD_P): Redefine in terms of get_identifier_kind.
(IDENTIFIER_CDTOR_P): Likewise.
(IDENTIFIER_CTOR_P): Likewise.
(IDENTIFIER_DTOR_P): Likewise.
(IDENTIFIER_ANY_OP_P): Likewise.
(IDENTIFIER_OVL_OP_P): Likewise.
(IDENTIFIER_ASSIGN_OP_P): Likewise.
(IDENTIFIER_CONV_OP_P): Likewise.
(IDENTIFIER_TRAIT_P): Likewise.
* parser.cc (cp_lexer_peek_trait): Mark IDENTIFIER_TRAIT_P
check UNLIKELY.
Reviewed-by: Jason Merrill <jason@redhat.com>
Diffstat (limited to 'gcc/cp/parser.cc')
-rw-r--r-- | gcc/cp/parser.cc | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/cp/parser.cc b/gcc/cp/parser.cc index 82f3903..852efe4 100644 --- a/gcc/cp/parser.cc +++ b/gcc/cp/parser.cc @@ -1198,7 +1198,8 @@ static const cp_trait * cp_lexer_peek_trait (cp_lexer *lexer) { const cp_token *token1 = cp_lexer_peek_token (lexer); - if (token1->type == CPP_NAME && IDENTIFIER_TRAIT_P (token1->u.value)) + if (token1->type == CPP_NAME + && UNLIKELY (IDENTIFIER_TRAIT_P (token1->u.value))) { const cp_trait &trait = cp_traits[IDENTIFIER_CP_INDEX (token1->u.value)]; const bool is_pack_element = (trait.kind == CPTK_TYPE_PACK_ELEMENT); |