When deleting the copy assignment statement because copied variable is not used
only remove trailing comments on the same line.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Given that you're removing a declaration, consider using tooling::getAssociatedRange https://source.corp.google.com/piper///depot/google3/third_party/llvm/llvm-project/clang/include/clang/Tooling/Transformer/SourceCode.h;l=44 It does have a different semantics than the simpler logic that you have here, but, its based on code in a dead-code removal tool, so it may still be what you want.
clang-tools-extra/clang-tidy/performance/UnnecessaryCopyInitialization.cpp | ||
---|---|---|
59 | what happens for the last line in the file? I think the Offset + 1 below will be sketchy (because PastNewLine will be invalid). It might work, but seems best avoided. | |
64 | I suspect this could get tripped up by macros and other expansions. Instead of std::min, consider using SourceManager::isBeforeInTranslationUnit |
clang-tools-extra/clang-tidy/performance/UnnecessaryCopyInitialization.cpp | ||
---|---|---|
50 | optional nit: invert the condition and the branches. i just find it a little easier to read positive predicates. So, when i have both branches, I try for the condition to be positive (or, in other words, I try not to not the condition. ;) ) |
optional nit: invert the condition and the branches. i just find it a little easier to read positive predicates. So, when i have both branches, I try for the condition to be positive (or, in other words, I try not to not the condition. ;) )