@@ -573,10 +573,12 @@ bool Parser::rDefinition(cpp_itemt &item)
573573 return rNamespaceSpec (item.make_namespace_spec ());
574574 else if (t==TOK_INLINE && lex.LookAhead (1 )==TOK_NAMESPACE)
575575 return rNamespaceSpec (item.make_namespace_spec ());
576- else if (t==TOK_USING &&
577- is_identifier (lex.LookAhead (1 )) &&
578- lex.LookAhead (2 )==' =' )
576+ else if (
577+ t == TOK_USING && is_identifier (lex.LookAhead (1 )) &&
578+ lex.LookAhead (2 ) == ' =' )
579+ {
579580 return rTypedefUsing (item.make_declaration ());
581+ }
580582 else if (t==TOK_USING)
581583 return rUsing (item.make_using ());
582584 else if (t==TOK_STATIC_ASSERT)
@@ -756,27 +758,19 @@ bool Parser::isTypeSpecifier()
756758{
757759 int t=lex.LookAhead (0 );
758760
759- if (is_identifier (t) || t==TOK_SCOPE
760- || t==TOK_CONSTEXPR || t==TOK_CONST || t==TOK_VOLATILE || t==TOK_RESTRICT
761- || t==TOK_CHAR || t==TOK_INT || t==TOK_SHORT || t==TOK_LONG
762- || t==TOK_CHAR16_T || t==TOK_CHAR32_T
763- || t==TOK_WCHAR_T || t==TOK_COMPLEX // new !!!
764- || t==TOK_SIGNED || t==TOK_UNSIGNED || t==TOK_FLOAT || t==TOK_DOUBLE
765- || t==TOK_INT8 || t==TOK_INT16 || t==TOK_INT32 || t==TOK_INT64
766- || t==TOK_GCC_INT128
767- || t==TOK_PTR32 || t==TOK_PTR64
768- || t==TOK_GCC_FLOAT80 || t==TOK_GCC_FLOAT128
769- || t==TOK_VOID || t==TOK_BOOL || t==TOK_CPROVER_BOOL
770- || t==TOK_CLASS || t==TOK_STRUCT || t==TOK_UNION || t==TOK_ENUM
771- || t==TOK_INTERFACE
772- || t==TOK_TYPENAME
773- || t==TOK_TYPEOF
774- || t==TOK_DECLTYPE
775- || t==TOK_UNDERLYING_TYPE
776- )
777- return true ;
778-
779- return false ;
761+ return is_identifier (t) || t == TOK_SCOPE || t == TOK_CONSTEXPR ||
762+ t == TOK_CONST || t == TOK_VOLATILE || t == TOK_RESTRICT ||
763+ t == TOK_CHAR || t == TOK_INT || t == TOK_SHORT || t == TOK_LONG ||
764+ t == TOK_CHAR16_T || t == TOK_CHAR32_T || t == TOK_WCHAR_T ||
765+ t == TOK_COMPLEX // new !!!
766+ || t == TOK_SIGNED || t == TOK_UNSIGNED || t == TOK_FLOAT ||
767+ t == TOK_DOUBLE || t == TOK_INT8 || t == TOK_INT16 || t == TOK_INT32 ||
768+ t == TOK_INT64 || t == TOK_GCC_INT128 || t == TOK_PTR32 ||
769+ t == TOK_PTR64 || t == TOK_GCC_FLOAT80 || t == TOK_GCC_FLOAT128 ||
770+ t == TOK_VOID || t == TOK_BOOL || t == TOK_CPROVER_BOOL ||
771+ t == TOK_CLASS || t == TOK_STRUCT || t == TOK_UNION || t == TOK_ENUM ||
772+ t == TOK_INTERFACE || t == TOK_TYPENAME || t == TOK_TYPEOF ||
773+ t == TOK_DECLTYPE || t == TOK_UNDERLYING_TYPE;
780774}
781775
782776/*
@@ -1247,8 +1241,7 @@ bool Parser::rTempArgDeclaration(cpp_declarationt &declaration)
12471241
12481242 cpp_tokent tk1, tk2;
12491243
1250- if (lex.get_token (tk1)!=TOK_CLASS ||
1251- !is_identifier (lex.get_token (tk2)))
1244+ if (lex.get_token (tk1) != TOK_CLASS || !is_identifier (lex.get_token (tk2)))
12521245 return false ;
12531246
12541247 // Ptree cspec=new PtreeClassSpec(new LeafReserved(tk1),
@@ -1462,9 +1455,12 @@ bool Parser::rDeclaration(cpp_declarationt &declaration)
14621455 << ' \n ' ;
14631456#endif
14641457
1465- if (cv_q.is_not_nil () &&
1466- ((is_identifier (t) && lex.LookAhead (1 )==' =' ) || t==' *' ))
1458+ if (
1459+ cv_q.is_not_nil () &&
1460+ ((is_identifier (t) && lex.LookAhead (1 ) == ' =' ) || t == ' *' ))
1461+ {
14671462 return rConstDeclaration (declaration);
1463+ }
14681464 else
14691465 return rOtherDeclaration (declaration, storage_spec, member_spec, cv_q);
14701466 }
@@ -3082,8 +3078,9 @@ bool Parser::rDeclarator(
30823078 d_inner.swap (declarator2.type ());
30833079 name.swap (declarator2.name ());
30843080 }
3085- else if (kind!=kCastDeclarator &&
3086- (kind==kDeclarator || is_identifier (t) || t==TOK_SCOPE))
3081+ else if (
3082+ kind != kCastDeclarator &&
3083+ (kind == kDeclarator || is_identifier (t) || t == TOK_SCOPE))
30873084 {
30883085#ifdef DEBUG
30893086 std::cout << std::string (__indent, ' ' ) << " Parser::rDeclarator2 6\n " ;
@@ -3818,31 +3815,33 @@ bool Parser::rPtrToMember(irept &ptr_to_mem)
38183815 break ;
38193816
38203817 case ' <' :
3821- {
3822- irept args;
3823- if (!rTemplateArgs (args))
3824- return false ;
3818+ {
3819+ irept args;
3820+ if (!rTemplateArgs (args))
3821+ return false ;
38253822
3826- components.push_back (irept (ID_template_args));
3827- components.back ().add (ID_arguments).swap (args);
3823+ components.push_back (irept (ID_template_args));
3824+ components.back ().add (ID_arguments).swap (args);
3825+
3826+ if (lex.LookAhead (0 ) != TOK_SCOPE)
3827+ return false ;
38283828
3829- if (lex.LookAhead (0 )!=TOK_SCOPE)
3830- return false ;
3831- }
38323829 break ;
3830+ }
38333831
38343832 case TOK_GCC_IDENTIFIER:
38353833 case TOK_MSC_IDENTIFIER:
3834+ {
38363835 lex.get_token (tk);
38373836 components.push_back (cpp_namet::namet (tk.data .get (ID_C_base_name)));
38383837 set_location (components.back (), tk);
38393838
3840- {
3841- int t=lex.LookAhead (0 );
3842- if (t!=TOK_SCOPE && t!=' <' )
3843- return false ;
3844- }
3839+ int t = lex.LookAhead (0 );
3840+ if (t != TOK_SCOPE && t != ' <' )
3841+ return false ;
3842+
38453843 break ;
3844+ }
38463845
38473846 case TOK_SCOPE:
38483847 lex.get_token (tk);
@@ -4726,10 +4725,12 @@ bool Parser::rClassMember(cpp_itemt &member)
47264725 return rTypedef (member.make_declaration ());
47274726 else if (t==TOK_TEMPLATE)
47284727 return rTemplateDecl (member.make_declaration ());
4729- else if (t==TOK_USING &&
4730- is_identifier (lex.LookAhead (1 )) &&
4731- lex.LookAhead (2 )==' =' )
4728+ else if (
4729+ t == TOK_USING && is_identifier (lex.LookAhead (1 )) &&
4730+ lex.LookAhead (2 ) == ' =' )
4731+ {
47324732 return rTypedefUsing (member.make_declaration ());
4733+ }
47334734 else if (t==TOK_USING)
47344735 return rUsing (member.make_using ());
47354736 else if (t==TOK_STATIC_ASSERT)
@@ -5583,31 +5584,29 @@ bool Parser::rTypeNameOrFunctionType(typet &tname)
55835584 // TODO -- cruel hack for Clang's type_traits:
55845585 // struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param..., ...),
55855586 // true, false>
5586- if (is_identifier (lex.LookAhead (0 )) &&
5587- lex.LookAhead (1 )==TOK_SCOPE &&
5588- lex.LookAhead (2 )==' *' &&
5589- lex.LookAhead (3 )==' )' &&
5590- lex.LookAhead (4 )==' (' )
5587+ if (
5588+ is_identifier (lex.LookAhead (0 )) && lex.LookAhead (1 ) == TOK_SCOPE &&
5589+ lex.LookAhead (2 ) == ' *' && lex.LookAhead (3 ) == ' )' &&
5590+ lex.LookAhead (4 ) == ' (' )
55915591 {
55925592 lex.get_token ();
55935593 lex.get_token ();
55945594 lex.get_token ();
55955595 lex.get_token ();
55965596 lex.get_token ();
55975597 }
5598- else if (is_identifier (lex. LookAhead ( 0 )) &&
5599- lex.LookAhead (1 )== ' )' &&
5600- lex.LookAhead (2 )== ' (' )
5598+ else if (
5599+ is_identifier (lex. LookAhead ( 0 )) && lex.LookAhead (1 ) == ' )' &&
5600+ lex.LookAhead (2 ) == ' (' )
56015601 {
56025602 lex.get_token (op);
56035603 type.set (ID_identifier, op.data .get (ID_C_base_name));
56045604 lex.get_token ();
56055605 lex.get_token ();
56065606 }
5607- else if (lex.LookAhead (0 )==' *' &&
5608- is_identifier (lex.LookAhead (1 )) &&
5609- lex.LookAhead (2 )==' )' &&
5610- lex.LookAhead (3 )==' (' )
5607+ else if (
5608+ lex.LookAhead (0 ) == ' *' && is_identifier (lex.LookAhead (1 )) &&
5609+ lex.LookAhead (2 ) == ' )' && lex.LookAhead (3 ) == ' (' )
56115610 {
56125611 lex.get_token (op);
56135612 lex.get_token (op);
@@ -7075,7 +7074,7 @@ bool Parser::moreVarName()
70757074 if (lex.LookAhead (0 )==TOK_SCOPE)
70767075 {
70777076 int t=lex.LookAhead (1 );
7078- if (is_identifier (t) || t== ' ~' || t== TOK_OPERATOR || t== TOK_TEMPLATE)
7077+ if (is_identifier (t) || t == ' ~' || t == TOK_OPERATOR || t == TOK_TEMPLATE)
70797078 return true ;
70807079 }
70817080
@@ -7506,8 +7505,7 @@ optionalt<codet> Parser::rStatement()
75067505
75077506 case TOK_USING:
75087507 {
7509- if (is_identifier (lex.LookAhead (1 )) &&
7510- lex.LookAhead (2 )==' =' )
7508+ if (is_identifier (lex.LookAhead (1 )) && lex.LookAhead (2 ) == ' =' )
75117509 {
75127510 cpp_declarationt declaration;
75137511 if (!rTypedefUsing (declaration))
@@ -8238,8 +8236,9 @@ optionalt<codet> Parser::rDeclarationStatement()
82388236 << " Parser::rDeclarationStatement 3 " << t << ' \n ' ;
82398237#endif
82408238
8241- if (cv_q.is_not_nil () &&
8242- ((is_identifier (t) && lex.LookAhead (1 )==' =' ) || t==' *' ))
8239+ if (
8240+ cv_q.is_not_nil () &&
8241+ ((is_identifier (t) && lex.LookAhead (1 ) == ' =' ) || t == ' *' ))
82438242 {
82448243#ifdef DEBUG
82458244 std::cout << std::string (__indent, ' ' )
0 commit comments