aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDeLesley Hutchins <delesley@google.com>2012-09-21 17:57:00 +0000
committerDeLesley Hutchins <delesley@google.com>2012-09-21 17:57:00 +0000
commitd2f388299153d80cbe5ffaaed8a882b59a1b59bc (patch)
tree57d6947c8743be25f8527ff24cb7d9157523f93c /test
parent938869941e5a01049fb301fbf82f3caa4c7efa09 (diff)
Thread-safety analysis: better handling of unreachable blocks. Fixes a bug
where a call to function marked 'noreturn' is followed by unreachable implicit destructor calls. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164394 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/SemaCXX/warn-thread-safety-analysis.cpp21
1 files changed, 15 insertions, 6 deletions
diff --git a/test/SemaCXX/warn-thread-safety-analysis.cpp b/test/SemaCXX/warn-thread-safety-analysis.cpp
index fa8786a957..fd3577c303 100644
--- a/test/SemaCXX/warn-thread-safety-analysis.cpp
+++ b/test/SemaCXX/warn-thread-safety-analysis.cpp
@@ -64,6 +64,7 @@ void beginNoWarnOnWrites() EXCLUSIVE_LOCK_FUNCTION("*");
void endNoWarnOnWrites() UNLOCK_FUNCTION("*");
+// For testing handling of smart pointers.
template<class T>
class SmartPtr {
public:
@@ -80,6 +81,15 @@ private:
};
+// For testing destructor calls and cleanup.
+class MyString {
+public:
+ MyString(const char* s);
+ ~MyString();
+};
+
+
+
Mutex sls_mu;
Mutex sls_mu2 __attribute__((acquired_after(sls_mu)));
@@ -3250,12 +3260,6 @@ void Base::bar(Inner* i) {
namespace TrylockWithCleanups {
-class MyString {
-public:
- MyString(const char* s);
- ~MyString();
-};
-
struct Foo {
Mutex mu_;
int a GUARDED_BY(mu_);
@@ -3460,6 +3464,7 @@ public:
};
void exitNow() __attribute__((noreturn));
+void exitDestruct(const MyString& ms) __attribute__((noreturn));
Mutex fatalmu_;
@@ -3482,6 +3487,10 @@ void test3() EXCLUSIVE_LOCKS_REQUIRED(fatalmu_) {
}
}
+void test4() EXCLUSIVE_LOCKS_REQUIRED(fatalmu_) {
+ exitDestruct("foo");
+}
+
} // end namespace UnreachableExitTest