LLVM Documents

LLVM Documents

Sergey Abbakumov

There are 2 documents regulating the development of LLVM: https://llvm.org/docs/CodingStandards.html

https://llvm.org/docs/ProgrammersManual.html


From the interesting:

• Exceptions and RTTI are banned and disabled by the compiler options. The rationale is that they violate the main principle laid down in the standard: "Do not pay for what you do not use." LLVM does not want the compiler to implicitly generate any additional information into object files.

• Self-written RTTI is used, which is more versatile due to the fact that it can be used for classes without virtual methods.

• Two error categories are used: programmer errors (caught with a huge amount of assert statements) and recoverable errors (handled using the Error, ErrorOr<T>, Expected<T> classes, which are very similar to the Google Status and StatusOr<T> classes).

formatv - a function for type-safe string formatting, as in Python.

• A huge number of different data structures for specific purposes. One of the most useful, in my opinion, is SmallVector<N> and the SmallString<N> specialization. SmallVector<N> is a vector that internally allocates a user-defined number of elements on the stack. If this number becomes greater than N, it allocates memory on the heap and stores the items there. As a result, it is possible to reduce the number of memory allocations.


Telegram channel: https://t.me/sea_plus_plus

Report Page