源码地址:
http://opensource.apple.com
or
http://clang.llvm.org/
编译链接
clang -fobjc-arc -framework Foundation test.m -o test
编译阶段分析
$ clang -ccc-print-phases test.m
0: input, "test.m", objective-c
1: preprocessor, {0}, objective-c-cpp-output
2: compiler, {1}, assembler
3: assembler, {2}, object
4: linker, {3}, image
5: bind-arch, "x86_64", {4}, imag
预处理
clang -E test.m
词法解析
clang -Xclang -dump-tokens test.m
语法解析
clang -Xclang -ast-dump -fsyntax-only test.m
代码生成
clang -O3 -emit-llvm test.m -c -o test.bm
LLVM反编译
../Tools/llvm-3.6.1/bin/llvm-dis < test.bm | less
clang test.m -framework Foundation
clang -rewrite-objc test.m
网友评论