[PATCH] D93095: Introduce -Wreserved-identifier

serge via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 29 14:07:37 PST 2021


serge-sans-paille marked an inline comment as done.
serge-sans-paille added a comment.

@rsmith I did my bet to address your comments. What do you think of current state?



================
Comment at: clang/lib/Sema/SemaDecl.cpp:13640
 
+  warnOnReservedIdentifier(New);
+
----------------
serge-sans-paille wrote:
> rsmith wrote:
> > Is there somewhere more central you can do this, rather than repeating it once for each kind of declaration? (Eg, `PushOnScopeChains`)
> That would be sane. I'll check that.
I tried PushOnScopeChains, and this does not capture all the required declarations. I failed to find another place :-/


================
Comment at: clang/lib/Sema/SemaDecl.cpp:16296
   } else {
+    if (TUK == TUK_Definition)
+      warnOnReservedIdentifier(New);
----------------
serge-sans-paille wrote:
> rsmith wrote:
> > Why do we not diagnose the other possible `TagUseKind`s? `struct _foo;` and `struct _foo *p;` both use reserved identifiers too.
> We have a test case for `struct _foo` and its correctly diagnosed. I'll double check for pointer / reference too.
Test case added for pointers, works like a charm.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93095/new/

https://reviews.llvm.org/D93095



More information about the cfe-commits mailing list