[PATCH] D135257: [clangd][Tweak] Make sure enclosing function doesnt have invalid children

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 5 06:30:26 PDT 2022


hokein added a comment.

In D135257#3836511 <https://reviews.llvm.org/D135257#3836511>, @ilya-biryukov wrote:

> Having `nullptr` inside `children()` seems really weird. Should we fix those instead to never produce `nullptr`? Or is this something that is expected (I can come up with a few contracts where this would make sense, but that all looks really akward).

I'm not too surprised to see this, given the code action is widely triggered (on broken code). It would be nice that clang never produce a nullptr, but we're not in a perfect world. And there are other places (e.g. <https://github.com/llvm/llvm-project/blob/main/clang/lib/Sema/SemaExceptionSpec.cpp#L998>) in the code base doing this nullptr check. So to me, this patch is an improvement making clangd more robust, it looks good from my side.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D135257/new/

https://reviews.llvm.org/D135257



More information about the cfe-commits mailing list