ahoppen created this revision.
Herald added a subscriber: arphaman.
ahoppen requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
We can end up with a call to `indexTopLevelDecl(D)` with `D == nullptr` in
non-assert builds e.g. when indexing a module in `indexModule` and
- `ASTReader::GetDecl` returns `nullptr` if `Index >= DeclsLoaded.size()`, thus
returning `nullptr`
> `ModuleDeclIterator::operator*` returns `nullptr`
===================================================
> we call `IndexCtx.indexTopLevelDecl` with `nullptr`
=====================================================
Be resilient and just ignore the `nullptr` decls during indexing.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D102001
Files:
clang/lib/Index/IndexDecl.cpp
Index: clang/lib/Index/IndexDecl.cpp
===================================================================
--- clang/lib/Index/IndexDecl.cpp
+++ 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<ObjCMethodDecl>(D))
Index: clang/lib/Index/IndexDecl.cpp
===================================================================
--- clang/lib/Index/IndexDecl.cpp
+++ 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<ObjCMethodDecl>(D))
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits