@@ -950,10 +950,14 @@ TEST(TemplateTypeParmDecl, VarTemplatePartialSpecializationDecl) {
950
950
" template<typename U>\n "
951
951
" template<typename U2>\n "
952
952
" int Struct<U>::field<U2*> = 123;\n " ;
953
- EXPECT_TRUE (matches (input, templateTypeParmDecl (hasName (" T" ))));
954
- EXPECT_TRUE (matches (input, templateTypeParmDecl (hasName (" T2" ))));
955
- EXPECT_TRUE (matches (input, templateTypeParmDecl (hasName (" U" ))));
956
- EXPECT_TRUE (matches (input, templateTypeParmDecl (hasName (" U2" ))));
953
+ EXPECT_TRUE (
954
+ matches (input, templateTypeParmDecl (hasName (" T" )), LanguageMode::Cxx14));
955
+ EXPECT_TRUE (
956
+ matches (input, templateTypeParmDecl (hasName (" T2" )), LanguageMode::Cxx14));
957
+ EXPECT_TRUE (
958
+ matches (input, templateTypeParmDecl (hasName (" U" )), LanguageMode::Cxx14));
959
+ EXPECT_TRUE (
960
+ matches (input, templateTypeParmDecl (hasName (" U2" )), LanguageMode::Cxx14));
957
961
}
958
962
959
963
TEST (TemplateTypeParmDecl, ClassTemplatePartialSpecializationDecl) {
@@ -2061,113 +2065,146 @@ void func14() {
2061
2065
2062
2066
)cpp" ;
2063
2067
2064
- EXPECT_TRUE (matches (
2065
- Code, traverse (TK_IgnoreUnlessSpelledInSource,
2066
- returnStmt (forFunction (functionDecl (hasName (" func1" ))),
2067
- hasReturnValue (integerLiteral (equals (42 )))))));
2068
+ EXPECT_TRUE (
2069
+ matches (Code,
2070
+ traverse (TK_IgnoreUnlessSpelledInSource,
2071
+ returnStmt (forFunction (functionDecl (hasName (" func1" ))),
2072
+ hasReturnValue (integerLiteral (equals (42 ))))),
2073
+ LanguageMode::Cxx2a));
2068
2074
2069
- EXPECT_TRUE (matches (
2070
- Code, traverse (TK_IgnoreUnlessSpelledInSource,
2071
- integerLiteral (equals (42 ),
2072
- hasParent (returnStmt (forFunction (
2073
- functionDecl (hasName (" func1" )))))))));
2075
+ EXPECT_TRUE (
2076
+ matches (Code,
2077
+ traverse (TK_IgnoreUnlessSpelledInSource,
2078
+ integerLiteral (equals (42 ),
2079
+ hasParent (returnStmt (forFunction (
2080
+ functionDecl (hasName (" func1" ))))))),
2081
+ LanguageMode::Cxx2a));
2074
2082
2075
2083
EXPECT_TRUE (matches (
2076
2084
Code,
2077
2085
traverse (TK_IgnoreUnlessSpelledInSource,
2078
2086
returnStmt (forFunction (functionDecl (hasName (" func2" ))),
2079
2087
hasReturnValue (cxxTemporaryObjectExpr (
2080
- hasArgument (0 , integerLiteral (equals (42 )))))))));
2088
+ hasArgument (0 , integerLiteral (equals (42 ))))))),
2089
+ LanguageMode::Cxx2a));
2081
2090
EXPECT_TRUE (matches (
2082
2091
Code,
2083
- traverse (TK_IgnoreUnlessSpelledInSource,
2084
- integerLiteral (
2085
- equals (42 ),
2086
- hasParent (cxxTemporaryObjectExpr (hasParent (returnStmt (
2087
- forFunction (functionDecl (hasName (" func2" )))))))))));
2092
+ traverse (
2093
+ TK_IgnoreUnlessSpelledInSource,
2094
+ integerLiteral (equals (42 ),
2095
+ hasParent (cxxTemporaryObjectExpr (hasParent (returnStmt (
2096
+ forFunction (functionDecl (hasName (" func2" ))))))))),
2097
+ LanguageMode::Cxx2a));
2088
2098
2089
2099
EXPECT_TRUE (matches (
2090
- Code, traverse (TK_IgnoreUnlessSpelledInSource,
2091
- returnStmt (forFunction (functionDecl (hasName (" func3" ))),
2092
- hasReturnValue (
2093
- cxxFunctionalCastExpr (hasSourceExpression (
2094
- integerLiteral (equals (42 )))))))));
2100
+ Code,
2101
+ traverse (
2102
+ TK_IgnoreUnlessSpelledInSource,
2103
+ returnStmt (forFunction (functionDecl (hasName (" func3" ))),
2104
+ hasReturnValue (cxxFunctionalCastExpr (
2105
+ hasSourceExpression (integerLiteral (equals (42 ))))))),
2106
+ LanguageMode::Cxx2a));
2095
2107
2096
2108
EXPECT_TRUE (matches (
2097
2109
Code,
2098
- traverse (TK_IgnoreUnlessSpelledInSource,
2099
- integerLiteral (
2100
- equals (42 ),
2101
- hasParent (cxxFunctionalCastExpr (hasParent (returnStmt (
2102
- forFunction (functionDecl (hasName (" func3" )))))))))));
2110
+ traverse (
2111
+ TK_IgnoreUnlessSpelledInSource,
2112
+ integerLiteral (equals (42 ),
2113
+ hasParent (cxxFunctionalCastExpr (hasParent (returnStmt (
2114
+ forFunction (functionDecl (hasName (" func3" ))))))))),
2115
+ LanguageMode::Cxx2a));
2103
2116
2104
- EXPECT_TRUE (matches (
2105
- Code, traverse (TK_IgnoreUnlessSpelledInSource,
2106
- returnStmt (forFunction (functionDecl (hasName (" func4" ))),
2107
- hasReturnValue (cxxTemporaryObjectExpr ())))));
2117
+ EXPECT_TRUE (
2118
+ matches (Code,
2119
+ traverse (TK_IgnoreUnlessSpelledInSource,
2120
+ returnStmt (forFunction (functionDecl (hasName (" func4" ))),
2121
+ hasReturnValue (cxxTemporaryObjectExpr ()))),
2122
+ LanguageMode::Cxx2a));
2108
2123
2109
- EXPECT_TRUE (matches (
2110
- Code, traverse (TK_IgnoreUnlessSpelledInSource,
2111
- returnStmt (forFunction (functionDecl (hasName (" func5" ))),
2112
- hasReturnValue (cxxTemporaryObjectExpr ())))));
2124
+ EXPECT_TRUE (
2125
+ matches (Code,
2126
+ traverse (TK_IgnoreUnlessSpelledInSource,
2127
+ returnStmt (forFunction (functionDecl (hasName (" func5" ))),
2128
+ hasReturnValue (cxxTemporaryObjectExpr ()))),
2129
+ LanguageMode::Cxx2a));
2113
2130
2114
- EXPECT_TRUE (matches (
2115
- Code, traverse (TK_IgnoreUnlessSpelledInSource,
2116
- returnStmt (forFunction (functionDecl (hasName (" func6" ))),
2117
- hasReturnValue (cxxTemporaryObjectExpr ())))));
2131
+ EXPECT_TRUE (
2132
+ matches (Code,
2133
+ traverse (TK_IgnoreUnlessSpelledInSource,
2134
+ returnStmt (forFunction (functionDecl (hasName (" func6" ))),
2135
+ hasReturnValue (cxxTemporaryObjectExpr ()))),
2136
+ LanguageMode::Cxx2a));
2118
2137
2119
- EXPECT_TRUE (matches (
2120
- Code, traverse (TK_IgnoreUnlessSpelledInSource,
2121
- returnStmt (forFunction (functionDecl (hasName (" func7" ))),
2122
- hasReturnValue (cxxTemporaryObjectExpr ())))));
2138
+ EXPECT_TRUE (
2139
+ matches (Code,
2140
+ traverse (TK_IgnoreUnlessSpelledInSource,
2141
+ returnStmt (forFunction (functionDecl (hasName (" func7" ))),
2142
+ hasReturnValue (cxxTemporaryObjectExpr ()))),
2143
+ LanguageMode::Cxx2a));
2123
2144
2124
- EXPECT_TRUE (matches (
2125
- Code, traverse (TK_IgnoreUnlessSpelledInSource,
2126
- returnStmt (forFunction (functionDecl (hasName (" func8" ))),
2127
- hasReturnValue (cxxFunctionalCastExpr (
2128
- hasSourceExpression (initListExpr ())))))));
2145
+ EXPECT_TRUE (
2146
+ matches (Code,
2147
+ traverse (TK_IgnoreUnlessSpelledInSource,
2148
+ returnStmt (forFunction (functionDecl (hasName (" func8" ))),
2149
+ hasReturnValue (cxxFunctionalCastExpr (
2150
+ hasSourceExpression (initListExpr ()))))),
2151
+ LanguageMode::Cxx2a));
2129
2152
2130
- EXPECT_TRUE (matches (
2131
- Code, traverse (TK_IgnoreUnlessSpelledInSource,
2132
- returnStmt (forFunction (functionDecl (hasName (" func9" ))),
2133
- hasReturnValue (cxxFunctionalCastExpr (
2134
- hasSourceExpression (initListExpr ())))))));
2153
+ EXPECT_TRUE (
2154
+ matches (Code,
2155
+ traverse (TK_IgnoreUnlessSpelledInSource,
2156
+ returnStmt (forFunction (functionDecl (hasName (" func9" ))),
2157
+ hasReturnValue (cxxFunctionalCastExpr (
2158
+ hasSourceExpression (initListExpr ()))))),
2159
+ LanguageMode::Cxx2a));
2135
2160
2136
2161
EXPECT_TRUE (matches (
2137
- Code, traverse (TK_IgnoreUnlessSpelledInSource,
2138
- returnStmt (forFunction (functionDecl (hasName (" func10" ))),
2139
- hasReturnValue (
2140
- declRefExpr (to (varDecl (hasName (" a" )))))))));
2162
+ Code,
2163
+ traverse (
2164
+ TK_IgnoreUnlessSpelledInSource,
2165
+ returnStmt (forFunction (functionDecl (hasName (" func10" ))),
2166
+ hasReturnValue (declRefExpr (to (varDecl (hasName (" a" ))))))),
2167
+ LanguageMode::Cxx2a));
2141
2168
2142
- EXPECT_TRUE (matches (
2143
- Code, traverse (TK_IgnoreUnlessSpelledInSource,
2144
- declRefExpr (to (varDecl (hasName (" a" ))),
2145
- hasParent (returnStmt (forFunction (
2146
- functionDecl (hasName (" func10" )))))))));
2169
+ EXPECT_TRUE (
2170
+ matches (Code,
2171
+ traverse (TK_IgnoreUnlessSpelledInSource,
2172
+ declRefExpr (to (varDecl (hasName (" a" ))),
2173
+ hasParent (returnStmt (forFunction (
2174
+ functionDecl (hasName (" func10" ))))))),
2175
+ LanguageMode::Cxx2a));
2147
2176
2148
2177
EXPECT_TRUE (matches (
2149
- Code, traverse (TK_IgnoreUnlessSpelledInSource,
2150
- returnStmt (forFunction (functionDecl (hasName (" func11" ))),
2151
- hasReturnValue (
2152
- declRefExpr (to (varDecl (hasName (" b" )))))))));
2178
+ Code,
2179
+ traverse (
2180
+ TK_IgnoreUnlessSpelledInSource,
2181
+ returnStmt (forFunction (functionDecl (hasName (" func11" ))),
2182
+ hasReturnValue (declRefExpr (to (varDecl (hasName (" b" ))))))),
2183
+ LanguageMode::Cxx2a));
2153
2184
2154
- EXPECT_TRUE (matches (
2155
- Code, traverse (TK_IgnoreUnlessSpelledInSource,
2156
- declRefExpr (to (varDecl (hasName (" b" ))),
2157
- hasParent (returnStmt (forFunction (
2158
- functionDecl (hasName (" func11" )))))))));
2185
+ EXPECT_TRUE (
2186
+ matches (Code,
2187
+ traverse (TK_IgnoreUnlessSpelledInSource,
2188
+ declRefExpr (to (varDecl (hasName (" b" ))),
2189
+ hasParent (returnStmt (forFunction (
2190
+ functionDecl (hasName (" func11" ))))))),
2191
+ LanguageMode::Cxx2a));
2159
2192
2160
2193
EXPECT_TRUE (matches (
2161
- Code, traverse (TK_IgnoreUnlessSpelledInSource,
2162
- returnStmt (forFunction (functionDecl (hasName (" func12" ))),
2163
- hasReturnValue (
2164
- declRefExpr (to (varDecl (hasName (" c" )))))))));
2194
+ Code,
2195
+ traverse (
2196
+ TK_IgnoreUnlessSpelledInSource,
2197
+ returnStmt (forFunction (functionDecl (hasName (" func12" ))),
2198
+ hasReturnValue (declRefExpr (to (varDecl (hasName (" c" ))))))),
2199
+ LanguageMode::Cxx2a));
2165
2200
2166
- EXPECT_TRUE (matches (
2167
- Code, traverse (TK_IgnoreUnlessSpelledInSource,
2168
- declRefExpr (to (varDecl (hasName (" c" ))),
2169
- hasParent (returnStmt (forFunction (
2170
- functionDecl (hasName (" func12" )))))))));
2201
+ EXPECT_TRUE (
2202
+ matches (Code,
2203
+ traverse (TK_IgnoreUnlessSpelledInSource,
2204
+ declRefExpr (to (varDecl (hasName (" c" ))),
2205
+ hasParent (returnStmt (forFunction (
2206
+ functionDecl (hasName (" func12" ))))))),
2207
+ LanguageMode::Cxx2a));
2171
2208
2172
2209
EXPECT_TRUE (matches (
2173
2210
Code,
@@ -2178,32 +2215,38 @@ void func14() {
2178
2215
has (declRefExpr (to (varDecl (hasName (" a" ))))),
2179
2216
has (varDecl (hasName (" b" ), hasInitializer (declRefExpr (to (
2180
2217
varDecl (hasName (" c" ))))))),
2181
- has (parmVarDecl (hasName (" d" )))))));
2218
+ has (parmVarDecl (hasName (" d" ))))),
2219
+ LanguageMode::Cxx2a));
2182
2220
2183
- EXPECT_TRUE (matches (
2184
- Code, traverse (TK_IgnoreUnlessSpelledInSource,
2185
- declRefExpr (to (varDecl (hasName (" a" ))),
2186
- hasParent (lambdaExpr (forFunction (
2187
- functionDecl (hasName (" func13" )))))))));
2221
+ EXPECT_TRUE (
2222
+ matches (Code,
2223
+ traverse (TK_IgnoreUnlessSpelledInSource,
2224
+ declRefExpr (to (varDecl (hasName (" a" ))),
2225
+ hasParent (lambdaExpr (forFunction (
2226
+ functionDecl (hasName (" func13" ))))))),
2227
+ LanguageMode::Cxx2a));
2188
2228
2189
2229
EXPECT_TRUE (matches (
2190
2230
Code,
2191
2231
traverse (TK_IgnoreUnlessSpelledInSource,
2192
2232
varDecl (hasName (" b" ),
2193
2233
hasInitializer (declRefExpr (to (varDecl (hasName (" c" ))))),
2194
2234
hasParent (lambdaExpr (
2195
- forFunction (functionDecl (hasName (" func13" )))))))));
2235
+ forFunction (functionDecl (hasName (" func13" ))))))),
2236
+ LanguageMode::Cxx2a));
2196
2237
2197
2238
EXPECT_TRUE (matches (
2198
- Code, traverse (TK_IgnoreUnlessSpelledInSource,
2199
- lambdaExpr (
2200
- forFunction (functionDecl (hasName (" func14" ))),
2201
- has (templateTypeParmDecl (hasName (" TemplateType" )))))));
2239
+ Code,
2240
+ traverse (TK_IgnoreUnlessSpelledInSource,
2241
+ lambdaExpr (forFunction (functionDecl (hasName (" func14" ))),
2242
+ has (templateTypeParmDecl (hasName (" TemplateType" ))))),
2243
+ LanguageMode::Cxx2a));
2202
2244
2203
- EXPECT_TRUE (
2204
- matches (Code, traverse (TK_IgnoreUnlessSpelledInSource,
2205
- functionDecl (hasName (" func14" ),
2206
- hasDescendant (floatLiteral ())))));
2245
+ EXPECT_TRUE (matches (
2246
+ Code,
2247
+ traverse (TK_IgnoreUnlessSpelledInSource,
2248
+ functionDecl (hasName (" func14" ), hasDescendant (floatLiteral ()))),
2249
+ LanguageMode::Cxx2a));
2207
2250
}
2208
2251
2209
2252
TEST (IgnoringImpCasts, MatchesImpCasts) {
0 commit comments