how to get -ast-print to work?

I have clang from 2010-01-22 installed.

I'm interested in using the AST, but:

marko@prpad:tmp% clang -cc1 col.c -ast-print
gcc: unrecognized option '-cc1'
/tmp/cc-15456a.s: Assembler messages:
/tmp/cc-15456a.s:4: Warning: unterminated string; newline inserted
/tmp/cc-15456a.s:5: Warning: unterminated string; newline inserted
gcc: unrecognized option '-cc1'

How can I use -ast-print?

Best regards and thanks in advance,

Marko

I have clang from 2010-01-22 installed.

First off, Clang questions should go to cfe-dev.

I'm interested in using the AST, but:

marko@prpad:tmp% clang -cc1 col.c -ast-print
gcc: unrecognized option '-cc1'

Why is gcc interpreting command line arguments for clang? Do you have an
alias or symlink somewhere?

% which clang
% file `which clang`

Sebastian

Dear Sebastian,

> I have clang from 2010-01-22 installed.

First off, Clang questions should go to cfe-dev.

>
> I'm interested in using the AST, but:
>
> marko@prpad:tmp% clang -cc1 col.c -ast-print
> gcc: unrecognized option '-cc1'

Why is gcc interpreting command line arguments for clang? Do you have an
alias or symlink somewhere?

% which clang
% file `which clang`

marko@prpad:marko% file `which gcc`
/usr/bin/gcc: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for NetBSD 5.0, not stripped
marko@prpad:marko% file `which clang`
/usr/pkg/bin/clang: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for NetBSD 5.0, stripped

Best regards,

Marko

P.S. Continuing this thread here, will direct future posts relating to
clang to cfe-dev.

When I use -ast-print like below, I get an error.

marko@prpad:tmp% clang -cc1 col.c -ast-print
gcc: unrecognized option '-cc1'
/tmp/cc-05816a.s: Assembler messages:
/tmp/cc-05816a.s:4: Warning: unterminated string; newline inserted
/tmp/cc-05816a.s:5: Warning: unterminated string; newline inserted
gcc: unrecognized option '-cc1'

marko@prpad:tmp% file `which clang`
/usr/pkg/bin/clang: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for NetBSD 5.0, stripped

marko@prpad:tmp% file `which gcc`
/usr/bin/gcc: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for NetBSD 5.0, not stripped

I traced the run of clang: it seems to find /usr/pkg/libexec/clang-cc,
but then apparently forks /usr/bin/gcc.

This is with clang-2.6.

Best regards,

Marko

Marko Sch├╝tz wrote:

When I use -ast-print like below, I get an error.

marko@prpad:tmp% clang -cc1 col.c -ast-print
gcc: unrecognized option '-cc1'
/tmp/cc-05816a.s: Assembler messages:
/tmp/cc-05816a.s:4: Warning: unterminated string; newline inserted
/tmp/cc-05816a.s:5: Warning: unterminated string; newline inserted
gcc: unrecognized option '-cc1'

...

This is with clang-2.6.

That's from before clang and clang-cc became a single executable. If you
want to print the AST with LLVM 2.6 clang, you have to run clang-cc
directly:

/usr/pkg/libexec/clang-cc col.c -ast-print

Chip

that solves my problem, thanks.

Marko