[cfe-commits] r163642 - in /cfe/trunk: lib/Sema/SemaDeclAttr.cpp test/SemaCXX/warn-thread-safety-analysis.cpp
DeLesley Hutchins
delesley at google.com
Tue Sep 11 11:27:46 PDT 2012
Author: delesley
Date: Tue Sep 11 13:27:46 2012
New Revision: 163642
URL: http://llvm.org/viewvc/llvm-project?rev=163642&view=rev
Log:
Thread safety analysis: fix bug related to lock_returned attribute
on templates.
Modified:
cfe/trunk/lib/Sema/SemaDeclAttr.cpp
cfe/trunk/test/SemaCXX/warn-thread-safety-analysis.cpp
Modified: cfe/trunk/lib/Sema/SemaDeclAttr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclAttr.cpp?rev=163642&r1=163641&r2=163642&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Tue Sep 11 13:27:46 2012
@@ -872,9 +872,6 @@
return;
}
- if (Arg->isTypeDependent())
- return;
-
// check that the argument is lockable object
SmallVector<Expr*, 1> Args;
checkAttrArgsAreLockableObjs(S, D, Attr, Args);
Modified: cfe/trunk/test/SemaCXX/warn-thread-safety-analysis.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/warn-thread-safety-analysis.cpp?rev=163642&r1=163641&r2=163642&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/warn-thread-safety-analysis.cpp (original)
+++ cfe/trunk/test/SemaCXX/warn-thread-safety-analysis.cpp Tue Sep 11 13:27:46 2012
@@ -3241,7 +3241,7 @@
lt->mu_.Unlock();
}
-}
+} // end namespace TrylockWithCleanups
namespace UniversalLock {
@@ -3315,4 +3315,29 @@
}
};
-}
+} // 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
+
+
More information about the cfe-commits
mailing list