@@ -778,7 +778,7 @@ bool Parser::isTypeSpecifier()
778
778
t == TOK_CPROVER_BOOL || t == TOK_CLASS || t == TOK_STRUCT ||
779
779
t == TOK_UNION || t == TOK_ENUM || t == TOK_INTERFACE ||
780
780
t == TOK_TYPENAME || t == TOK_TYPEOF || t == TOK_DECLTYPE ||
781
- t == TOK_UNDERLYING_TYPE;
781
+ t == TOK_UNDERLYING_TYPE || t == TOK_ATOMIC_TYPE_SPECIFIER ;
782
782
}
783
783
784
784
/*
@@ -1343,7 +1343,7 @@ bool Parser::rTempArgDeclaration(cpp_declarationt &declaration)
1343
1343
if (lex.get_token (tk1) != TOK_CLASS)
1344
1344
return false ;
1345
1345
1346
- if (lex.LookAhead (0 ) == ' ,' )
1346
+ if (lex.LookAhead (0 ) == ' ,' || lex. LookAhead ( 0 ) == ' > ' )
1347
1347
return true ;
1348
1348
1349
1349
if (!is_identifier (lex.get_token (tk2)))
@@ -2502,6 +2502,17 @@ bool Parser::optAttribute(typet &t)
2502
2502
break ;
2503
2503
}
2504
2504
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
+
2505
2516
default :
2506
2517
// TODO: way may wish to change this: GCC, Clang, Visual Studio merely
2507
2518
// warn when they see an attribute that they don't recognize
@@ -2737,8 +2748,34 @@ bool Parser::optIntegralTypeOrClassSpec(typet &p)
2737
2748
2738
2749
return true ;
2739
2750
}
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
+ }
2740
2773
else
2741
2774
{
2775
+ #ifdef DEBUG
2776
+ std::cout << std::string (__indent, ' ' )
2777
+ << " Parser::optIntegralTypeOrClassSpec 10\n " ;
2778
+ #endif // DEBUG
2742
2779
p.make_nil ();
2743
2780
return true ;
2744
2781
}
@@ -4549,6 +4586,9 @@ bool Parser::rEnumSpec(typet &spec)
4549
4586
spec.set (ID_C_class, true );
4550
4587
}
4551
4588
4589
+ if (!optAttribute (spec))
4590
+ return false ;
4591
+
4552
4592
if (lex.LookAhead (0 )!=' {' &&
4553
4593
lex.LookAhead (0 )!=' :' )
4554
4594
{
@@ -7903,7 +7943,9 @@ std::optional<codet> Parser::rStatement()
7903
7943
if (!rUsing (cpp_using))
7904
7944
return {};
7905
7945
7906
- UNIMPLEMENTED;
7946
+ codet statement (ID_cpp_using);
7947
+ // UNIMPLEMENTED;
7948
+ return std::move (statement);
7907
7949
}
7908
7950
7909
7951
case TOK_STATIC_ASSERT:
@@ -7920,6 +7962,14 @@ std::optional<codet> Parser::rStatement()
7920
7962
return std::move (statement);
7921
7963
}
7922
7964
7965
+ case ' [' :
7966
+ {
7967
+ typet discard;
7968
+ if (!optAttribute (discard))
7969
+ return {};
7970
+ return code_blockt{};
7971
+ }
7972
+
7923
7973
default :
7924
7974
return rExprStatement ();
7925
7975
}
0 commit comments