[PATCH] D17072: Return immediatedly if Method is null, otherwise you'll get a crash when dyn_cast is called with a nullptr

don hinton via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 10 07:08:41 PST 2016


hintonda created this revision.
hintonda added reviewers: doug.gregor, rnk.
hintonda added a subscriber: cfe-commits.

Fixes crash referenced in PR25181 where dyn_cast is called on a null instance of LM.Method.

http://reviews.llvm.org/D17072

Files:
  lib/Parse/ParseCXXInlineMethods.cpp

Index: lib/Parse/ParseCXXInlineMethods.cpp
===================================================================
--- lib/Parse/ParseCXXInlineMethods.cpp
+++ lib/Parse/ParseCXXInlineMethods.cpp
@@ -293,6 +293,7 @@
 }
 
 void Parser::ParseLexedMethodDeclaration(LateParsedMethodDeclaration &LM) {
+  if(!LM.Method) return;
   // If this is a member template, introduce the template parameter scope.
   ParseScope TemplateScope(this, Scope::TemplateParamScope, LM.TemplateScope);
   TemplateParameterDepthRAII CurTemplateDepthTracker(TemplateParameterDepth);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D17072.47449.patch
Type: text/x-patch
Size: 554 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160210/9e4202be/attachment.bin>


More information about the cfe-commits mailing list