[cfe-dev] How to dump ast of a objective-c file correctly?

Jean-Daniel via cfe-dev cfe-dev at lists.llvm.org
Sat Nov 11 12:20:03 PST 2017



> Le 11 nov. 2017 à 05:50, Karl Peng via cfe-dev <cfe-dev at lists.llvm.org> a écrit :
> 
> 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>



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20171111/7c558770/attachment.html>


More information about the cfe-dev mailing list