whisperity added inline comments.

================
Comment at: 
clang-tools-extra/clang-tidy/bugprone/EasilySwappableParametersCheck.cpp:532-536
+      if (find(FD->parameters(), ReturnedParam) == FD->param_end())
+        // Returning an Expr to a ParmVarDecl that **isn't** parameter of the
+        // function should not be possible. Make sure a mistake of the matcher
+        // does **not** interfere with the heuristic's result.
+        continue;
----------------
aaron.ballman wrote:
> Is this a FIXME because there's a matcher issue this works around or should 
> it be an assertion?
I was unable to create a test for this case. This part of the code, while I was 
twisting my head left and right, is one of the strictest remnant of the old 
version of the check... There definitely was a project in the test set back in 
December 2019 which made the check crash or emit massive false positives, and 
this thing was added to guard against that.

At a hunch, I think //maybe// a lambda returning one of its captures (which 
are, AFAIK, `ParmVarDecl`s of the constructor!) could be what caused the 
crash/false positive. I will check this out in detail soon.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78652

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to