[clang] [clang][analyzer] Model more getline/getdelim pre and postconditions (PR #83027)
Alejandro Álvarez Ayllón via cfe-commits
cfe-commits at lists.llvm.org
Thu Mar 21 01:38:52 PDT 2024
================
@@ -1179,6 +1195,113 @@ void StreamChecker::evalUngetc(const FnDescription *Desc, const CallEvent &Call,
C.addTransition(StateFailed);
}
+ProgramStateRef StreamChecker::ensureGetdelimBufferAndSizeCorrect(
+ SVal LinePtrPtrSVal, SVal SizePtrSVal, const Expr *LinePtrPtrExpr,
+ const Expr *SizePtrExpr, CheckerContext &C, ProgramStateRef State) const {
+ static constexpr char SizeGreaterThanBufferSize[] =
----------------
alejandro-alvarez-sonarsource wrote:
Now it uses `llvm:StringLiteral`, but I think it (relatively) is. Most existing uses of `constexpr llvm::StringLiteral` in llvm are with `static`. And, IIUC, without `static`, the variable is going to live on the stack and be created each time (even though its value was already computed at compile time).
Probably a moot point, though, since this is not part of a hotpath. For consistency with other uses, I'd rather keep it, though.
https://github.com/llvm/llvm-project/pull/83027
More information about the cfe-commits
mailing list