RangeInfo: fix a crash when a var decl doesn't have a patternbindingdecl as parent. (#8255)

This commit is contained in:
Xi Ge
2017-03-21 16:41:34 -07:00
committed by GitHub
parent 982601a7dc
commit 8e0aaa6886
2 changed files with 24 additions and 1 deletions

View File

@@ -661,7 +661,8 @@ public:
case RangeMatchKind::NoneMatch:
// PatternBindingDecl is not visited; we need to explicitly analyze here.
if (auto *VA = dyn_cast_or_null<VarDecl>(D))
analyze(VA->getParentPatternBinding());
if (auto PBD = VA->getParentPatternBinding())
analyze(PBD);
break;
case RangeMatchKind::RangeMatch: {
postAnalysis(Node);