CFG::dump in clang

I want to obtain a dump of CFG for a simple foo program

#include <stdio.h>
int main() {
printf(“Hello, World!\n”);
}

I have tried the command

clang -cfg-dump foo.c

It gives a warning and ignores -cfg-dump option.

Also, if it is unable to link edit the program. when I give the command

clang foo.c

It gives an error

/usr/bin/ld: crtbegin.o: No such file: No such file or directory
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Running with -v option gives the error

/usr/bin/ld: crtbegin.o: No such file: No such file or directory
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Any help to dump cfg would be appreciated.

Surinder

-cfg-dump is a internal driver (-cc1) option, not part of the "public" compiler driver interface. It is also tied to -analyze. Try:

clang -cc1 -analyze -cfg-dump test.c