Skip to content

Commit bfaef28

Browse files
don't load raw comments for invalid serialized ranges
1 parent 2009308 commit bfaef28

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/AST/RawComment.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,9 @@ RawComment Decl::getRawComment(bool SerializedOK) const {
154154
if (!CachedLocs->DocRanges.empty()) {
155155
SmallVector<SingleRawComment, 4> SRCs;
156156
for (const auto &Range : CachedLocs->DocRanges) {
157-
SRCs.push_back({ Range, Context.SourceMgr });
157+
if (Range.isValid()) {
158+
SRCs.push_back({ Range, Context.SourceMgr });
159+
}
158160
}
159161
auto RC = RawComment(Context.AllocateCopy(llvm::makeArrayRef(SRCs)));
160162

0 commit comments

Comments
 (0)