Currently, an attempt to rewrite source code inside a macro expansion succeeds, but results in empty text, rather than failing with an error. This patch restructures to the code to explicitly validate ranges before attempting to edit them.
Details
Details
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Comment Actions
The only functional change that I see in this patch is in clang/lib/Tooling/Transformer/Stencil.cpp. However, I don't understand how that change in the (deprecated) selection() stencil can affect other stencils.
clang/unittests/Tooling/StencilTest.cpp | ||
---|---|---|
375 | "foo(MACRO);" will fail parsing at the top level, it should be within a function, I think. |
Comment Actions
Good point. Actually, selection and text are still used internally. See, for example, lines 301-303 in Stencil.cpp. We deprecated their use for clients.
clang/unittests/Tooling/StencilTest.cpp | ||
---|---|---|
375 | matchStmt *(below) handles wrapping the snippet in a function. |
"foo(MACRO);" will fail parsing at the top level, it should be within a function, I think.