clang-tidy: Enable bugprone-unchecked-optional-access
Enable bugprone-unchecked-optional-access to detect the case that it
accesses std::optional without checking empty.
See https://gerrit.openbmc.org/c/openbmc/docs/+/78034 for details.
This commit also fixes quite a few issues reported by clang-tidy:
* Add necessary includes in the hpp files;
* Move the template function `selAddSystemRecord()` into hpp;
* Fix the uncheck access of `expireAction`.
Signed-off-by: Lei YU <yulei.sh@bytedance.com>
Change-Id: I4ad3cc07510a03965a2b4ae9c08fe452433ccdab
diff --git a/.clang-tidy b/.clang-tidy
new file mode 100644
index 0000000..4b6eca0
--- /dev/null
+++ b/.clang-tidy
@@ -0,0 +1,7 @@
+Checks: '
+ -*,
+ bugprone-unchecked-optional-access,
+ readability-identifier-naming
+'
+WarningsAsErrors: '*'
+HeaderFilterRegex: '(?!^subprojects).*'