[PATCH] D100581: [Clang] -Wunused-but-set-parameter and -Wunused-but-set-variable

Christopher Di Bella via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 15 11:37:59 PDT 2021


cjdb added a comment.

Overall LGTM, thank you for working on this :-)



================
Comment at: clang/lib/Sema/SemaDecl.cpp:13761-13771
+    bool VisitDeclRefExpr(const DeclRefExpr *DRE) {
+      auto iter = M->find(DRE->getFoundDecl());
+      if (iter != M->end() && iter->second) {
+        iter->second = false;
+        ++FalseCount;
+        if (FalseCount == M->size()) {
+          return false;
----------------
I think this function requires a bit of explaining.


================
Comment at: clang/lib/Sema/SemaDecl.cpp:13826
+
+  if (Parameters.begin() != Parameters.end()) {
+    Decl *D =
----------------
Can this be `!Parameters.empty()`? Also, please reverse the condition for early exit.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100581



More information about the cfe-commits mailing list