iOS LLVM and clang build tools

Source: Internet
Author: User

1. Use Libclan g or clang plug-in including ( Libclang and Clangkit)

Note:

Clangkit, which is a library that is encapsulated with OBJECTIVE-C based on the functionality provided by Clang.

The API provided by Libclang is very simple and can be bridged with C and clang, and it can be used to analyze all the source code.

2. Custom analyzers

Note:

Follow Tutorial for building tools using libtooling to construct add-ons for LLVM, Clang, and Clan G

3. Clang Other Features

Note:

There are many other uses for clang. For example, you can write a compiler plug-in (for example, a checker example like above) and load it dynamically into the compiler. Although I did not personally experiment, but I think in Xcode should be feasible. For example, you can also customize code styles by writing Clang plug-ins (see the compilation process for details )

4. Extended Reading

Note:

    • Clang Tutorial
    • x86_64 Assembly Language Tutorial
    • Custom clang Build with Xcode (I) and (II)
    • Clang Tutorial (I), (II) and (III)
    • Clang Plugin Tutorial
    • LLVM Blog:what Every C programmer should Know (I), (II) and (III)

5. Compile the process:

Note:

Pretreatment
? Symbolize (tokenization)
? Expansion of macro definition
? The unfolding of the #include
Syntax and semantic analysis
? Converts the symbolized content into a parse tree
? Parsing Tree for semantic analysis
? Output an abstract syntax tree (abstract Syntax tree* (AST))
Generate code and optimizations
? Convert AST to lower intermediate code (LLVM IR)
? Optimization of the generated intermediate code
? Generate specific target code
? Output assembly code
Assembler Series
? Converts the assembly code to the target object file.
Linker
? Merging multiple target object files into one executable file (or a dynamic library)

Expect an update for the next issue.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.