[clang] [C] Diagnose use of C++ keywords in C (PR #137234)
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 28 08:35:22 PDT 2025
================
@@ -10416,6 +10447,15 @@ Sema::ActOnFunctionDeclarator(Scope *S, Declarator &D, DeclContext *DC,
// Finally, we know we have the right number of parameters, install them.
NewFD->setParams(Params);
+ // If this declarator is a declaration and not a definition, its parameters
+ // will not be pushed onto a scope chain. That means we will not issue any
+ // reserved identifier warnings for the declaration, but we will for the
+ // definition. Handle those here.
+ if (!Params.empty() && !D.isFunctionDefinition()) {
----------------
erichkeane wrote:
I suspect THIS is where your slowdown is going to come from, and I see no tests for this (that is, function parameters).
ALSO, `!Params.empty()` isnt' really necessary, the `for` loop will do that for you.
https://github.com/llvm/llvm-project/pull/137234
More information about the cfe-commits
mailing list