[cfe-dev] clang-tidy how it process each file

Richard via cfe-dev cfe-dev at lists.llvm.org
Mon Apr 16 09:24:29 PDT 2018


[Please reply *only* to the list and do not include my email directly
in the To: or Cc: of your reply; otherwise I will not see your reply.
Thanks.]

In article <BY1PR0601MB1158B0D0FE75117ACB6AEB758FB00 at BY1PR0601MB1158.namprd06.prod.outlook.com>,
    "Oza, Hiral via cfe-dev" <cfe-dev at lists.llvm.org> writes:

> I am trying to understand the tidy code flow.
> For example A.c file includes various Header files and that Header may be
> including other heaers...
> Can you please elaborate how tidy preprocess each header and source code
> including nested includes?
> Note: I am passing compiler arguments via "$ clang-tidy A.c --
> <compiler_args>".

Clang-tidy sees the abstract syntax tree (AST) created by the parser.
The AST is matched by the various checks and then changes are applied
to a list of "fix its".  The "fix its" are then applied to source
files.  By the time the AST is constructed, all header files have been
transitively included by the preprocessing steps.  Everything is
annotated in the AST with it's location in the source files, so the
fixits can be filtered by command-line arguments that say whether or
not a header file (based on a path regex) should be modified by
clang-tidy.
-- 
"The Direct3D Graphics Pipeline" free book <http://tinyurl.com/d3d-pipeline>
            The Terminals Wiki <http://terminals-wiki.org>
     The Computer Graphics Museum <http://ComputerGraphicsMuseum.org>
  Legalize Adulthood! (my blog) <http://LegalizeAdulthood.wordpress.com>


More information about the cfe-dev mailing list