Yoorkin added a comment.
I want to enable this check in both c and c++, but didn't find option
`LangOpt.C`. For c++, we have option `LangOpt.CPlusPlus`. There is only some
specific c standard option like `C99` `C11` `C17` and `C2X` defined in
`LangOptions.def`. Could you tell me how to do this?
Yoorkin updated this revision to Diff 458155.
Yoorkin marked 5 inline comments as done.
Yoorkin added a comment.
Maybe renamed to bugprone-sprintf-with-fixed-size-buffer would be better. I add
another option `FlagAllCalls` to flag all calls to `sprintf` and `vsprintf`.
CHANGES SINCE LAST ACTION
Yoorkin updated this revision to Diff 454724.
Yoorkin added a comment.
I forgot to update comments in `PrintfWithFixedSizeBufferCheck.h`, sorry
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D132294/new/
https://reviews.llvm.org/D132294
Files:
clang-tools-extra/clang-tidy/bugprone/Bugp
Yoorkin updated this revision to Diff 454722.
Yoorkin added a comment.
Now it can find usage of both `sprintf` and `vsprintf`, and then change a small
piece of code. Here is an option `PreferSafe`, when value is true, the check
prefers `snprintf_s` `vsnprintf_s` over `snprintf` `vsnprintf`.
CH
Yoorkin updated this revision to Diff 454228.
Yoorkin added a comment.
I fixed it. Thanks
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D132294/new/
https://reviews.llvm.org/D132294
Files:
clang-tools-extra/clang-tidy/bugprone/BugproneTidyModule.cpp
clang-tools-extra/clang-tidy/bugp
Yoorkin updated this revision to Diff 454226.
Yoorkin marked 10 inline comments as done.
Yoorkin added a comment.
I fixed them all
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D132294/new/
https://reviews.llvm.org/D132294
Files:
clang-tools-extra/clang-tidy/bugprone/BugproneTidyModul
Yoorkin added inline comments.
Comment at:
clang-tools-extra/clang-tidy/bugprone/SprintfWithFixedSizeBufferCheck.h:29
+ void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
+};
+
Eugene.Zelenko wrote:
> Please add `isLanguageVersionSupport
Yoorkin created this revision.
Yoorkin added a reviewer: clang-tools-extra.
Yoorkin added a project: clang-tools-extra.
Herald added subscribers: carlosgalvezp, xazax.hun, mgorny.
Herald added a project: All.
Yoorkin requested review of this revision.
Herald added a subscriber: cfe-commits.
Hi, I