njames93 added inline comments.

================
Comment at: clang-tools-extra/clang-tidy/performance/AvoidEndlEndsCheck.cpp:28
+              declRefExpr(
+                  to(namedDecl(hasAnyName("endl", "ends")).bind("decl")))
+                  .bind("expr")))),
----------------
Why are you matching on `ends`.
That manipulator just inserts a null character to the stream(akin to doing 
`std::cout << '\0';`)
More to the point changing replacing this call with `std::cout << '\n'` changes 
behaviour and will likely cause UB as this modifier is meant for 
null-terminating character buffers to pass to `C` functions.

Double side note the point I made before about how you can turn `<< "World" << 
endl` into `<< "World\n"` also wouldn't work here as `<< "World\0"` does the 
same thing as `<< "World"` due to "World" already being a null terminated 
string.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D148318

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

Reply via email to