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

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 23 14:12:55 PDT 2016


Author: rsmith
Date: Tue Aug 23 16:12:54 2016
New Revision: 279571

URL: http://llvm.org/viewvc/llvm-project?rev=279571&view=rev
Log:
Fix member call on null pointer, found by sanitizer buildbot.

Modified:
    cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp

Modified: cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp?rev=279571&r1=279570&r2=279571&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp Tue Aug 23 16:12:54 2016
@@ -3555,9 +3555,11 @@ void Sema::InstantiateFunctionDefinition
   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.




More information about the cfe-commits mailing list