]> granicus.if.org Git - clang/commitdiff
FunctionTypeLocs don't necessarily provide ParmVarDecls, so don't crash if
authorJohn McCall <rjmccall@apple.com>
Fri, 23 Oct 2009 01:28:53 +0000 (01:28 +0000)
committerJohn McCall <rjmccall@apple.com>
Fri, 23 Oct 2009 01:28:53 +0000 (01:28 +0000)
one was PCH'ed without any.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84920 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Frontend/PCHReader.cpp

index 7dc60f8e99448ecff9770429b66934881954b36d..e804bfc90eb8d47264f8e773b5c5a4685e6420e7 100644 (file)
@@ -2065,7 +2065,7 @@ void TypeLocReader::VisitFunctionTypeLoc(FunctionTypeLoc TL) {
   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) {