Refactor some checkers to use the tooling re-writing API.
see: http://reviews.llvm.org/D19941
Details
Diff Detail
Event Timeline
clang-tidy/misc/SwappedArgumentsCheck.cpp | ||
---|---|---|
51–52 | Stray backslash at EOL. | |
clang-tidy/utils/FixItHintUtils.cpp | ||
41 ↗ | (On Diff #55822) | Please update the comment. |
clang-tidy/utils/FixItHintUtils.h | ||
21 ↗ | (On Diff #55822) | These functions are not clang-tidy specific. They might be convenient in clang/include/clang/Tooling. Manuel, WDYT? |
38 ↗ | (On Diff #55822) | nit: functionsShouldStartWithALowerCase in LLVM. |
38 ↗ | (On Diff #55822) | Please document the functions. Specifically, we need to note that they can return a FixItHint that isNull in case the range is not a simple file range. |
56 ↗ | (On Diff #55822) | Please update the comment. |
I'm mostly interested to validate the concept before pushing further the refactoring.
The same API is marked "deprecated" internally.
I just want to confirm I'm not missing an elephant in the room.
alexfh seems willing to push this as-is (modulo cleanup, packaging and tests)...
clang-tidy/misc/SwappedArgumentsCheck.cpp | ||
---|---|---|
51–52 | yeah, a few nits. | |
clang-tidy/utils/FixItHintUtils.h | ||
21 ↗ | (On Diff #55822) | I didn't think about that yet? I do not know enough on other tooling, yet! |
56 ↗ | (On Diff #55822) | I'm preparing a separate CL to rename these namespace too. |
clang-tidy/utils/FixItHintUtils.h | ||
---|---|---|
21 ↗ | (On Diff #55893) | If I'm not mistaken, this is only for template-cases to work, which are used in this file. I don't think this function carries its weight for a more general solution. I expect everybody else to just write SourceRange(Loc) - I don't think it's any less obvious than getSourceRange(Loc). |
clang-tidy/utils/FixItHintUtils.h | ||
---|---|---|
21 ↗ | (On Diff #55893) | Yes, getSourceRange is needed for the the template getText function below. On its own it doesn't seem to be particularly useful and should probably be moved to the internal namespace. The useful API here that makes sense to be moved to clang/Tooling (and that I was talking about) is the getText function and maybe also createRemoval and createReplacement. Do you think they fit well to clang/Tooling? If so, what specific file would be the best place for them? |
test/clang-tidy/misc-swapped-arguments.cpp | ||
26 ↗ | (On Diff #55893) | Please leave the CHECK-FIXES line to actually verify that this line is not changed. |
clang-tidy/utils/FixItHintUtils.h | ||
---|---|---|
21 ↗ | (On Diff #55893) | Ok, after short in-person chat I now understand what this is about: |
test/clang-tidy/misc-swapped-arguments.cpp | ||
---|---|---|
26 ↗ | (On Diff #55893) | This line was correctly rewrtited. |
Stray backslash at EOL.