aaron.ballman added inline comments.

================
Comment at: 
clang-tools-extra/clang-tidy/bugprone/EasilySwappableParametersCheck.cpp:481
+
+      assert(TargetIdx.hasValue() && "Matched, but didn't find index?");
+      TargetParams[PassedParamOfThisFn].insert(
----------------
I *think* you could run into this assert with K&R C function where there is a 
`FunctionDecl` to get back to but the decl claims it has no params because it 
has no prototype (while the call expression actually has the arguments). 
However, there may be other code that protects us from this case.


================
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;
----------------
Is this a FIXME because there's a matcher issue this works around or should it 
be an assertion?


================
Comment at: 
clang-tools-extra/clang-tidy/bugprone/EasilySwappableParametersCheck.h:43
+  /// If enabled, diagnostics for parameters that are used together in a
+  /// similar way will not be presented.
+  const bool SuppressParametersUsedTogether;
----------------



================
Comment at: 
clang-tools-extra/docs/clang-tidy/checks/bugprone-easily-swappable-parameters.rst:90
+
+    Currently, the following heuristics are implemented, either of which
+    will suppress the warning about the parameter pair involved:
----------------



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