[PATCH] D52384: [Sema] Fix redeclaration contexts for enumerators in C

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 19 16:03:11 PDT 2018


rsmith added inline comments.


================
Comment at: lib/AST/DeclBase.cpp:1704-1705
+
+  // In C, the redeclaration context for enumerators is the translation unit,
+  // so we skip through transparent contexts as well as struct/union contexts.
+  bool SkipRecords = getDeclKind() == Decl::Kind::Enum &&
----------------
Nit: "the redeclaration context for enumerators is the translation unit" is not entirely accurate. The point instead is that a record type is only the redeclaration context for the fields of that record, so if we arrive at that context after skipping anything else, we should skip the record as well. (The check for "Enum" here is a red herring in that regard, but it happens to be correct because enumerations are the only transparent context that can exist within a struct or union currently.)


https://reviews.llvm.org/D52384





More information about the cfe-commits mailing list