[cfe-dev] dump ast with missing dependencies

Dr S3curity via cfe-dev cfe-dev at lists.llvm.org
Thu Apr 16 12:59:22 PDT 2020


Hi,

I want to dump ast tree of cpp code but i have some missing
dependencies(headers etc...) that for example will make some objects not
declared and some function unresolvable.

For C I do something like this,
```
$ cat test.c
int main()
{
foo(1, 2);
return 0;
}
```

clang -Xclang -ast-dump -fsyntax-only test.c

I will get a warning but in the output ast tree i get this for the function
foo.

```
    | | `-DeclRefExpr 0x5558f92f9ea0 <col:1> 'int ()' Function
0x5558f92f9df0 'foo' 'int ()'
    | |-IntegerLiteral 0x5558f92f9ec0 <col:5> 'int' 1
    | `-IntegerLiteral 0x5558f92f9ee0 <col:8> 'int' 2
```

but when i try the same for c++ i will get error message and nothing in the
output ast tree.

Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20200416/81ff629d/attachment.html>


More information about the cfe-dev mailing list