[cfe-dev] Obtaining AST Nodes Text

Nathan James via cfe-dev cfe-dev at lists.llvm.org
Wed Jun 10 04:07:13 PDT 2020


Hi,
Have you tried using:`clang::tooling::fixit::getText(const T &Node,
const ASTContext &);`Internally that
uses`clang::Lexer::getSourceText(CharSourceRange, const SourceManager
&, const LangOptions &, bool *Invalid);`
Hope this helps,Nathan
On Tue, 2020-06-09 at 09:31 +0300, samins KAlex via cfe-dev wrote:
> Good day!
> 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?
>  
> 
> _______________________________________________cfe-dev mailing
> listcfe-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20200610/ebe28b24/attachment.html>


More information about the cfe-dev mailing list