[PATCH] D147144: [include-cleaner] Report references to operator calls as implicit

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 29 13:12:27 PDT 2023


hokein accepted this revision.
hokein added inline comments.
This revision is now accepted and ready to land.


================
Comment at: clang-tools-extra/include-cleaner/lib/WalkAST.cpp:98
       return false;
-
-    // Operators are always ADL extension points, by design references to them
-    // doesn't count as uses (generally the type should provide them).
-    // Don't traverse the callee.
-
+    report(S->getOperatorLoc(), llvm::cast<NamedDecl>(S->getCalleeDecl()),
+           RefType::Implicit);
----------------
I will be more defensive for nullptr (llvm::cast doesn't allow nullptr), use the `cast_if_present` in case where `S->getCalleeDecl()` returns a nullptr


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D147144



More information about the cfe-commits mailing list