@@ -141,31 +141,10 @@ fn handle_function_macro(
141
141
tokens : & [ ClangToken ] ,
142
142
callbacks : & dyn crate :: callbacks:: ParseCallbacks ,
143
143
) -> Result < ( ) , ParseError > {
144
- fn is_abutting ( a : & ClangToken , b : & ClangToken ) -> bool {
145
- unsafe {
146
- clang_sys:: clang_equalLocations (
147
- clang_sys:: clang_getRangeEnd ( a. extent ) ,
148
- clang_sys:: clang_getRangeStart ( b. extent ) ,
149
- ) != 0
150
- }
151
- }
152
-
153
- let is_functional_macro =
154
- // If we have libclang >= 3.9, we can use `is_macro_function_like()` and
155
- // avoid checking for abutting tokens ourselves.
156
- cursor. is_macro_function_like ( ) . unwrap_or_else ( || {
157
- // If we cannot get a definitive answer from clang, we instead check
158
- // for a parenthesis token immediately adjacent to (that is,
159
- // abutting) the first token in the macro definition.
160
- // TODO: Once we don't need the fallback check here, we can hoist
161
- // the `is_macro_function_like` check into this function's caller,
162
- // and thus avoid allocating the `tokens` vector for non-functional
163
- // macros.
164
- match tokens. get ( 0 ..2 ) {
165
- Some ( [ a, b] ) => is_abutting ( & a, & b) && b. spelling ( ) == b"(" ,
166
- _ => false ,
167
- }
168
- } ) ;
144
+ // TODO: Hoist the `is_macro_function_like` check into this function's
145
+ // caller, and thus avoid allocating the `tokens` vector for non-functional
146
+ // macros.
147
+ let is_functional_macro = cursor. is_macro_function_like ( ) ;
169
148
170
149
if !is_functional_macro {
171
150
return Ok ( ( ) ) ;
0 commit comments