From: John McCall Date: Fri, 23 Oct 2009 01:28:53 +0000 (+0000) Subject: FunctionTypeLocs don't necessarily provide ParmVarDecls, so don't crash if X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=86acc2a0ea327bce89b024b23ee071708da98d2f;p=clang 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 7dc60f8e99..e804bfc90e 100644 --- a/lib/Frontend/PCHReader.cpp +++ b/lib/Frontend/PCHReader.cpp @@ -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(Reader.GetDecl(Record[Idx++]))); + TL.setArg(i, cast_or_null(Reader.GetDecl(Record[Idx++]))); } } void TypeLocReader::VisitFunctionProtoTypeLoc(FunctionProtoTypeLoc TL) {