[PATCH] D108469: Improve handling of static assert messages.

Aaron Ballman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 30 07:38:45 PDT 2021


aaron.ballman added inline comments.


================
Comment at: clang/lib/Basic/Diagnostic.cpp:792
+static void pushEscapedString(StringRef Str, SmallVectorImpl<char> &OutStr) {
+  OutStr.reserve(OutStr.size() + Str.size());
+  const unsigned char *Begin =
----------------
cor3ntin wrote:
> jfb wrote:
> > Can this addition overflow?
> Technically yes, if you are trying to output a single string over 4GB I guess. Do we care?
Personally, I'm not overly worried about that scenario (I suspect we will run into overflow like that far earlier). But if @jfb has a situation in mind where this might be a concern, checking for overflow and diagnosing it wouldn't be the worst outcome either.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108469/new/

https://reviews.llvm.org/D108469



More information about the llvm-commits mailing list