[PATCH] D132294: [clang-tidy] Add check of sprintf with fixed size buffer
Eugene Zelenko via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sat Aug 20 08:16:45 PDT 2022
Eugene.Zelenko added inline comments.
================
Comment at: clang-tools-extra/clang-tidy/bugprone/SprintfWithFixedSizeBufferCheck.h:29
+ void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
+};
+
----------------
Yoorkin wrote:
> Eugene.Zelenko wrote:
> > Please add `isLanguageVersionSupported` (C and C++).
> can i just simply use
> ```
> bool isLanguageVersionSupported(const LangOptions &LangOpts) const override {
> return LangOpts.C99 || LangOpts.CPlusPlus11;
> }
> ```
> I think the check should be supported after C99 and Cpp11 standards. But i don't know whether it return true when language version is c++20 or C11
`snprintf` is part of standard C library, so it could be used in early C and C++ standards.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D132294/new/
https://reviews.llvm.org/D132294
More information about the cfe-commits
mailing list