clang学习1-编译和基本组件

编译

  • https://clang.llvm.org/get_started.html
  • http://llvm.org/docs/CMake.html
  • http://llvm.org/docs/GettingStarted.html

编译中几个可选组件

1.libcxx 对应的是libstdc++

libc++ is a new implementation of the C++ standard library, targeting C++11 and above.
https://libcxx.llvm.org
https://libcxx.llvm.org/docs

2.compiler-rt

https://compiler-rt.llvm.org
https://wdv4758h.github.io/notes/compiler/compiler-rt.html


The compiler-rt project consists of:

  • builtins - a simple library that provides an implementation of the low-level target-specific hooks required by code generation and other runtime components. For example, when compiling for a 32-bit target, converting a double to a 64-bit unsigned integer is compiling into a runtime call to the "__fixunsdfdi" function. The builtins library provides optimized implementations of this and other low-level routines, either in target-independent C form, or as a heavily-optimized assembly.

    builtins provides full support for the libgcc interfaces on supported targets and high performance hand tuned implementations of commonly used functions like __floatundidf in assembly that are dramatically faster than the libgcc implementations. It should be very easy to bring builtins to support a new target by adding the new routines needed by that target.

  • sanitizer runtimes - runtime libraries that are required to run the code with sanitizer instrumentation. This includes runtimes for:

    • AddressSanitizer
    • ThreadSanitizer
    • UndefinedBehaviorSanitizer
    • MemorySanitizer
    • LeakSanitizer
    • DataFlowSanitizer
  • profile - library which is used to collect coverage information.

  • BlocksRuntime - a target-independent implementation of Apple "Blocks" runtime interfaces.


3.clang-tools-extra

https://clang.llvm.org/extra/index.html

其他几个工具

libclang

  • https://clang.llvm.org/docs/Tooling.html
  • https://www.hellogcc.org/?tag=%E4%BD%BF%E7%94%A8clang
  • http://jszhujun2010.farbox.com/post/llvm&clang/clang-tutorial-di-er-bu-fen
  • http://blog.gocy.tech/2017/09/12/DetectingUselessCodeWithClang-p1/
  • http://www.njiang.cn/2017/03/01/%E5%8E%9F%E5%88%9B-%E5%85%B3%E4%BA%8Eclang%E6%8F%92%E4%BB%B6%E7%9A%84%E5%AE%9E%E7%8E%B0%E5%8E%9F%E7%90%86%E5%8F%8A%E5%AE%9E%E8%B7%B5/

Clang Static Analyzer

  • http://clang-analyzer.llvm.org/
  • https://www.zhihu.com/question/46358643
  • https://juejin.im/entry/58ca55f3a22b9d00641b019e

你可能感兴趣的:(clang学习1-编译和基本组件)