[all-commits] [llvm/llvm-project] 281d17: [clang] Diagnose functions with too many parameter...
Vlad Serebrennikov via All-commits
all-commits at lists.llvm.org
Wed Aug 21 06:38:46 PDT 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 281d17840c35a1d80303bb6170c253fe2411f95f
https://github.com/llvm/llvm-project/commit/281d17840c35a1d80303bb6170c253fe2411f95f
Author: Vlad Serebrennikov <serebrennikov.vladislav at gmail.com>
Date: 2024-08-21 (Wed, 21 Aug 2024)
Changed paths:
M clang/docs/ReleaseNotes.rst
M clang/include/clang/AST/Type.h
M clang/include/clang/Basic/DiagnosticParseKinds.td
M clang/lib/Parse/ParseDecl.cpp
A clang/test/Parser/function-parameter-limit.cpp
Log Message:
-----------
[clang] Diagnose functions with too many parameters (#104833)
This patch adds a parser check when a function declaration or function
type declaration (in a function pointer declaration, for example) has
too many parameters for `FunctionTypeBits::NumParams` to hold. At the
moment of writing it's a 16-bit-wide bit-field, limiting the number of
parameters at 65536.
The check is added in the parser loop that goes over comma-separated
list of function parameters. This is not the solution Aaron suggested in
https://github.com/llvm/llvm-project/issues/35741#issuecomment-1638086571,
because it was found out that it's quite hard to recover from this
particular error in `GetFullTypeForDeclarator()`. Multiple options were
tried, but all of them led to crashes down the line.
I used LLVM Compile Time Tracker to ensure this does not introduce a
performance regression. I believe changes are in the noise:
https://llvm-compile-time-tracker.com/compare.php?from=de5ea2d122c31e1551654ff506c33df299f351b8&to=424818620766cedb2770e076ee359afeb0cc14ec&stat=instructions:u
Fixes #35741
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list