[doc] Describe the header guard style
authorMircea Trofin <mtrofin@google.com>
Thu, 30 Jul 2020 23:08:06 +0000 (16:08 -0700)
committerMircea Trofin <mtrofin@google.com>
Thu, 30 Jul 2020 23:08:07 +0000 (16:08 -0700)
clang-tidy's llvm-header-guard rule references the LLVM style - where it's
missing.

Differential Revision: https://reviews.llvm.org/D84989

llvm/docs/CodingStandards.rst

index a9884cd9f3b5ab3dd75234629031b135fab29a4c..9c95e3ebf28a3d4c8a658c8770d38f66e8124c93 100644 (file)
@@ -174,6 +174,16 @@ used as an abstract.  Any additional information should be separated by a blank
 line.  If an algorithm is based on a paper or is described in another source,
 provide a reference.
 
+Header Guard
+""""""""""""
+
+The header file's guard should be the all-caps path that a user of this header
+would #include, using '_' instead of path separator and extension marker. 
+For example, the header file
+``llvm/include/llvm/Analysis/Utils/Local.h`` would be ``#include``-ed as 
+``#include "llvm/Analysis/Utils/Local.h"``, so its guard is 
+``LLVM_ANALYSIS_UTILS_LOCAL_H``.
+
 Class overviews
 """""""""""""""