llvm-project/clang/lib/Rewrite
Ashley Hedberg bd1fac2faf Add assert on End iteration distance to Rewriter::getRewrittenText.
I currently have code that is crashing in the second std::advance call,
and it was not straightforward to identify the problem, as the first line
of the stacktrace is in RopePieceBTreeIterator::operator++:

```

*** SIGILL; stack trace: ***
PC: clang/include/clang/Rewrite/Core/RewriteRope.h:119 clang::RopePieceBTreeIterator::operator++()
    ../include/c++/v1/__iterator/advance.h:35 std::__u::__advance<>()
    ../include/c++/v1/__iterator/advance.h:65 std::__u::advance<>()
    clang/lib/Rewrite/Rewriter.cpp:228 clang::Rewriter::getRewrittenText()
    clang/include/clang/Rewrite/Core/Rewriter.h:106 clang::Rewriter::getRewrittenText()
```

Adding an assertion produces a friendlier error message for the caller.

Reviewed By: gribozavr2

Differential Revision: https://reviews.llvm.org/D117579
2022-01-25 17:26:13 +00:00
..
CMakeLists.txt
DeltaTree.cpp [clang] DeltaTree::AddDelta - fix "initialization is never read" clang-tidy warning. NFCI. 2021-03-02 15:01:34 +00:00
HTMLRewrite.cpp [clang] Use true/false instead of 1/0 (NFC) 2022-01-09 00:19:47 -08:00
RewriteRope.cpp
Rewriter.cpp Add assert on End iteration distance to Rewriter::getRewrittenText. 2022-01-25 17:26:13 +00:00
TokenRewriter.cpp