[PATCH] D59900: [Sema] Fix a crash when nonnull checking

Michael Liao via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 28 05:50:40 PDT 2019


hliao added a comment.

just explain what's the issue is and hope that help reviewers to get this fix quick.

- In `Sema::DiagnoseAlwaysNonNullPointer`, we issue warnings if a `nonnull` parameter is used in null checking. It need the function declaration to check parameter attributes. That usually works but fails if that function decl is not ready yet.
- In template instantiation, we first create the function prototype followed by instantiating the function body. When the function prototype is being formed, we may create binary or other expressions  for semantic checking. But, in that phase, i.e. `Sema::SubstFunctionDeclType`, we don't have the a fully specialized function prototype yet to check the parameter number and run into the assertion @ line 11596.

Hope that help to get the picture of this fix. Thanks.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D59900





More information about the cfe-commits mailing list