Fix an edge case in determining is a function has a prototype
authorAaron Ballman <aaron@aaronballman.com>
Fri, 15 Apr 2022 18:03:46 +0000 (14:03 -0400)
committerAaron Ballman <aaron@aaronballman.com>
Fri, 15 Apr 2022 18:04:07 +0000 (14:04 -0400)
commit8fd3b5de3f96300189a2841278e6c7b6654bffc5
treeabaf8f2cbddf50503f400a75413040b982fa2c54
parent2f78f9455f85e61fcfeb1dc3a13d62c912aa0c96
Fix an edge case in determining is a function has a prototype

Given the declaration:

  typedef void func_t(unsigned);
  __attribute__((noreturn)) func_t func;

we would incorrectly determine that `func` had no prototype because the
`noreturn` attribute would convert the underlying type directly into a
FunctionProtoType, but the declarator for `func` itself was not one for
a function with a prototype. This adds an additional check for when the
declarator is a type representation for a function with a prototype.
clang/lib/Sema/SemaDecl.cpp
clang/test/Sema/warn-strict-prototypes.c