Skip to content

Commit a69813f

Browse files
skip loading comment ranges if one of them was invalid
1 parent 3e8b3e8 commit a69813f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/AST/RawComment.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,11 @@ RawComment Decl::getRawComment(bool SerializedOK) const {
156156
for (const auto &Range : CachedLocs->DocRanges) {
157157
if (Range.isValid()) {
158158
SRCs.push_back({ Range, Context.SourceMgr });
159+
} else {
160+
// if we've run into an invalid range, don't bother trying to load any of
161+
// the other comments
162+
SRCs.clear();
163+
break;
159164
}
160165
}
161166
auto RC = RawComment(Context.AllocateCopy(llvm::makeArrayRef(SRCs)));

0 commit comments

Comments
 (0)