[PATCH] D24469: [clang-cl] Diagnose duplicate uuids.

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 12 15:10:39 PDT 2016


aaron.ballman added inline comments.

================
Comment at: include/clang/Basic/DiagnosticSemaKinds.td:2258
@@ -2257,1 +2257,3 @@
   "uuid attribute contains a malformed GUID">;
+def err_mismatched_uuid : Error<"uiid does not match previous declaration">;
+def note_previous_uuid : Note<"previous uuid specified here">;
----------------
uuid instead of uiid.

================
Comment at: lib/Parse/ParseDecl.cpp:1476
@@ +1475,3 @@
+  // Find end of type attributes Attrs and add NewTypeAttributes in the same
+  // order they were in originally.  (Remember, in AttributeList things earlier
+  // in source order are later in the list, since new attributes are added to
----------------
Remove double space here.

================
Comment at: lib/Sema/SemaDecl.cpp:2255
@@ -2249,1 +2254,3 @@
+  // previous decl", for example if the attribute needs to be consistent
+  // between redeclarations, you need to call a custom merge function here.
   InheritableAttr *NewAttr = nullptr;
----------------
Thank you for the improved comments as a drive-by.

================
Comment at: lib/Sema/SemaDeclAttr.cpp:4609
@@ +4608,3 @@
+                              unsigned AttrSpellingListIndex, StringRef Uuid) {
+  if (UuidAttr *UA = D->getAttr<UuidAttr>()) {
+    if (UA->getGuid() == Uuid)
----------------
Can use `const auto *` here.

Also, don't you need to iterate over all of the `UuidAttr` objects attached to the declaration to see if any of them match, rather than just the first?


https://reviews.llvm.org/D24469





More information about the cfe-commits mailing list