[clang] [analyzer] Enhance array bound checking for `ConstantArrayType` (PR #159357)
Balazs Benics via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 18 08:12:53 PDT 2025
Alejandro =?utf-8?q?=C3=81lvarez_Ayll=C3=B3n?=,
Alejandro =?utf-8?q?=C3=81lvarez_Ayll=C3=B3n?=,
Alejandro =?utf-8?q?=C3=81lvarez_Ayll=C3=B3n?=
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/159357 at github.com>
================
@@ -637,11 +636,11 @@ static Messages getNegativeIndexMessage(StringRef Name,
Name, ArraySizeVal, IndexStr)};
}
-static std::string truncateWithEllipsis(StringRef str, size_t maxLength) {
- if (str.size() <= maxLength)
- return str.str();
+static std::string truncateWithEllipsis(StringRef Str, size_t MaxLength) {
+ if (Str.size() <= MaxLength)
+ return Str.str();
- return (str.substr(0, maxLength - 3) + "...").str();
+ return (Str.substr(0, MaxLength - 3) + "...").str();
}
----------------
steakhal wrote:
Can we make `MaxLength` of `int` and a non type template parameter?
That way static asserts could enforce the preconditions.
https://github.com/llvm/llvm-project/pull/159357
More information about the cfe-commits
mailing list