4.2 LLVM coding style
LLVM adheres to specific code-style rules [11]. The primary objective of these rules is to promote proficient C++ practices with a special focus on performance. As previously mentioned, LLVM employs C++17 and prefers using data structures and algorithms from the STL (short for, Standard Template Library). On the other hand, LLVM offers many optimized versions of data structures that mirror those in the STL. For example, llvm
::
SmallVector
<>
can be regarded as an optimized version of std
::
vector
<>
, especially for small sizes of the vector, a common trait for data structures used in compilers.
Given a choice between an STL object/algorithm and its corresponding LLVM version, the LLVM coding standard advises favoring the LLVM version.
Additional rules pertain to concerns regarding performance limitations. For instance, both run-time type information (RTTI) and C++ exceptions are disallowed. However, there are situations where RTTI could prove beneficial...