@@ -1635,12 +1635,11 @@ void foo()
1635
1635
1636
1636
auto ParentMatcher = floatLiteral (hasParent (varDecl (hasName (" i" ))));
1637
1637
1638
- EXPECT_TRUE (
1639
- notMatches (VarDeclCode, traverse (ast_type_traits::TK_AsIs, ParentMatcher)));
1640
- EXPECT_TRUE (
1641
- matches (VarDeclCode,
1642
- traverse (ast_type_traits::TK_IgnoreUnlessSpelledInSource,
1643
- ParentMatcher)));
1638
+ EXPECT_TRUE (notMatches (VarDeclCode,
1639
+ traverse (ast_type_traits::TK_AsIs, ParentMatcher)));
1640
+ EXPECT_TRUE (matches (VarDeclCode,
1641
+ traverse (ast_type_traits::TK_IgnoreUnlessSpelledInSource,
1642
+ ParentMatcher)));
1644
1643
1645
1644
EXPECT_TRUE (
1646
1645
matches (VarDeclCode, decl (traverse (ast_type_traits::TK_AsIs,
@@ -1723,12 +1722,13 @@ void bar()
1723
1722
functionDecl (hasName (" foo" ), traverse (ast_type_traits::TK_AsIs,
1724
1723
hasDescendant (floatLiteral ())))));
1725
1724
1725
+ EXPECT_TRUE (notMatches (Code, traverse (ast_type_traits::TK_AsIs,
1726
+ floatLiteral (hasParent (callExpr (callee (
1727
+ functionDecl (hasName (" foo" )))))))));
1726
1728
EXPECT_TRUE (
1727
- notMatches (Code, traverse (ast_type_traits::TK_AsIs, floatLiteral (hasParent (callExpr (callee (functionDecl (hasName (" foo" )))))))));
1728
- EXPECT_TRUE (
1729
- matches (Code,
1730
- traverse (ast_type_traits::TK_IgnoreUnlessSpelledInSource,
1731
- floatLiteral (hasParent (callExpr (callee (functionDecl (hasName (" foo" )))))))));
1729
+ matches (Code, traverse (ast_type_traits::TK_IgnoreUnlessSpelledInSource,
1730
+ floatLiteral (hasParent (callExpr (
1731
+ callee (functionDecl (hasName (" foo" )))))))));
1732
1732
1733
1733
Code = R"cpp(
1734
1734
void foo()
@@ -1740,10 +1740,10 @@ void foo()
1740
1740
matches (Code,
1741
1741
traverse (ast_type_traits::TK_IgnoreUnlessSpelledInSource,
1742
1742
varDecl (hasInitializer (integerLiteral (equals (3 )))))));
1743
- EXPECT_TRUE (
1744
- matches ( Code,
1745
- traverse (ast_type_traits::TK_IgnoreUnlessSpelledInSource,
1746
- integerLiteral (equals (3 ), hasParent (varDecl (hasName (" i" )))))));
1743
+ EXPECT_TRUE (matches (
1744
+ Code,
1745
+ traverse (ast_type_traits::TK_IgnoreUnlessSpelledInSource,
1746
+ integerLiteral (equals (3 ), hasParent (varDecl (hasName (" i" )))))));
1747
1747
}
1748
1748
1749
1749
template <typename MatcherT>
@@ -1927,8 +1927,9 @@ void func14() {
1927
1927
1928
1928
EXPECT_TRUE (matches (
1929
1929
Code, traverse (ast_type_traits::TK_IgnoreUnlessSpelledInSource,
1930
- integerLiteral (equals (42 ), hasParent (returnStmt (forFunction (functionDecl (hasName (" func1" ))))))
1931
- )));
1930
+ integerLiteral (equals (42 ),
1931
+ hasParent (returnStmt (forFunction (
1932
+ functionDecl (hasName (" func1" )))))))));
1932
1933
1933
1934
EXPECT_TRUE (matches (
1934
1935
Code,
@@ -1939,7 +1940,10 @@ void func14() {
1939
1940
EXPECT_TRUE (matches (
1940
1941
Code,
1941
1942
traverse (ast_type_traits::TK_IgnoreUnlessSpelledInSource,
1942
- integerLiteral (equals (42 ), hasParent (cxxTemporaryObjectExpr (hasParent (returnStmt (forFunction (functionDecl (hasName (" func2" )))))))))));
1943
+ integerLiteral (
1944
+ equals (42 ),
1945
+ hasParent (cxxTemporaryObjectExpr (hasParent (returnStmt (
1946
+ forFunction (functionDecl (hasName (" func2" )))))))))));
1943
1947
1944
1948
EXPECT_TRUE (matches (
1945
1949
Code, traverse (ast_type_traits::TK_IgnoreUnlessSpelledInSource,
@@ -1949,8 +1953,12 @@ void func14() {
1949
1953
integerLiteral (equals (42 )))))))));
1950
1954
1951
1955
EXPECT_TRUE (matches (
1952
- Code, traverse (ast_type_traits::TK_IgnoreUnlessSpelledInSource,
1953
- integerLiteral (equals (42 ), hasParent (cxxFunctionalCastExpr (hasParent (returnStmt (forFunction (functionDecl (hasName (" func3" )))) )))))));
1956
+ Code,
1957
+ traverse (ast_type_traits::TK_IgnoreUnlessSpelledInSource,
1958
+ integerLiteral (
1959
+ equals (42 ),
1960
+ hasParent (cxxFunctionalCastExpr (hasParent (returnStmt (
1961
+ forFunction (functionDecl (hasName (" func3" )))))))))));
1954
1962
1955
1963
EXPECT_TRUE (matches (
1956
1964
Code, traverse (ast_type_traits::TK_IgnoreUnlessSpelledInSource,
@@ -1992,7 +2000,9 @@ void func14() {
1992
2000
1993
2001
EXPECT_TRUE (matches (
1994
2002
Code, traverse (ast_type_traits::TK_IgnoreUnlessSpelledInSource,
1995
- declRefExpr (to (varDecl (hasName (" a" ))), hasParent (returnStmt (forFunction (functionDecl (hasName (" func10" )))))))));
2003
+ declRefExpr (to (varDecl (hasName (" a" ))),
2004
+ hasParent (returnStmt (forFunction (
2005
+ functionDecl (hasName (" func10" )))))))));
1996
2006
1997
2007
EXPECT_TRUE (matches (
1998
2008
Code, traverse (ast_type_traits::TK_IgnoreUnlessSpelledInSource,
@@ -2002,8 +2012,9 @@ void func14() {
2002
2012
2003
2013
EXPECT_TRUE (matches (
2004
2014
Code, traverse (ast_type_traits::TK_IgnoreUnlessSpelledInSource,
2005
- declRefExpr (to (varDecl (hasName (" b" ))), hasParent (returnStmt (forFunction (functionDecl (hasName (" func11" ))))))
2006
- )));
2015
+ declRefExpr (to (varDecl (hasName (" b" ))),
2016
+ hasParent (returnStmt (forFunction (
2017
+ functionDecl (hasName (" func11" )))))))));
2007
2018
2008
2019
EXPECT_TRUE (matches (
2009
2020
Code, traverse (ast_type_traits::TK_IgnoreUnlessSpelledInSource,
@@ -2013,8 +2024,9 @@ void func14() {
2013
2024
2014
2025
EXPECT_TRUE (matches (
2015
2026
Code, traverse (ast_type_traits::TK_IgnoreUnlessSpelledInSource,
2016
- declRefExpr (to (varDecl (hasName (" c" ))), hasParent (returnStmt (forFunction (functionDecl (hasName (" func12" ))))))
2017
- )));
2027
+ declRefExpr (to (varDecl (hasName (" c" ))),
2028
+ hasParent (returnStmt (forFunction (
2029
+ functionDecl (hasName (" func12" )))))))));
2018
2030
2019
2031
EXPECT_TRUE (matches (
2020
2032
Code,
@@ -2028,17 +2040,18 @@ void func14() {
2028
2040
has (parmVarDecl (hasName (" d" )))))));
2029
2041
2030
2042
EXPECT_TRUE (matches (
2031
- Code,
2032
- traverse (
2033
- ast_type_traits::TK_IgnoreUnlessSpelledInSource,
2034
- declRefExpr ( to ( varDecl ( hasName ( " a " ))), hasParent ( lambdaExpr ( forFunction ( functionDecl (hasName (" func13" )))) )))));
2043
+ Code, traverse (ast_type_traits::TK_IgnoreUnlessSpelledInSource,
2044
+ declRefExpr ( to ( varDecl ( hasName ( " a " ))),
2045
+ hasParent ( lambdaExpr ( forFunction (
2046
+ functionDecl (hasName (" func13" )))))))));
2035
2047
2036
2048
EXPECT_TRUE (matches (
2037
2049
Code,
2038
- traverse (
2039
- ast_type_traits::TK_IgnoreUnlessSpelledInSource,
2040
- varDecl (hasName (" b" ), hasInitializer (declRefExpr (to (
2041
- varDecl (hasName (" c" ))))), hasParent ( lambdaExpr (forFunction (functionDecl (hasName (" func13" )))) )))));
2050
+ traverse (ast_type_traits::TK_IgnoreUnlessSpelledInSource,
2051
+ varDecl (hasName (" b" ),
2052
+ hasInitializer (declRefExpr (to (varDecl (hasName (" c" ))))),
2053
+ hasParent (lambdaExpr (
2054
+ forFunction (functionDecl (hasName (" func13" )))))))));
2042
2055
2043
2056
EXPECT_TRUE (matches (
2044
2057
Code, traverse (ast_type_traits::TK_IgnoreUnlessSpelledInSource,
0 commit comments