[PATCH] D76761: [clang-tidy] Fix crash in readability-redundant-string-cstr

Dmitri Gribenko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 25 09:10:13 PDT 2020


gribozavr2 added a comment.

In D76761#1941380 <https://reviews.llvm.org/D76761#1941380>, @njames93 wrote:

> In D76761#1941070 <https://reviews.llvm.org/D76761#1941070>, @gribozavr2 wrote:
>
> > Could you provide more information about why these null checks are needed in this case?
>
>
> Well the fact it was crashing without those null checks was the reason they were added. I'm not 100% sure of the root cause and this could just be a case of applying a plaster to a broken arm. I'm guessing the root cause of the crash is the fact the callee is a `CXXMethodDecl` which is not being handled but I honestly don't know.


Right -- what I meant is a more detailed description of why, for example, `tryGetCallExprAncestorForCxxConstructExpr` can't find the `CallExpr` in this case -- is it not there, or does it not have the expected shape, or something else? What does the AST look like?

I'm worried about adding defensive checks because they can make code more difficult to fix in future.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76761





More information about the cfe-commits mailing list