File tree 1 file changed +7
-5
lines changed 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -141,11 +141,6 @@ fn handle_function_macro(
141
141
tokens : & [ ClangToken ] ,
142
142
callbacks : & dyn crate :: callbacks:: ParseCallbacks ,
143
143
) -> Result < ( ) , ParseError > {
144
- let mut spelled = tokens. iter ( ) . map ( ClangToken :: spelling) ;
145
- let boundary = spelled
146
- . clone ( ) // clone the iterator to avoid consuming elements
147
- . position ( |s| s == b")" ) ;
148
-
149
144
fn is_abutting ( a : & ClangToken , b : & ClangToken ) -> bool {
150
145
unsafe {
151
146
clang_sys:: clang_equalLocations (
@@ -176,6 +171,13 @@ fn handle_function_macro(
176
171
return Ok ( ( ) ) ;
177
172
}
178
173
174
+ let is_closing_paren = |t : & ClangToken | {
175
+ // Test cheap token kind before comparing exact spellings.
176
+ t. kind == clang_sys:: CXToken_Punctuation && t. spelling ( ) == b")"
177
+ } ;
178
+ let boundary = tokens. iter ( ) . position ( is_closing_paren) ;
179
+
180
+ let mut spelled = tokens. iter ( ) . map ( ClangToken :: spelling) ;
179
181
// Add 1, to convert index to length.
180
182
let left = spelled
181
183
. by_ref ( )
You can’t perform that action at this time.
0 commit comments