mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-01-15 12:39:19 +00:00
a32910da1a
Correct class-template deprecation behavior Based on the comment in the test, and my reading of the standard, a deprecated warning should be issued in the following case: template<typename T> [[deprecated]] class Foo{}; Foo<int> f; This was not the case, because the ClassTemplateSpecializationDecl creation did not also copy the deprecated attribute. Note: I did NOT audit the complete set of attributes to see WHICH ones should be copied, so instead I simply copy ONLY the deprecated attribute. Previous DiffRev: https://reviews.llvm.org/D27486, was reverted. This patch fixes the issues brought up here by the reverter: https://reviews.llvm.org/rL298410 Differential Revision: https://reviews.llvm.org/D31245 llvm-svn: 298634
30 lines
633 B
C++
30 lines
633 B
C++
// 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();
|
|
}
|