File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -335,6 +335,28 @@ class Lexer : public PreprocessorLexer {
335
335
// /
336
336
// / Returns a null range if a part of the range resides inside a macro
337
337
// / expansion or the range does not reside on the same FileID.
338
+ // /
339
+ // / This function is trying to deal with macros and return a range based on
340
+ // / file locations. The cases where it can successfully handle macros are:
341
+ // /
342
+ // / -begin or end range lies at the start or end of a macro expansion, in
343
+ // / which case the location will be set to the expansion point, e.g:
344
+ // / #define M 1 2
345
+ // / a M
346
+ // / If you have a range [a, 2] (where 2 came from the macro), the function
347
+ // / will return a range for "a M"
348
+ // / if you have range [a, 1], the function will fail because the range
349
+ // / overlaps with only a part of the macro
350
+ // /
351
+ // / -The macro is a function macro and the range can be mapped to the macro
352
+ // / arguments, e.g:
353
+ // / #define M 1 2
354
+ // / #define FM(x) x
355
+ // / FM(a b M)
356
+ // / if you have range [b, 2], the function will return the file range "b M"
357
+ // / inside the macro arguments.
358
+ // / if you have range [a, 2], the function will return the file range
359
+ // / "FM(a b M)" since the range includes all of the macro expansion.
338
360
static CharSourceRange makeFileCharRange (CharSourceRange Range,
339
361
const SourceManager &SM,
340
362
const LangOptions &LangOpts);
You can’t perform that action at this time.
0 commit comments