@@ -778,7 +778,7 @@ bool Parser::isTypeSpecifier()
778778 t == TOK_CPROVER_BOOL || t == TOK_CLASS || t == TOK_STRUCT ||
779779 t == TOK_UNION || t == TOK_ENUM || t == TOK_INTERFACE ||
780780 t == TOK_TYPENAME || t == TOK_TYPEOF || t == TOK_DECLTYPE ||
781- t == TOK_UNDERLYING_TYPE;
781+ t == TOK_UNDERLYING_TYPE || t == TOK_ATOMIC_TYPE_SPECIFIER ;
782782}
783783
784784/*
@@ -1343,7 +1343,7 @@ bool Parser::rTempArgDeclaration(cpp_declarationt &declaration)
13431343 if (lex.get_token (tk1) != TOK_CLASS)
13441344 return false ;
13451345
1346- if (lex.LookAhead (0 ) == ' ,' )
1346+ if (lex.LookAhead (0 ) == ' ,' || lex. LookAhead ( 0 ) == ' > ' )
13471347 return true ;
13481348
13491349 if (!is_identifier (lex.get_token (tk2)))
@@ -2502,6 +2502,17 @@ bool Parser::optAttribute(typet &t)
25022502 break ;
25032503 }
25042504
2505+ case TOK_GCC_IDENTIFIER:
2506+ if (tk.text == " clang" && lex.LookAhead (0 ) == TOK_SCOPE)
2507+ {
2508+ exprt discarded;
2509+ if (!rExpression (discarded, false ))
2510+ return false ;
2511+ }
2512+ else
2513+ return false ;
2514+ break ;
2515+
25052516 default :
25062517 // TODO: way may wish to change this: GCC, Clang, Visual Studio merely
25072518 // warn when they see an attribute that they don't recognize
@@ -2737,8 +2748,34 @@ bool Parser::optIntegralTypeOrClassSpec(typet &p)
27372748
27382749 return true ;
27392750 }
2751+ else if (t == TOK_ATOMIC_TYPE_SPECIFIER)
2752+ {
2753+ #ifdef DEBUG
2754+ std::cout << std::string (__indent, ' ' )
2755+ << " Parser::optIntegralTypeOrClassSpec 9\n " ;
2756+ #endif // DEBUG
2757+ cpp_tokent atomic_tk;
2758+ lex.get_token (atomic_tk);
2759+
2760+ cpp_tokent tk;
2761+ if (lex.get_token (tk)!=' (' )
2762+ return false ;
2763+
2764+ // the argument is always a type
2765+ if (!rTypeSpecifier (p, false ))
2766+ return false ;
2767+
2768+ if (lex.get_token (tk)!=' )' )
2769+ return false ;
2770+
2771+ return true ;
2772+ }
27402773 else
27412774 {
2775+ #ifdef DEBUG
2776+ std::cout << std::string (__indent, ' ' )
2777+ << " Parser::optIntegralTypeOrClassSpec 10\n " ;
2778+ #endif // DEBUG
27422779 p.make_nil ();
27432780 return true ;
27442781 }
@@ -4549,6 +4586,9 @@ bool Parser::rEnumSpec(typet &spec)
45494586 spec.set (ID_C_class, true );
45504587 }
45514588
4589+ if (!optAttribute (spec))
4590+ return false ;
4591+
45524592 if (lex.LookAhead (0 )!=' {' &&
45534593 lex.LookAhead (0 )!=' :' )
45544594 {
@@ -7903,7 +7943,9 @@ std::optional<codet> Parser::rStatement()
79037943 if (!rUsing (cpp_using))
79047944 return {};
79057945
7906- UNIMPLEMENTED;
7946+ codet statement (ID_cpp_using);
7947+ // UNIMPLEMENTED;
7948+ return std::move (statement);
79077949 }
79087950
79097951 case TOK_STATIC_ASSERT:
@@ -7920,6 +7962,14 @@ std::optional<codet> Parser::rStatement()
79207962 return std::move (statement);
79217963 }
79227964
7965+ case ' [' :
7966+ {
7967+ typet discard;
7968+ if (!optAttribute (discard))
7969+ return {};
7970+ return code_blockt{};
7971+ }
7972+
79237973 default :
79247974 return rExprStatement ();
79257975 }
0 commit comments