From 2b504dce14ef817a6a3f83cedee9f6f20066a93d Mon Sep 17 00:00:00 2001 From: DeLesley Hutchins Date: Tue, 29 Sep 2015 16:24:18 +0000 Subject: Thread Safety Analysis: allow capability attribute on unions. llvm-svn: 248805 --- clang/lib/Sema/SemaDeclAttr.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'clang/lib/Sema/SemaDeclAttr.cpp') diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp index 9cc082152bb..8218c20696d 100644 --- a/clang/lib/Sema/SemaDeclAttr.cpp +++ b/clang/lib/Sema/SemaDeclAttr.cpp @@ -628,13 +628,10 @@ static bool checkAcquireOrderAttrCommon(Sema &S, Decl *D, // Check that this attribute only applies to lockable types. QualType QT = cast(D)->getType(); - if (!QT->isDependentType()) { - const RecordType *RT = getRecordType(QT); - if (!RT || !RT->getDecl()->hasAttr()) { - S.Diag(Attr.getLoc(), diag::warn_thread_attribute_decl_not_lockable) - << Attr.getName(); - return false; - } + if (!QT->isDependentType() && !typeHasCapability(S, QT)) { + S.Diag(Attr.getLoc(), diag::warn_thread_attribute_decl_not_lockable) + << Attr.getName(); + return false; } // Check that all arguments are lockable objects. -- cgit v1.2.3