[cfe-dev] Avoid generating replacement text for code expanded from macros with clang-tidy

Alexander Kornienko alexfh at google.com
Wed Jul 15 06:10:19 PDT 2015


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

On Thu, Jun 18, 2015 at 10:09 PM, Jonathan Coe <jbcoe at me.com> wrote:

> 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
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150715/08382091/attachment.html>


More information about the cfe-dev mailing list