This is a simple Lexer util to get the source text of a statement given as parameter. This is needed for D37014.
Details
Diff Detail
Event Timeline
clang-tidy/utils/LexerUtils.cpp | ||
---|---|---|
39 | You should elide the curly braces here. | |
44 | Please don't use auto here, as the type is not spelled out in the initialization. | |
clang-tidy/utils/LexerUtils.h | ||
26 | Formatting (elsewhere as well). You should run the patch under clang-format to handle this sort of thing. | |
unittests/clang-tidy/LexerUtilsTest.cpp | ||
31 | Don't use auto unless the type is spelled out in the init, such as with dyn_cast | |
34–35 | Can FooLookup.front() actually be null? I think this should use cast<> and assert if given null or something other than a FunctionDecl. | |
37–38 | I think you can use cast<> here instead of dyn_cast_or_null<>, and it will assert for you if the body isn't valid. | |
43 | Spurious newline. |
clang-tidy/utils/LexerUtils.h | ||
---|---|---|
26 | Have you seen clang::tooling::fixit::getText? It should cover this use case. |
clang-tidy/utils/LexerUtils.h | ||
---|---|---|
26 | Hadn't seen that! Seems to be making this whole patch obsolete, I'm closing it |
Formatting (elsewhere as well).
You should run the patch under clang-format to handle this sort of thing.