Avoid generating replacement text for code expanded from macros with clang-tidy

I’m finishing up a clang-tidy check for uninitialized fields.

How can I prevent replacement text being generated when the class or constructor is part of a macro expansion?

I’m getting a few silly replacement suggestions when running the check over llvm source.

thanks,

Jon

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.

– Alex