[PATCH] D26846: __uuidof() and declspec(uuid("...")) should be allowed on enumeration types

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 18 08:00:56 PST 2016


aaron.ballman added a reviewer: aaron.ballman.
aaron.ballman added inline comments.


================
Comment at: include/clang/Basic/Attr.td:1621
   let Args = [StringArgument<"Guid">];
-//  let Subjects = SubjectList<[CXXRecord]>;
+  let Subjects = SubjectList<[CXXRecord, Enum], WarnDiag, "ExpectedEnumOrClass">;
   let LangOpts = [MicrosoftExt, Borland];
----------------
You can drop the `WarnDiag` and `ExpectedEnumOrClass` -- that should be handled automatically by the tablegen emitter once you change `CalculateDiagnostic()` in ClangAttrEmitter.cpp to handle it properly.


================
Comment at: include/clang/Basic/DiagnosticSemaKinds.td:2637
+  "|variables, functions, methods, types, enumerations, enumerators, labels, and non-static data members"
+  "|classes, enums}1">,
   InGroup<IgnoredAttributes>;
----------------
This should read `classes and enumerations`.


================
Comment at: lib/Sema/SemaDeclAttr.cpp:4669-4673
+  if (!(isa<CXXRecordDecl>(D) || isa<EnumDecl>(D))) {
     S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type)
-      << Attr.getName() << ExpectedClass;
+      << Attr.getName() << ExpectedEnumOrClass;
     return;
   }
----------------
majnemer wrote:
> I don't think you need this now that you've got this in Attr.td
Correct, this entire block should go away.


Repository:
  rL LLVM

https://reviews.llvm.org/D26846





More information about the cfe-commits mailing list