FunctionTypeLocs don't necessarily provide ParmVarDecls, so don't crash if
one was PCH'ed without any.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84920 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Frontend/PCHReader.cpp b/lib/Frontend/PCHReader.cpp
index 7dc60f8..e804bfc 100644
--- a/lib/Frontend/PCHReader.cpp
+++ b/lib/Frontend/PCHReader.cpp
@@ -2065,7 +2065,7 @@
TL.setLParenLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
TL.setRParenLoc(SourceLocation::getFromRawEncoding(Record[Idx++]));
for (unsigned i = 0, e = TL.getNumArgs(); i != e; ++i) {
- TL.setArg(i, cast<ParmVarDecl>(Reader.GetDecl(Record[Idx++])));
+ TL.setArg(i, cast_or_null<ParmVarDecl>(Reader.GetDecl(Record[Idx++])));
}
}
void TypeLocReader::VisitFunctionProtoTypeLoc(FunctionProtoTypeLoc TL) {