[cfe-dev] StringLiteral extraction

Mohamed Galal mohamed.g.ebrahim at gmail.com
Fri Apr 17 18:26:25 PDT 2015


Hi all,

I'm not sure if this is the right forum to ask this question, if not then
please point me out to the right place.

I'm running clang with -ast-dump option

*  clang  -Xclang -ast-dump*

And I'm getting a long output, but below is the part I'm asking about.

*    | | | `-ImplicitCastExpr 0x331e008 <col:1> 'char *'
<ArrayToPointerDecay>*
*    | | |   `-StringLiteral 0x331de80 <col:1> 'char [5]' lvalue "ab.c"*
*    | | |-ImplicitCastExpr 0x331e038 <line:107:1> 'WmkU32':'unsigned int'
<IntegralCast>*

I'd like to extract the StringLiteral "ab.c", I tried doing so via libclang
python bindings but I couldn't fine a property exposed to do that. Is there
a way to do this in Python?

If not, how can I do this in C, a pointer to where this option is
implemented in the source will be equally good.

Thanks a lot.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150417/e3228219/attachment.html>


More information about the cfe-dev mailing list