alexfh requested changes to this revision.
This revision now requires changes to proceed.

================
Comment at: clang-tidy/misc/StringConstructorCheck.cpp:110
@@ -106,2 +109,3 @@
   if (Result.Nodes.getNodeAs<Expr>("swapped-parameter")) {
-    diag(Loc, "constructor parameters are probably swapped");
+    assert(E->getNumArgs() == 2 && "Invalid number of arguments");
+    auto D = diag(Loc, "constructor parameters are probably swapped");
----------------
Assertions should verify logical bugs in the code, not some properties of the 
user input. The matcher doesn't seem to ensure that the argument count is 
always 2, so it's possible to create code that will trigger this assertion. 
Either add `argumentCountIs(2)` to the matcher or remove the assertion.


http://reviews.llvm.org/D19547



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

Reply via email to