[cfe-dev] How to determine if a raw_id token is a macro name?

Richard via cfe-dev cfe-dev at lists.llvm.org
Fri Jan 7 12:09:43 PST 2022


[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 <718D2E03-2B6D-4962-9DE8-22B6C2054FF7 at gmail.com>,
    David Rector via cfe-dev <cfe-dev at lists.llvm.org> writes:

> AST matching on which clang tidy depends is all done during
> HandleTranslationUnit, *after* all parsing has completed, so
> hasMacroDefinition() will only return true if a macro with that name was
> not #undef'd.  

Yeah, another option is to have the check hook the PP callbacks and
take note of the locations of macros as they're defined/undefined.
-- 
"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