Whilst looking at how clang-tidy might be able to handle such large scale variable renaming for something like https://reviews.llvm.org/D59251 I decided to run clang-tidy over the clang code base (starting in lib/Format) clang-tidy mutated the code so it wouldn't compile in BreakableToken.cpp line 226 which is a Lambda, breaking this down into the following code.. transforming unsigned BreakableStringLiteral::getContentStartColumn(unsigned lineIndex, bool Break) const { return StartColumn + Prefix.size(); } into unsigned BreakableStringLiteral::getContentStartColumn(unsigned lineIndex, bool break) const { return StartColumn + Prefix.size(); } Which then causes compile errors due to the use of "break" as a variable name. c:/Repos/llvm2/llvm-project/clang/lib/Format/BreakableToken.cpp(226): error C2143: syntax error: missing ')' before 'break' The same effect can be seen with the following code ------------------------------------------------------------ bool foo() { bool Break=true; bool Continue=false; for (unsigned Columns = 1; Columns <= 10; ++Columns) { if (Break) return Continue; } } return true; } ------------------------------------------------------------ Clang-tidy needs an option that will ensure keywords when renamed e.g. (Break,Continue,Do,While,Int,Override,etc..) can be renamed to something that will not cause a compile failure due. something like KeyWordPrefix: "XXX_" could be used to turn Break into: XXX_break so that violations can be easily identified and renamed later
Hi, I tried to fix this by giving a warning and not changing the name. you can review the code in Phabricator. https://reviews.llvm.org/D68539
Done, merged into master https://reviews.llvm.org/rGe477988309dbde214a6d16ec690a416882714aac