Use LLVM’s streams library ( raw_ostream). We explicitly avoid some standard facilities, like the I/O streams, and instead Llvm::SmallVector should usually be used instead of std::vector. For example, llvm::DenseMap shouldĪlmost always be used instead of std::map or std::unordered_map, and There isn’t a specific reason to favor the C++ implementation, it is generally When both C++ and the LLVM support libraries provide similar functionality, and Such libraries are usually implemented in the llvm namespace andįollow the expected standard interface, when there is one. Implement specialized data structures or functionality missing in the standard LLVM support libraries (for example, ADT) On the standard library facilities and the LLVM support libraries as much as LLVM and related projects emphasize and rely Standard library facilities or LLVM support libraries whenever they areĪvailable for a particular task. Instead of implementing custom data structures, we encourage the use of C++ Maintainability of our common source base. The ultimate goal of these guidelines is to increase the readability and Hand, it is reasonable to rename the methods of a class if you’re about toĬhange it in some other way. Want patches that do large-scale reformatting of existing code. Our long term goal isįor the entire codebase to follow the convention, but we explicitly do not Lot of code was written before they were put in place. This is because they are relatively new, and a There are some conventions that are not uniformly followed in the code base For example, in the case of libc++, this isīecause the naming and other conventions are dictated by the C++ standard. libc++) have special reasons to deviateįrom the coding standards. Use the style that is already being used so that the source is uniform and If you are extending, enhancing, or bug fixing already implemented code, Don’t Use Braces on Simple Single-Statement Bodies of if/else/loop Statements.Don’t use inline when defining a function in a class definition.Don’t evaluate end() every time through a loop. ![]()
0 Comments
Leave a Reply. |