[cfe-dev] what type it is about ltab[4]?

Richard Smith richard at metafoo.co.uk
Mon May 13 12:57:53 PDT 2013


$ cat tmp.c
typedef struct Queue Queue;
const int MAXQ = 123;
void f() {
  Queue *ltab[MAXQ];
  Queue *q;
  ltab[4] = q;
}
$ clang tmp.c -Xclang -ast-dump -fsyntax-only
TranslationUnitDecl 0x5648c00 <<invalid sloc>>
|-TypedefDecl 0x5649100 <<invalid sloc>> __int128_t '__int128'
|-TypedefDecl 0x5649160 <<invalid sloc>> __uint128_t 'unsigned __int128'
|-TypedefDecl 0x56494b0 <<invalid sloc>> __builtin_va_list '__va_list_tag
[1]'
|-RecordDecl 0x5649500 <tmp.c:1:9, col:16> struct Queue
|-TypedefDecl 0x56495f0 <col:1, col:22> Queue 'struct Queue':'struct Queue'
|-VarDecl 0x5649660 <line:2:1, col:18> MAXQ 'const int'
| `-IntegerLiteral 0x56496b8 <col:18> 'int' 123
`-FunctionDecl 0x5649730 <line:3:1, line:7:1> f 'void ()'
  `-CompoundStmt 0x567b350 <line:3:10, line:7:1>
    |-DeclStmt 0x567b168 <line:4:3, col:20>
    | `-VarDecl 0x567b110 <col:3, col:19> ltab 'Queue *[123]'
    |-DeclStmt 0x567b1e8 <line:5:3, col:11>
    | `-VarDecl 0x567b190 <col:3, col:10> q 'Queue *'
    `-BinaryOperator 0x567b328 <line:6:3, col:13> 'Queue *' '='
*      |-ArraySubscriptExpr 0x567b2c0 <col:3, col:9> 'Queue *' lvalue*
*      | |-ImplicitCastExpr 0x567b2a8 <col:3> 'Queue **'
<ArrayToPointerDecay>*
*      | | `-DeclRefExpr 0x567b200 <col:3> 'Queue *[123]' lvalue Var
0x567b110 'ltab' 'Queue *[123]'*
*      | `-IntegerLiteral 0x567b228 <col:8> 'int' 4*
      `-ImplicitCastExpr 0x567b310 <col:13> 'Queue *' <LValueToRValue>
        `-DeclRefExpr 0x567b2e8 <col:13> 'Queue *' lvalue Var 0x567b190 'q'
'Queue *'


On Sun, Mar 31, 2013 at 5:05 AM, Rambo <hunanlwm at sina.cn> wrote:

> some codes like this
>
> Queue *ltab[MAXQ];
> Queue *q;
> ltab[4] = q;
>
> somebody can tell me what type it is about ltab[4],it is a simple
> ArraySubscriptExpr type?if not,How can I get it by clang API?
> thank you!
>
>
>
> --
> View this message in context:
> http://clang-developers.42468.n3.nabble.com/what-type-it-is-about-ltab-4-tp4031232.html
> Sent from the Clang Developers mailing list archive at Nabble.com.
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130513/69897cfe/attachment.html>


More information about the cfe-dev mailing list