[all-commits] [llvm/llvm-project] a3a8a1: [Index] Ignore nullptr decls for indexing

Alex Hoppen via All-commits all-commits at lists.llvm.org
Thu May 6 13:13:06 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a3a8a1a15b524d91b5308db68e9d293b34cd88dd
      https://github.com/llvm/llvm-project/commit/a3a8a1a15b524d91b5308db68e9d293b34cd88dd
  Author: Alex Hoppen <ahoppen at apple.com>
  Date:   2021-05-06 (Thu, 06 May 2021)

  Changed paths:
    M clang/lib/Index/IndexDecl.cpp

  Log Message:
  -----------
  [Index] Ignore nullptr decls for indexing

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.

Reviewed By: akyrtzi

Differential Revision: https://reviews.llvm.org/D102001




More information about the All-commits mailing list