[PATCH] D64811: Warn when NumParams overflows

John McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 26 11:29:39 PDT 2019


rjmccall added inline comments.


================
Comment at: clang/include/clang/AST/Type.h:1523
 
+  enum { NumParamsBits = 16 };
+
----------------
This should probably go in `FunctionTypeBitfields`.


================
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()) {
----------------
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?


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