[PATCH] D138559: Record macro references in #ifdef clause.

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 23 06:40:33 PST 2022


hokein added a comment.

Thanks, this code looks good to me overall. I think we can extend it to handle the `Defined`, `Elifdef`, `Elifndef` cases.

And please add a `[include-cleaner]` prefix in the commit title.



================
Comment at: clang-tools-extra/include-cleaner/lib/Record.cpp:95
 private:
-  void recordMacroRef(const Token &Tok, const MacroInfo &MI) {
+  void recordMacroRef(const Token &Tok, const MacroInfo &MI, RefType RT) {
     if (MI.isBuiltinMacro())
----------------
nit: we can set a default value (`RefType::Explicit`) for the RT parameter, then we don't need to pass the `RefType::Explicit` in all callsites.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D138559



More information about the cfe-commits mailing list