Allow redeclaration of __declspec(uuid)
msvc allows a subsequent declaration of a uuid attribute on a
struct/class. Mirror this behavior in clang-cl.
Reviewed By: rnk
Differential Revision: https://reviews.llvm.org/D71439
diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp
index ac83a9b..50951ad 100644
--- a/clang/lib/Sema/SemaDeclAttr.cpp
+++ b/clang/lib/Sema/SemaDeclAttr.cpp
@@ -5394,9 +5394,11 @@
if (const auto *UA = D->getAttr<UuidAttr>()) {
if (UA->getGuid().equals_lower(Uuid))
return nullptr;
- Diag(UA->getLocation(), diag::err_mismatched_uuid);
- Diag(CI.getLoc(), diag::note_previous_uuid);
- D->dropAttr<UuidAttr>();
+ if (!UA->getGuid().empty()) {
+ Diag(UA->getLocation(), diag::err_mismatched_uuid);
+ Diag(CI.getLoc(), diag::note_previous_uuid);
+ D->dropAttr<UuidAttr>();
+ }
}
return ::new (Context) UuidAttr(Context, CI, Uuid);