[PATCH] D79431: [analyzer] StdLibraryFunctionsChecker: Add better diagnostics
Balázs Benics via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jul 14 04:12:13 PDT 2020
steakhal added a comment.
Could you add some tests demonstrating the refined diagnostics of the checker?
It would help to validate the quality of the emitted diagnostics.
================
Comment at: clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp:88
/// obviously uint32_t should be enough for all practical purposes.
typedef uint32_t ArgNo;
static const ArgNo Ret;
----------------
Shouldn't we use `using` instead?
================
Comment at: clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp:323
+ std::string("Function argument constraint is not satisfied, ") +
+ VC->getName().data() + ", ArgN: " + std::to_string(VC->getArgNo());
if (!BT_InvalidArg)
----------------
balazske wrote:
> baloghadamsoftware wrote:
> > Instead of `std::string` we usually use `llvm::SmallString` and an `llvm::raw_svector_ostream` to print into it.
> This would look better?
> "Function argument constraint is not satisfied, constraint: <Name>, ArgN: <ArgN>"
Maybe `llvm::Twine` would be a better choice to `llvm::raw_svector_ostream` for string concatenations.
docs:
> Twine - A lightweight data structure for efficiently representing the concatenation of temporary values as strings.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D79431/new/
https://reviews.llvm.org/D79431
More information about the cfe-commits
mailing list