From ed0c7d6ff0e1859c6e883844579ba2794a848e50 Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Tue, 23 Aug 2016 21:12:54 +0000 Subject: [PATCH] Fix member call on null pointer, found by sanitizer buildbot. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@279571 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Sema/SemaTemplateInstantiateDecl.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/Sema/SemaTemplateInstantiateDecl.cpp b/lib/Sema/SemaTemplateInstantiateDecl.cpp index 75d7f70a63..f7d9787fbe 100644 --- a/lib/Sema/SemaTemplateInstantiateDecl.cpp +++ b/lib/Sema/SemaTemplateInstantiateDecl.cpp @@ -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. -- 2.40.0