dump ast with missing dependencies

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