How to dump ast of a objective-c file correctly?

I try to dump ast for a .m in a test folder(just a single source file, no project file). I use the command “clang -x objective-c -Xclang -ast-dump -fobjc-arc main.m”. when I write some number literals(@(2)) or array literals (@[@“1”]), the command will report a error “error: definition of class NSArray must be available to use Objective-C array literals”, anyone know how to fix this?

Yes, you must import NSArray.h, NSNumber.h etc. in your main.m file. This is usually done by using #import <Foundation/Foundation.h>