Support replacements in macro arguments in the
misc-inefficient-algorithm check.
Details
Details
Diff Detail
Diff Detail
Event Timeline
clang-tidy/misc/InefficientAlgorithmCheck.cpp | ||
---|---|---|
114–118 | Any reason we don't want to use Lexer::makeFileCharRange here (which should handle all the cases correctly). |
clang-tidy/misc/InefficientAlgorithmCheck.cpp | ||
---|---|---|
114–118 | It was the first thing I tried, but it gets the test case wrong, i.e. it replaces the whole macro invocation instead of just the argument: #define SECOND(x, y, z) y SECOND(q,std::count(s.begin(), s.end(), 22),w); becomes #define SECOND(x, y, z) y s.count(22); |
Comment Actions
LG
clang-tidy/misc/InefficientAlgorithmCheck.cpp | ||
---|---|---|
114–118 | You're right. Add a FIXME to figure something out regarding a common function to get this use case covered. |
Any reason we don't want to use Lexer::makeFileCharRange here (which should handle all the cases correctly).