[cfe-dev] Obtaining AST Nodes Text

Miklos Vajna via cfe-dev cfe-dev at lists.llvm.org
Wed Jun 10 01:03:38 PDT 2020


Hi,

On Tue, Jun 09, 2020 at 09:31:22AM +0300, samins KAlex via cfe-dev <cfe-dev at lists.llvm.org> wrote:
> How can I retreive matched node text to some variable, not dump?
> I have
> MatchResult &R;
> ASTContext *C;
> SourceManager &SM;
>  
> I don't want to get location and re-read source file. Is there other way?

Did you try CharSourceRange::getTokenRange()? That's what clang-tidy
uses at a number of places to refer to source in diagnostics.

Regards,

Miklos
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: Digital signature
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20200610/4f97aae7/attachment.sig>


More information about the cfe-dev mailing list