[PATCH] D61508: [clang-tidy] bugprone-header-guard : a simple version of llvm-header-guard

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri May 17 07:02:57 PDT 2019


aaron.ballman added inline comments.


================
Comment at: clang-tidy/bugprone/HeaderGuardCheck.cpp:50
+
+  } else {
+    if (OldGuard.size())
----------------
I think this should be an `else if` rather than an `else`. I'd like to see us diagnose unknown guard styles so that we only accept "llvm" and "" as guard styles; this makes it easier to add new guard styles in the future.


================
Comment at: docs/clang-tidy/checks/bugprone-header-guard.rst:11
+
+.. option:: HeaderFileExtensions
+
----------------
Should we be documenting the `GuardStyle` option here as well? We could document "llvm" as the only available option currently and mention the llvm-header-guard check as an alias which enables this style.


================
Comment at: test/clang-tidy/bugprone-header-guard.cpp:1-3
+// RUN: %check_clang_tidy %s bugprone-header-guard %t -- \
+// RUN:   -config="{CheckOptions: [{key: bugprone-header-guard.HeaderFileExtensions, value: 'cpp'}]}" \
+// RUN:   -header-filter=.* --
----------------
Can you add a test for the `GuardStyle` option? Both when specifying `llvm` and some random unsupported string.


Repository:
  rCTE Clang Tools Extra

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D61508/new/

https://reviews.llvm.org/D61508





More information about the cfe-commits mailing list