• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1Compiler Coding Style
2=====================
3
4Coding style for the TurboFan compiler generally follows the Google C++ Style
5Guide and the Chromium Coding Style. The notes below are usually just extensions
6beyond what the Google style guide already says. If this document doesn't
7mention a rule, follow the Google C++ style.
8
9
10TODOs
11-----
12We use the following convention for putting TODOs into the code:
13
14  * A TODO(turbofan) implies a performance improvement opportunity.
15  * A TODO(name) implies an incomplete implementation.
16
17
18Use of C++11 auto keyword
19-------------------------
20Use auto to avoid type names that are just clutter. Continue to use manifest
21type declarations when it helps readability, and never use auto for anything
22but local variables, in particular auto should only be used where it is obvious
23from context what the type is:
24
25  for (auto block : x->blocks())  // clearly a Block of some kind
26  for (auto instr : x->instructions())  // clearly an Instruction of some kind
27
28  for (auto b : x->predecessors()) // less clear, better to make it explicit
29  for (BasicBlock* b : x->predecessors()) // now clear
30