summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/SemaCXX')
-rw-r--r--clang/test/SemaCXX/attr-deprecated.cpp12
-rw-r--r--clang/test/SemaCXX/template-multiple-attr-propagation.cpp29
2 files changed, 35 insertions, 6 deletions
diff --git a/clang/test/SemaCXX/attr-deprecated.cpp b/clang/test/SemaCXX/attr-deprecated.cpp
index eab5a1c0ec0..1680c5c6760 100644
--- a/clang/test/SemaCXX/attr-deprecated.cpp
+++ b/clang/test/SemaCXX/attr-deprecated.cpp
@@ -56,14 +56,14 @@ void f(B* b, C *c) {
}
struct D {
- virtual void f() __attribute__((deprecated));
- virtual void f(int) __attribute__((deprecated));
- virtual void f(int, int) __attribute__((deprecated));
+ virtual void f() __attribute__((deprecated));// expected-note{{'f' has been explicitly marked deprecated here}}
+ virtual void f(int) __attribute__((deprecated));// expected-note{{'f' has been explicitly marked deprecated here}}
+ virtual void f(int, int) __attribute__((deprecated));// expected-note{{'f' has been explicitly marked deprecated here}}
};
-void D::f() { } // expected-note{{'f' has been explicitly marked deprecated here}}
-void D::f(int v) { } // expected-note{{'f' has been explicitly marked deprecated here}}
-void D::f(int v1, int v2) { } // expected-note{{'f' has been explicitly marked deprecated here}}
+void D::f() { }
+void D::f(int v) { }
+void D::f(int v1, int v2) { }
void f(D* d) {
d->f(); // expected-warning{{'f' is deprecated}}
diff --git a/clang/test/SemaCXX/template-multiple-attr-propagation.cpp b/clang/test/SemaCXX/template-multiple-attr-propagation.cpp
new file mode 100644
index 00000000000..8e7f4570bad
--- /dev/null
+++ b/clang/test/SemaCXX/template-multiple-attr-propagation.cpp
@@ -0,0 +1,29 @@
+// RUN: %clang_cc1 %s -Wthread-safety-analysis -verify -fexceptions
+// expected-no-diagnostics
+
+class Mutex {
+public:
+ void Lock() __attribute__((exclusive_lock_function()));
+ void Unlock() __attribute__((unlock_function()));
+};
+
+class A {
+public:
+ Mutex mu1, mu2;
+
+ void foo() __attribute__((exclusive_locks_required(mu1))) __attribute__((exclusive_locks_required(mu2))) {}
+
+ template <class T>
+ void bar() __attribute__((exclusive_locks_required(mu1))) __attribute__((exclusive_locks_required(mu2))) {
+ foo();
+ }
+};
+
+void f() {
+ A a;
+ a.mu1.Lock();
+ a.mu2.Lock();
+ a.bar<int>();
+ a.mu2.Unlock();
+ a.mu1.Unlock();
+}
OpenPOWER on IntegriCloud