Index: lib/AST/ASTDiagnostic.cpp =================================================================== --- lib/AST/ASTDiagnostic.cpp +++ lib/AST/ASTDiagnostic.cpp @@ -1683,7 +1683,7 @@ ToName = ToTD->getQualifiedNameAsString(); } - if (Same) { + if (Same && FromTD) { OS << "template " << FromTD->getNameAsString(); } else if (!PrintTree) { OS << (FromDefault ? "(default) template " : "template "); Index: lib/AST/DeclObjC.cpp =================================================================== --- lib/AST/DeclObjC.cpp +++ lib/AST/DeclObjC.cpp @@ -1577,8 +1577,10 @@ data().IvarList = layout[0].Ivar; Ix++; curIvar = data().IvarList; } - for ( ; Ix != EIx; curIvar = layout[Ix].Ivar, Ix++) + for ( ; Ix != EIx; curIvar = layout[Ix].Ivar, Ix++) { + assert(curIvar && "instance variable is NULL, stop iterating through layout"); curIvar->setNextIvar(layout[Ix].Ivar); + } } } } Index: lib/AST/ExprConstant.cpp =================================================================== --- lib/AST/ExprConstant.cpp +++ lib/AST/ExprConstant.cpp @@ -1989,6 +1989,7 @@ static bool HandleLValueArrayAdjustment(EvalInfo &Info, const Expr *E, LValue &LVal, QualType EltTy, int64_t Adjustment) { + assert(E && "expression to be evaluated must be not NULL"); CharUnits SizeOfPointee; if (!HandleSizeof(Info, E->getExprLoc(), EltTy, SizeOfPointee)) return false; Index: lib/AST/NestedNameSpecifier.cpp =================================================================== --- lib/AST/NestedNameSpecifier.cpp +++ lib/AST/NestedNameSpecifier.cpp @@ -456,7 +456,9 @@ Buffer = NewBuffer; BufferCapacity = NewCapacity; } - + + assert(Buffer && "Buffer cannot be NULL"); + memcpy(Buffer + BufferSize, Start, End - Start); BufferSize += End-Start; }