Revert "Revert "Update aosp/master libcxx rebase to r263688""
This reverts commit 1d4a1edbc7.
Change-Id: I2909937fe582f2c5552bc86e7f4d2d5cff0de0aa
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// UNSUPPORTED: libcpp-has-no-threads
|
||||
|
||||
// <mutex>
|
||||
|
||||
// This test does not define _LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS so it
|
||||
// should compile without any warnings or errors even though this pattern is not
|
||||
// understood by the thread safety annotations.
|
||||
|
||||
#include <mutex>
|
||||
|
||||
int main() {
|
||||
std::mutex m;
|
||||
m.lock();
|
||||
{
|
||||
std::unique_lock<std::mutex> g(m, std::adopt_lock);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// UNSUPPORTED: libcpp-has-no-threads
|
||||
// REQUIRES: thread-safety
|
||||
|
||||
// <mutex>
|
||||
|
||||
#define _LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS
|
||||
|
||||
#include <mutex>
|
||||
|
||||
std::mutex m;
|
||||
int foo __attribute__((guarded_by(m)));
|
||||
|
||||
int main() {
|
||||
std::lock_guard<std::mutex> lock(m);
|
||||
foo++;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// UNSUPPORTED: libcpp-has-no-threads
|
||||
// REQUIRES: thread-safety
|
||||
|
||||
// <mutex>
|
||||
|
||||
#define _LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS
|
||||
|
||||
#include <mutex>
|
||||
|
||||
std::mutex m;
|
||||
int foo __attribute__((guarded_by(m)));
|
||||
|
||||
int main() {
|
||||
m.lock();
|
||||
foo++;
|
||||
m.unlock();
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// UNSUPPORTED: libcpp-has-no-threads
|
||||
// REQUIRES: thread-safety
|
||||
|
||||
// <mutex>
|
||||
|
||||
#define _LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS
|
||||
|
||||
#include <mutex>
|
||||
|
||||
std::mutex m;
|
||||
|
||||
int main() {
|
||||
m.lock();
|
||||
} // expected-error {{mutex 'm' is still held at the end of function}}
|
||||
@@ -0,0 +1,30 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
// UNSUPPORTED: libcpp-has-no-threads
|
||||
// REQUIRES: thread-safety
|
||||
|
||||
// <mutex>
|
||||
|
||||
#define _LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS
|
||||
|
||||
#include <mutex>
|
||||
|
||||
std::mutex m;
|
||||
int foo __attribute__((guarded_by(m)));
|
||||
|
||||
void increment() __attribute__((requires_capability(m))) {
|
||||
foo++;
|
||||
}
|
||||
|
||||
int main() {
|
||||
m.lock();
|
||||
increment();
|
||||
m.unlock();
|
||||
}
|
||||
Reference in New Issue
Block a user