小编Mua*_*man的帖子

如何从Objective-C代码中提取AST?

在查看可能的工具后,我需要分析Objective-C静态代码,主要是AST,我发现LLVM中的Clang工具可以转储AST,所以我使用终端使用这个命令测试它:

clang -cc1 -ast-dump ~/SomeTest.m
Run Code Online (Sandbox Code Playgroud)

但我收到这个错误:

In file included from /Users/myusername/SomeTest.m:9:
/Users/myusername/SomeTest.h:9:9: fatal error: 'UIKit/UIKit.h' file not found
#import <UIKit/UIKit.h>
        ^
typedef __int128_t __int128_t;
typedef __uint128_t __uint128_t;
typedef SEL *SEL;
typedef id id;
typedef Class *Class;
struct __va_list_tag {
    unsigned int gp_offset;
    unsigned int fp_offset;
    void *overflow_arg_area;
    void *reg_save_area;
};
typedef struct __va_list_tag __va_list_tag;
typedef __va_list_tag __builtin_va_list[1];
@interface just4testViewController@end
@implementation just4testViewController
- (void) dealloc (CompoundStmt 0x7f86b183b110 </Users/myusername/SomeTest.m:14:1, line:16:1>)


- (void) didReceiveMemoryWarning (CompoundStmt 0x7f86b183b2a0 </Users/myusername/SomeTest.m:19:1, line:24:1>)


- (void) viewDidUnload (CompoundStmt 0x7f86b183b430 …
Run Code Online (Sandbox Code Playgroud)

parsing code-analysis objective-c clang abstract-syntax-tree

8
推荐指数
1
解决办法
3395
查看次数