diff options
Diffstat (limited to 'clang/lib/Sema/SemaDeclAttr.cpp')
-rw-r--r-- | clang/lib/Sema/SemaDeclAttr.cpp | 11 |
1 files changed, 4 insertions, 7 deletions
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<ValueDecl>(D)->getType(); - if (!QT->isDependentType()) { - const RecordType *RT = getRecordType(QT); - if (!RT || !RT->getDecl()->hasAttr<CapabilityAttr>()) { - 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. |