Fix member call on null pointer, found by sanitizer buildbot.

llvm-svn: 279571
This commit is contained in:
Richard Smith 2016-08-23 21:12:54 +00:00
parent 0549a39a17
commit 3f6865a8b0
1 changed files with 4 additions and 2 deletions

View File

@ -3555,9 +3555,11 @@ void Sema::InstantiateFunctionDefinition(SourceLocation PointOfInstantiation,
assert(PatternDecl && "instantiating a non-template");
const FunctionDecl *PatternDef = PatternDecl->getDefinition();
Stmt *Pattern = PatternDef->getBody(PatternDef);
if (PatternDef)
Stmt *Pattern = nullptr;
if (PatternDef) {
Pattern = PatternDef->getBody(PatternDef);
PatternDecl = PatternDef;
}
// FIXME: We need to track the instantiation stack in order to know which
// definitions should be visible within this instantiation.