@@ -1017,6 +1017,49 @@ TEST_P(ASTMatchersTest, FloatLiteral) {
10171017 notMatches (" double i = 5.0;" , floatLiteral (equals (llvm::APFloat (6.0 )))));
10181018}
10191019
1020+ TEST_P (ASTMatchersTest, FixedPointLiterals) {
1021+ StatementMatcher HasFixedPointLiteral = fixedPointLiteral ();
1022+ EXPECT_TRUE (matchesWithFixedpoint (" _Fract i = 0.25r;" , HasFixedPointLiteral));
1023+ EXPECT_TRUE (
1024+ matchesWithFixedpoint (" _Fract i = 0.25hr;" , HasFixedPointLiteral));
1025+ EXPECT_TRUE (
1026+ matchesWithFixedpoint (" _Fract i = 0.25uhr;" , HasFixedPointLiteral));
1027+ EXPECT_TRUE (
1028+ matchesWithFixedpoint (" _Fract i = 0.25ur;" , HasFixedPointLiteral));
1029+ EXPECT_TRUE (
1030+ matchesWithFixedpoint (" _Fract i = 0.25lr;" , HasFixedPointLiteral));
1031+ EXPECT_TRUE (
1032+ matchesWithFixedpoint (" _Fract i = 0.25ulr;" , HasFixedPointLiteral));
1033+ EXPECT_TRUE (matchesWithFixedpoint (" _Accum i = 1.25k;" , HasFixedPointLiteral));
1034+ EXPECT_TRUE (
1035+ matchesWithFixedpoint (" _Accum i = 1.25hk;" , HasFixedPointLiteral));
1036+ EXPECT_TRUE (
1037+ matchesWithFixedpoint (" _Accum i = 1.25uhk;" , HasFixedPointLiteral));
1038+ EXPECT_TRUE (
1039+ matchesWithFixedpoint (" _Accum i = 1.25uk;" , HasFixedPointLiteral));
1040+ EXPECT_TRUE (
1041+ matchesWithFixedpoint (" _Accum i = 1.25lk;" , HasFixedPointLiteral));
1042+ EXPECT_TRUE (
1043+ matchesWithFixedpoint (" _Accum i = 1.25ulk;" , HasFixedPointLiteral));
1044+ EXPECT_TRUE (matchesWithFixedpoint (" _Accum decexp1 = 1.575e1k;" ,
1045+ HasFixedPointLiteral));
1046+ EXPECT_TRUE (
1047+ matchesWithFixedpoint (" _Accum hex = 0x1.25fp2k;" , HasFixedPointLiteral));
1048+ EXPECT_TRUE (matchesWithFixedpoint (" _Sat long _Fract i = 0.25r;" ,
1049+ HasFixedPointLiteral));
1050+ EXPECT_TRUE (matchesWithFixedpoint (" _Sat short _Accum i = 256.0k;" ,
1051+ HasFixedPointLiteral));
1052+
1053+ EXPECT_TRUE (
1054+ notMatchesWithFixedpoint (" short _Accum i = 2u;" , HasFixedPointLiteral));
1055+ EXPECT_TRUE (
1056+ notMatchesWithFixedpoint (" short _Accum i = 2;" , HasFixedPointLiteral));
1057+ EXPECT_TRUE (
1058+ notMatchesWithFixedpoint (" _Accum i = 1.25;" , HasFixedPointLiteral));
1059+ EXPECT_TRUE (notMatchesWithFixedpoint (" _Accum i = 1.25 * 4.5i;" ,
1060+ HasFixedPointLiteral));
1061+ }
1062+
10201063TEST_P (ASTMatchersTest, CXXNullPtrLiteralExpr) {
10211064 if (!GetParam ().isCXX11OrLater ()) {
10221065 return ;
0 commit comments