[PATCH] D149733: [clang][USR] Prevent crashes on incomplete FunctionDecls

Ilya Biryukov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 3 02:59:48 PDT 2023


ilya-biryukov added a subscriber: erichkeane.
ilya-biryukov added a comment.

It's true that `FunctionType` having a null type does break a lot of even its own methods,
e.g. even something as simple as `isVariadic` will dereference a null pointer as it uses `getType()->getAs<FunctionType>()`.

I am not entirely sure what the contract there should be either.

- Is it the client code of `FunctionDecl` itself that's responsible for checking the null type or methods of `FunctionDecl`?
- Would it be easier to avoid creating the functions altogether? (I remember seeing some legitimate use-cases for null types there, but I wonder if those could be modelled differently).

@aaron.ballman, @erichkeane what is Clang's stance on those? How should we proceed here?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D149733



More information about the cfe-commits mailing list