[PATCH] D69731: [analyzer] CheckerContext: Make the Preprocessor available

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 1 13:25:01 PDT 2019


NoQ accepted this revision.
NoQ added a comment.
This revision is now accepted and ready to land.

We probably need this because every time we try to deal with macros we struggle quite a bit.

I'm not sure though - because we somehow survived without this for like 10 years. Eg. `BugReporterVisitors.cpp`:

  250 static bool isFunctionMacroExpansion(SourceLocation Loc,
  251                                 const SourceManager &SM) {
  252   if (!Loc.isMacroID())
  253     return false;
  254   while (SM.isMacroArgExpansion(Loc))
  255     Loc = SM.getImmediateExpansionRange(Loc).getBegin();
  256   std::pair<FileID, unsigned> TLInfo = SM.getDecomposedLoc(Loc);
  257   SrcMgr::SLocEntry SE = SM.getSLocEntry(TLInfo.first);
  258   const SrcMgr::ExpansionInfo &EInfo = SE.getExpansion();
  259   return EInfo.isFunctionMacroExpansion();
  260 }

I'd love to see some actual use before committing.


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69731/new/

https://reviews.llvm.org/D69731





More information about the cfe-commits mailing list