[clang] No longer add enumeration constants to the wrong scope (PR #134998)
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 9 09:01:03 PDT 2025
================
@@ -5585,6 +5585,18 @@ SourceRange EnumConstantDecl::getSourceRange() const {
return SourceRange(getLocation(), End);
}
+bool EnumConstantDecl::isOutOfLine() const {
+ if (Decl::isOutOfLine())
+ return true;
+
+ // In C++, if the enumeration is out of line, the enumeration constants are
+ // also out of line.
+ if (getLangOpts().CPlusPlus)
----------------
erichkeane wrote:
Not sure I get the point of the C++ check? I would presume that C just has no way to SPELL `out-of-line` enums, so this is a 'can't happen'. But I wonder if we should just depend on that and do this for each language, in case C ever figures out how to spell namespacing :)
https://github.com/llvm/llvm-project/pull/134998
More information about the cfe-commits
mailing list