[PATCH] D70823: [clang-tidy] Adding cert-pos34-c check
Csaba Dabis via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 28 09:39:46 PST 2019
Charusso added inline comments.
================
Comment at: clang-tools-extra/clang-tidy/cert/PutenvWithAutoCheck.cpp:28
+ unless(hasDescendant(callExpr(callee(functionDecl(hasAnyName(
+ "::alloc", "::malloc", "::realloc", "::calloc")))))))))))
+ .bind("func"),
----------------
`alloc` -> `alloca`
================
Comment at: clang-tools-extra/clang-tidy/cert/PutenvWithAutoCheck.cpp:34
+void PutenvWithAutoCheck::check(const MatchFinder::MatchResult &Result) {
+ const auto *MatchedDecl = Result.Nodes.getNodeAs<CallExpr>("func");
+
----------------
It is not a `Decl`, but a `CallExpr`, maybe use `PutenvCall`?
================
Comment at: clang-tools-extra/clang-tidy/cert/PutenvWithAutoCheck.h:19
+/// Finds calls of putenv function with automatic variable as the argument.
+
+///
----------------
Extra space.
================
Comment at: clang-tools-extra/clang-tidy/cert/PutenvWithAutoCheck.h:36
+#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_CERT_PUTENV_WITH_AUTO_H
\ No newline at end of file
----------------
No new-line.
================
Comment at: clang-tools-extra/test/clang-tidy/cert-pos34-c.cpp:59
+
+extern char* testExt;
+int func6(){
----------------
`clang-format`?
Repository:
rCTE Clang Tools Extra
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D70823/new/
https://reviews.llvm.org/D70823
More information about the cfe-commits
mailing list