don't load raw comments for invalid serialized ranges

This commit is contained in:
Victoria Mitchell
2021-02-10 09:14:45 -07:00
parent 2009308938
commit bfaef28fc7

View File

@@ -154,7 +154,9 @@ RawComment Decl::getRawComment(bool SerializedOK) const {
if (!CachedLocs->DocRanges.empty()) {
SmallVector<SingleRawComment, 4> SRCs;
for (const auto &Range : CachedLocs->DocRanges) {
SRCs.push_back({ Range, Context.SourceMgr });
if (Range.isValid()) {
SRCs.push_back({ Range, Context.SourceMgr });
}
}
auto RC = RawComment(Context.AllocateCopy(llvm::makeArrayRef(SRCs)));