[PATCH] D64811: Warn when NumParams overflows
John McCall via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Jul 26 12:01:08 PDT 2019
rjmccall added inline comments.
================
Comment at: clang/lib/Parse/ParseDecl.cpp:6673
+ // Avoid exceeding the maximum function parameters
+ // See https://bugs.llvm.org/show_bug.cgi?id=19607
+ if (ParamInfo.size() > Type::getMaxNumParams()) {
----------------
rjmccall wrote:
> We don't usually cite bugs like this in the main source code except as "there's a bug with this, here's where we tracking fixing it". The comment explains the purpose of the diagnostic well enough (but please include a period).
>
> Can you just drop the excess arguments here instead of cutting off parsing?
Or actually — let's move this out of the parser entirely, because (unlike prototype scope depth) we actually need to diagnose it in Sema as well because of variadic templates. `Sema::BuildFunctionType` seems like the right place.
Also, can you `static_assert` that function declarations support at least as many parameter declarations as we allow in types?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D64811/new/
https://reviews.llvm.org/D64811
More information about the cfe-commits
mailing list