[clang] [clang] Fix crashes with inheritance model keywords (PR #228207)
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 2 06:12:52 PDT 2026
================
@@ -4623,7 +4623,16 @@ def MSInheritance : InheritableAttr {
let Spellings = [CustomKeyword<"__single_inheritance">,
CustomKeyword<"__multiple_inheritance">,
CustomKeyword<"__virtual_inheritance">,
- CustomKeyword<"__unspecified_inheritance">];
+ CustomKeyword<"__unspecified_inheritance">,
+ // The single underscore spellings are aliases defined in
+ // TokenKinds.def; they must come *after* all of the other
+ // spellings because otherwise the MSInheritanceModel
+ // enumeration will break (we're relying on token
+ // normalization converting the alias to the normal form).
+ CustomKeyword<"_single_inheritance">,
+ CustomKeyword<"_multiple_inheritance">,
+ CustomKeyword<"_virtual_inheritance">
----------------
erichkeane wrote:
All of the infrastructure we have to do funny-business for attributes ends up getting sorta-applied to keywords. At one point someone should examine everything our tablegen does and figure out which things we WANT for keywords (as well as every other comparison/etc interaction!).
That said... today is not that day :D And given how few of these we have (and that this problem is really only cases where there are keywords for these things in a 'partially stripped' situation), I suspect this gets basically all of the bugs anyway.
https://github.com/llvm/llvm-project/pull/228207
More information about the cfe-commits
mailing list