aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Sema/SemaDeclAttr.cpp3
-rw-r--r--test/SemaCXX/warn-thread-safety-analysis.cpp29
2 files changed, 27 insertions, 5 deletions
diff --git a/lib/Sema/SemaDeclAttr.cpp b/lib/Sema/SemaDeclAttr.cpp
index 119ce7dfff..3b0820a5eb 100644
--- a/lib/Sema/SemaDeclAttr.cpp
+++ b/lib/Sema/SemaDeclAttr.cpp
@@ -872,9 +872,6 @@ static void handleLockReturnedAttr(Sema &S, Decl *D,
return;
}
- if (Arg->isTypeDependent())
- return;
-
// check that the argument is lockable object
SmallVector<Expr*, 1> Args;
checkAttrArgsAreLockableObjs(S, D, Attr, Args);
diff --git a/test/SemaCXX/warn-thread-safety-analysis.cpp b/test/SemaCXX/warn-thread-safety-analysis.cpp
index 7637b77405..463dd7d05b 100644
--- a/test/SemaCXX/warn-thread-safety-analysis.cpp
+++ b/test/SemaCXX/warn-thread-safety-analysis.cpp
@@ -3241,7 +3241,7 @@ static void test() {
lt->mu_.Unlock();
}
-}
+} // end namespace TrylockWithCleanups
namespace UniversalLock {
@@ -3315,4 +3315,29 @@ class Foo {
}
};
-}
+} // end namespace UniversalLock
+
+
+namespace TemplateLockReturned {
+
+template<class T>
+class BaseT {
+public:
+ virtual void baseMethod() = 0;
+ Mutex* get_mutex() LOCK_RETURNED(mutex_) { return &mutex_; }
+
+ Mutex mutex_;
+ int a GUARDED_BY(mutex_);
+};
+
+
+class Derived : public BaseT<int> {
+public:
+ void baseMethod() EXCLUSIVE_LOCKS_REQUIRED(get_mutex()) {
+ a = 0;
+ }
+};
+
+} // end namespace TemplateLockReturned
+
+