[PATCH] D70876: [clang-tidy] Add spuriously-wake-up-functions check
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Dec 2 08:24:38 PST 2019
aaron.ballman added inline comments.
================
Comment at: clang-tools-extra/clang-tidy/misc/MiscTidyModule.cpp:45-46
"misc-redundant-expression");
+ CheckFactories.registerCheck<SpuriouslyWakeUpFunctionsCheck>(
+ "misc-spuriously-wake-up-functions");
CheckFactories.registerCheck<StaticAssertCheck>("misc-static-assert");
----------------
If we want to expose this check outside of the CERT module, I think it should go into `bugprone` rather than `misc`.
================
Comment at: clang-tools-extra/clang-tidy/misc/SpuriouslyWakeUpFunctionsCheck.cpp:62
+ auto hasWaitDescendantC =
+ hasDescendant(callExpr(callee(functionDecl(allOf(hasName("cnd_wait"),
+ parameterCountIs(2)))))
----------------
What about `cnd_timedwait`?
================
Comment at: clang-tools-extra/clang-tidy/misc/SpuriouslyWakeUpFunctionsCheck.h:19
+/// Finds ``cnd_wait`` or `wait` function calls in an ``IfStmt`` and tries to
+/// replace it with ``WhileStm``.
+///
----------------
WhileStm -> WhileStmt
================
Comment at: clang-tools-extra/test/clang-tidy/misc-spuriously-wake-up-functions.cpp:1
+// RUN: %check_clang_tidy %s misc-spuriously-wake-up-functions %t -- -- -I %S/../../../libcxx/include/
+
----------------
Eugene.Zelenko wrote:
> What will happen if libcxx is not part build/source tree?
Also, there are no tests for the C functionality yet.
Repository:
rCTE Clang Tools Extra
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D70876/new/
https://reviews.llvm.org/D70876
More information about the cfe-commits
mailing list