diff --git a/clang/lib/Index/IndexDecl.cpp b/clang/lib/Index/IndexDecl.cpp --- a/clang/lib/Index/IndexDecl.cpp +++ b/clang/lib/Index/IndexDecl.cpp @@ -759,7 +759,7 @@ } bool IndexingContext::indexTopLevelDecl(const Decl *D) { - if (D->getLocation().isInvalid()) + if (!D || D->getLocation().isInvalid()) return true; if (isa(D))