Skip to content

Commit 1614b71

Browse files
davidungarNathan Hawes
authored andcommitted
Don’t dive into null parts of AST.
1 parent ded139e commit 1614b71

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

lib/AST/USRGeneration.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ bool ide::printDeclUSR(const ValueDecl *D, raw_ostream &OS) {
226226
return printObjCUSR(D, OS);
227227
}
228228

229-
if (!D->hasInterfaceType())
229+
if (!D->hasInterfaceType() || D->getInterfaceType()->is<ErrorType>())
230230
return true;
231231

232232
// Invalid code.

lib/IDE/SourceEntityWalker.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,8 @@ static SemaReferenceKind getReferenceKind(Expr *Parent, Expr *E) {
247247
}
248248

249249
std::pair<bool, Expr *> SemaAnnotator::walkToExprPre(Expr *E) {
250+
assert(E);
251+
250252
if (isDone())
251253
return { false, nullptr };
252254

@@ -409,11 +411,11 @@ std::pair<bool, Expr *> SemaAnnotator::walkToExprPre(Expr *E) {
409411
llvm::SaveAndRestore<Optional<AccessKind>>
410412
C(this->OpAccess, AccessKind::Write);
411413

412-
if (!AE->getDest()->walk(*this))
414+
if (AE->getDest() && !AE->getDest()->walk(*this))
413415
return { false, nullptr };
414416
}
415417

416-
if (!AE->getSrc()->walk(*this))
418+
if (AE->getSrc() && !AE->getSrc()->walk(*this))
417419
return { false, nullptr };
418420

419421
// We already visited the children.

0 commit comments

Comments
 (0)