Skip to content
Snippets Groups Projects
Commit 045c4ee4 authored by David Blaikie's avatar David Blaikie
Browse files

Correct the function name shown in diagnostics in warn-thread-safety-analysis.c

Patch by Alex Wang.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@199762 91177308-0d34-0410-b5e6-96231b3b80d8
parent aeff128a
No related branches found
No related tags found
No related merge requests found
// RUN: %clang_cc1 -fsyntax-only -verify -Wthread-safety -Wthread-safety-beta -fcxx-exceptions %s
// FIXME: This test never worked due to a broken RUN line.
// XFAIL: *
// RUN: %clang_cc1 -fsyntax-only -verify -Wthread-safety -Wthread-safety-beta %s
#define LOCKABLE __attribute__ ((lockable))
#define SCOPED_LOCKABLE __attribute__ ((scoped_lockable))
......@@ -33,15 +31,10 @@ struct Foo {
struct Mutex *mu_;
};
// Define mutex lock/unlock functions.
void mutex_exclusive_lock(struct Mutex *mu) EXCLUSIVE_LOCK_FUNCTION(mu) {
}
void mutex_shared_lock(struct Mutex *mu) SHARED_LOCK_FUNCTION(mu) {
}
void mutex_unlock(struct Mutex *mu) UNLOCK_FUNCTION(mu) {
}
// Declare mutex lock/unlock functions.
void mutex_exclusive_lock(struct Mutex *mu) EXCLUSIVE_LOCK_FUNCTION(mu);
void mutex_shared_lock(struct Mutex *mu) SHARED_LOCK_FUNCTION(mu);
void mutex_unlock(struct Mutex *mu) UNLOCK_FUNCTION(mu);
// Define global variables.
struct Mutex mu1;
......@@ -105,8 +98,8 @@ int main() {
Foo_func3(5);
set_value(&a_, 0); // expected-warning{{calling function 'setA' requires exclusive lock on 'foo_.mu_'}}
get_value(b_); // expected-warning{{calling function 'getB' requires shared lock on 'foo_.mu_'}}
set_value(&a_, 0); // expected-warning{{calling function 'set_value' requires exclusive lock on 'foo_.mu_'}}
get_value(b_); // expected-warning{{calling function 'get_value' requires shared lock on 'foo_.mu_'}}
mutex_exclusive_lock(foo_.mu_);
set_value(&a_, 1);
mutex_unlock(foo_.mu_);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment