If you need to check that a single location is not inside a macro, you can use SourceLocation::isFileID(). If you need to check that a range is on the same level of macro expansion (so that you don’t suggest replacements of source ranges spanning macro boundaries), you can call Lexer::makeFileCharRange(). You can also combine both to check that a whole range is not inside a macro expansion.