Eugene.Zelenko added inline comments.
================ Comment at: clang-tools-extra/clang-tidy/bugprone/SprintfWithFixedSizeBufferCheck.cpp:13 +#include "clang/ASTMatchers/ASTMatchFinder.h" + +#include "clang/Lex/Lexer.h" ---------------- Unnecessary newline. ================ Comment at: clang-tools-extra/clang-tidy/bugprone/SprintfWithFixedSizeBufferCheck.cpp:34 + const MatchFinder::MatchResult &Result) { + const DeclRefExpr *CA = Result.Nodes.getNodeAs<DeclRefExpr>("ConstantArray"); + const CallExpr *Call = Result.Nodes.getNodeAs<CallExpr>("sprintf"); ---------------- `const auto *` could be used because type is spelled in same statement. ================ Comment at: clang-tools-extra/clang-tidy/bugprone/SprintfWithFixedSizeBufferCheck.cpp:35 + const DeclRefExpr *CA = Result.Nodes.getNodeAs<DeclRefExpr>("ConstantArray"); + const CallExpr *Call = Result.Nodes.getNodeAs<CallExpr>("sprintf"); + ---------------- Ditto. ================ Comment at: clang-tools-extra/clang-tidy/bugprone/SprintfWithFixedSizeBufferCheck.h:29 + void check(const ast_matchers::MatchFinder::MatchResult &Result) override; +}; + ---------------- Please add `isLanguageVersionSupported` (C and C++). ================ Comment at: clang-tools-extra/docs/ReleaseNotes.rst:105 + + FIXME: add release notes. + ---------------- Please use first statement in documentation. ================ Comment at: clang-tools-extra/docs/clang-tidy/checks/bugprone/sprintf-with-fixed-size-buffer.rst:6 + +The check finds usage of `sprintf`, which write output string into a fixed-size +array. It will suggest `snprintf` instead. ---------------- Please omit `The check` and use double back-ticks for `sprintf` (language construct). ================ Comment at: clang-tools-extra/docs/clang-tidy/checks/bugprone/sprintf-with-fixed-size-buffer.rst:7 +The check finds usage of `sprintf`, which write output string into a fixed-size +array. It will suggest `snprintf` instead. + ---------------- Ditto for `snprintf`. ================ Comment at: clang-tools-extra/docs/clang-tidy/checks/bugprone/sprintf-with-fixed-size-buffer.rst:14 +Example: +.. code-block:: c++ + void f(){ ---------------- Please separate with newline. ================ Comment at: clang-tools-extra/docs/clang-tidy/checks/bugprone/sprintf-with-fixed-size-buffer.rst:21 +Becomes: +.. code-block:: c++ + void f(){ ---------------- Ditto. ================ Comment at: clang-tools-extra/docs/clang-tidy/checks/bugprone/sprintf-with-fixed-size-buffer.rst:26 + } \ No newline at end of file ---------------- Please fix. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D132294/new/ https://reviews.llvm.org/D132294 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits