[PATCH] D146426: [Sema] Fix crash on __fp16 parameters in template instantiations

Erich Keane via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 20 12:07:50 PDT 2023


erichkeane added a comment.

In D146426#4207118 <https://reviews.llvm.org/D146426#4207118>, @aaron.ballman wrote:

> This feels like it's heading in the wrong direction -- the AST should not have holes in it. An invalid type should be replaced by a valid type (after diagnosing the invalid type, of course) so that we can keep as much of the AST around as possible (for example, we typically stub in `int` and continue compilation, as in: https://godbolt.org/z/MvxjGovGh), which should then result in a non-null `ParmVarDecl`. This way, we don't need to sprinkle nullptr checks all over the compiler when inspecting a function's parameters.

Frankly, I would like to see us just insert the `__fp16` type instead.  We've already diagnosed, so we won't go to codegen, which is where the parameter issue is going to cause a problem.  I can't imagine we have ANY code that depends on `__fp16` and would break if it is a parameter.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D146426



More information about the cfe-commits mailing list