[PATCH] D79431: [analyzer] StdLibraryFunctionsChecker: Add better diagnostics
Gabor Marton via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Jul 24 02:35:00 PDT 2020
martong added inline comments.
================
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)
----------------
martong wrote:
> steakhal wrote:
> > 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.
> We can use a Twine to create the owning std::string without creating interim objects. But then we must pass an owning object to the ctor of PathSensitiveBugReport, otherwise we might end up with dangling pointers.
> https://llvm.org/docs/ProgrammersManual.html#dss-twine
Yes, I like this.
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