[PATCH] D117579: Add assert on End iteration distance to Rewriter::getRewrittenText.

Yitzhak Mandelbaum via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 25 09:28:15 PST 2022


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGbd1fac2fafd7: Add assert on End iteration distance to Rewriter::getRewrittenText. (authored by ahedberg, committed by ymandel).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D117579

Files:
  clang/lib/Rewrite/Rewriter.cpp


Index: clang/lib/Rewrite/Rewriter.cpp
===================================================================
--- clang/lib/Rewrite/Rewriter.cpp
+++ clang/lib/Rewrite/Rewriter.cpp
@@ -223,6 +223,7 @@
   RewriteBuffer::iterator Start = RB.begin();
   std::advance(Start, StartOff);
   RewriteBuffer::iterator End = Start;
+  assert(EndOff >= StartOff && "Invalid iteration distance");
   std::advance(End, EndOff-StartOff);
 
   return std::string(Start, End);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D117579.402944.patch
Type: text/x-patch
Size: 456 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220125/68844153/attachment-0001.bin>


More information about the cfe-commits mailing list