[PATCH] D157436: [clang-tidy] `performance-faster-string-find` generates incorrect fixes for single quote character literals

Piotr Zegar via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 8 13:31:46 PDT 2023


PiotrZSL added inline comments.


================
Comment at: clang-tools-extra/clang-tidy/performance/FasterStringFindCheck.cpp:40
+  // "'" is OK, but ''' is not, so add a backslash
+  if (ClosePos - OpenPos == 2 && Result[OpenPos + 1] == '\'')
+    Result.replace(OpenPos + 1, 1, "\\'");
----------------



================
Comment at: clang-tools-extra/docs/ReleaseNotes.rst:199-201
+- Fixed a bug in :doc:`performance-faster-string-find
+  <performance-faster-string-find>` which generated incorrect fixes by not
+  escaping single quotes properly.
----------------
And put it before performanc-noexcept-swap, other alternative would be to call it "Improve XYZ check to properly escape single quote characters. or something like that


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D157436



More information about the cfe-commits mailing list