[PATCH] D58556: [LibTooling] Add "smart" retrieval of AST-node source to FixIt library
Yitzhak Mandelbaum via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Feb 22 14:32:57 PST 2019
ymandel created this revision.
ymandel added a reviewer: ilya-biryukov.
ymandel added a project: clang.
Herald added a subscriber: jdoerfert.
Introduces variants of `getText` and `getSourceRange` that extract the source text of an AST node based on contextual considerations. This revision introduces the relevant functions, but, as a start, only supports statements and trailing semicolons.
Some of the new functions manipulate `CharSourceRange`s, rather than `SourceRange`s, because they document and dynamically enforce their type. So, this revision also updates the corresponding existing FixIt functions to manipulate `CharSourceRange`s. This change is not strictly necessary, but seems like the correct choice, to keep the API self-consistent.
This revision is the first in a series intended to improve the abstractions available to users for writing source-to-source transformations. A full discussion of the end goal can be found on the cfe-dev list with subject "[RFC] Easier source-to-source transformations with clang tooling".
Repository:
rC Clang
https://reviews.llvm.org/D58556
Files:
clang/include/clang/Tooling/FixIt.h
clang/lib/Tooling/FixIt.cpp
clang/unittests/Tooling/FixItTest.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58556.187957.patch
Type: text/x-patch
Size: 9881 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190222/9daa3b1b/attachment.bin>
More information about the cfe-commits
mailing list