================
@@ -23785,25 +23785,29 @@ EvaluateBuiltinStrLen(const Expr *E, EvalInfo &Info,
if (!EvaluatePointer(E, String, Info))
return std::nullopt;
+ QualType CharTy = E->getType()->getPointeeType();
+
// Fast path: if it's a string literal, search the string value.
if (const StringLiteral *S = dyn_cast_or_null<StringLiteral>(
String.getLValueBase().dyn_cast<const Expr *>())) {
StringRef Str = S->getBytes();
int64_t Off = String.Offset.getQuantity();
----------------
MScarta wrote:
It can be negative, `strlen("abc" - 1)` gets here with `Off` at -1, so an
assert would fire on that.
https://github.com/llvm/llvm-project/pull/241354
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits