summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeorge Karpenkov <ekarpenkov@apple.com>2018-05-16 22:46:47 +0000
committerGeorge Karpenkov <ekarpenkov@apple.com>2018-05-16 22:46:47 +0000
commit47bb3f70333827596f9c6e31ea754abfec53ed67 (patch)
treee947725b3280d878e11e61c0c8970a86076abbfc
parentacd1f4e73802c807369a37b60981237bc86e8fc2 (diff)
downloadbcm5719-llvm-47bb3f70333827596f9c6e31ea754abfec53ed67.tar.gz
bcm5719-llvm-47bb3f70333827596f9c6e31ea754abfec53ed67.zip
[analyzer] Change the warning message for GCD antipattern checker
llvm-svn: 332544
-rw-r--r--clang/lib/StaticAnalyzer/Checkers/GCDAntipatternChecker.cpp4
-rw-r--r--clang/test/Analysis/gcdantipatternchecker_test.m42
2 files changed, 23 insertions, 23 deletions
diff --git a/clang/lib/StaticAnalyzer/Checkers/GCDAntipatternChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/GCDAntipatternChecker.cpp
index 4ee5159b43d..1b7ea53aeac 100644
--- a/clang/lib/StaticAnalyzer/Checkers/GCDAntipatternChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/GCDAntipatternChecker.cpp
@@ -187,8 +187,8 @@ static void emitDiagnostics(const BoundNodes &Nodes,
std::string Diagnostics;
llvm::raw_string_ostream OS(Diagnostics);
- OS << "Waiting on a " << Type << " with Grand Central Dispatch creates "
- << "useless threads and is subject to priority inversion; consider "
+ OS << "Waiting on a callback using a " << Type << " creates useless threads "
+ << "and is subject to priority inversion; consider "
<< "using a synchronous API or changing the caller to be asynchronous";
BR.EmitBasicReport(
diff --git a/clang/test/Analysis/gcdantipatternchecker_test.m b/clang/test/Analysis/gcdantipatternchecker_test.m
index d79a6baec3b..adc7a52bf53 100644
--- a/clang/test/Analysis/gcdantipatternchecker_test.m
+++ b/clang/test/Analysis/gcdantipatternchecker_test.m
@@ -34,7 +34,7 @@ void use_semaphor_antipattern() {
func(^{
dispatch_semaphore_signal(sema);
});
- dispatch_semaphore_wait(sema, 100); // expected-warning{{Waiting on a semaphore with Grand Central Dispatch creates useless threads and is subject to priority inversion}}
+ dispatch_semaphore_wait(sema, 100); // expected-warning{{Waiting on a callback using a semaphore}}
}
// It's OK to use pattern in tests.
@@ -54,14 +54,14 @@ void use_semaphor_antipattern_multiple_times() {
func(^{
dispatch_semaphore_signal(sema1);
});
- dispatch_semaphore_wait(sema1, 100); // expected-warning{{Waiting on a semaphore with Grand Central Dispatch creates useless threads and is subject to priority inversion}}
+ dispatch_semaphore_wait(sema1, 100); // expected-warning{{Waiting on a callback using a semaphore}}
dispatch_semaphore_t sema2 = dispatch_semaphore_create(0);
func(^{
dispatch_semaphore_signal(sema2);
});
- dispatch_semaphore_wait(sema2, 100); // expected-warning{{Waiting on a semaphore with Grand Central Dispatch creates useless threads and is subject to priority inversion}}
+ dispatch_semaphore_wait(sema2, 100); // expected-warning{{Waiting on a callback using a semaphore}}
}
void use_semaphor_antipattern_multiple_wait() {
@@ -71,8 +71,8 @@ void use_semaphor_antipattern_multiple_wait() {
dispatch_semaphore_signal(sema1);
});
// FIXME: multiple waits on same semaphor should not raise a warning.
- dispatch_semaphore_wait(sema1, 100); // expected-warning{{Waiting on a semaphore with Grand Central Dispatch creates useless threads and is subject to priority inversion}}
- dispatch_semaphore_wait(sema1, 100); // expected-warning{{Waiting on a semaphore with Grand Central Dispatch creates useless threads and is subject to priority inversion}}
+ dispatch_semaphore_wait(sema1, 100); // expected-warning{{Waiting on a callback using a semaphore}}
+ dispatch_semaphore_wait(sema1, 100); // expected-warning{{Waiting on a callback using a semaphore}}
}
void warn_incorrect_order() {
@@ -80,7 +80,7 @@ void warn_incorrect_order() {
// if out of order.
dispatch_semaphore_t sema = dispatch_semaphore_create(0);
- dispatch_semaphore_wait(sema, 100); // expected-warning{{Waiting on a semaphore with Grand Central Dispatch creates useless threads and is subject to priority inversion}}
+ dispatch_semaphore_wait(sema, 100); // expected-warning{{Waiting on a callback}}
func(^{
dispatch_semaphore_signal(sema);
});
@@ -92,7 +92,7 @@ void warn_w_typedef() {
func_w_typedef(^{
dispatch_semaphore_signal(sema);
});
- dispatch_semaphore_wait(sema, 100); // expected-warning{{Waiting on a semaphore with Grand Central Dispatch creates useless threads and is subject to priority inversion}}
+ dispatch_semaphore_wait(sema, 100); // expected-warning{{Waiting on a callback using a semaphore}}
}
void warn_nested_ast() {
@@ -107,7 +107,7 @@ void warn_nested_ast() {
dispatch_semaphore_signal(sema);
});
}
- dispatch_semaphore_wait(sema, 100); // expected-warning{{Waiting on a semaphore with Grand Central Dispatch creates useless threads and is subject to priority inversion}}
+ dispatch_semaphore_wait(sema, 100); // expected-warning{{Waiting on a callback using a semaphore}}
}
void use_semaphore_assignment() {
@@ -117,7 +117,7 @@ void use_semaphore_assignment() {
func(^{
dispatch_semaphore_signal(sema);
});
- dispatch_semaphore_wait(sema, 100); // expected-warning{{Waiting on a semaphore with Grand Central Dispatch creates useless threads and is subject to priority inversion}}
+ dispatch_semaphore_wait(sema, 100); // expected-warning{{Waiting on a callback using a semaphore}}
}
void use_semaphore_assignment_init() {
@@ -127,7 +127,7 @@ void use_semaphore_assignment_init() {
func(^{
dispatch_semaphore_signal(sema);
});
- dispatch_semaphore_wait(sema, 100); // expected-warning{{Waiting on a semaphore with Grand Central Dispatch creates useless threads and is subject to priority inversion}}
+ dispatch_semaphore_wait(sema, 100); // expected-warning{{Waiting on a callback using a semaphore}}
}
void differentsemaphoreok() {
@@ -179,7 +179,7 @@ void warn_with_cast() {
func(^{
dispatch_semaphore_signal((int)sema);
});
- dispatch_semaphore_wait((int)sema, 100); // expected-warning{{Waiting on a semaphore with Grand Central Dispatch creates useless threads and is subject to priority inversion}}
+ dispatch_semaphore_wait((int)sema, 100); // expected-warning{{Waiting on a callback using a semaphore}}
}
@interface MyInterface1 : NSObject
@@ -200,7 +200,7 @@ void warn_with_cast() {
func(^{
dispatch_semaphore_signal(sema);
});
- dispatch_semaphore_wait(sema, 100); // expected-warning{{Waiting on a semaphore with Grand Central Dispatch creates useless threads and is subject to priority inversion}}
+ dispatch_semaphore_wait(sema, 100); // expected-warning{{Waiting on a callback}}
}
-(void) pass_block_as_second_param_warn {
@@ -209,7 +209,7 @@ void warn_with_cast() {
[self flag:1 acceptBlock:^{
dispatch_semaphore_signal(sema);
}];
- dispatch_semaphore_wait(sema, 100); // expected-warning{{Waiting on a semaphore with Grand Central Dispatch creates useless threads and is subject to priority inversion}}
+ dispatch_semaphore_wait(sema, 100); // expected-warning{{Waiting on a callback}}
}
-(void)testNoWarn {
@@ -235,7 +235,7 @@ void warn_with_cast() {
[self acceptBlock:^{
dispatch_semaphore_signal(sema);
}];
- dispatch_semaphore_wait(sema, 100); // expected-warning{{Waiting on a semaphore with Grand Central Dispatch creates useless threads and is subject to priority inversion}}
+ dispatch_semaphore_wait(sema, 100); // expected-warning{{Waiting on a callback}}
}
-(void)use_dispatch_group {
@@ -244,7 +244,7 @@ void warn_with_cast() {
[self acceptBlock:^{
dispatch_group_leave(group);
}];
- dispatch_group_wait(group, 100); // expected-warning{{Waiting on a group with Grand Central Dispatch}}
+ dispatch_group_wait(group, 100); // expected-warning{{Waiting on a callback using a group}}
}
@@ -254,14 +254,14 @@ void use_objc_and_c_callback(MyInterface1 *t) {
func(^{
dispatch_semaphore_signal(sema);
});
- dispatch_semaphore_wait(sema, 100); // expected-warning{{Waiting on a semaphore with Grand Central Dispatch creates useless threads and is subject to priority inversion}}
+ dispatch_semaphore_wait(sema, 100); // expected-warning{{Waiting on a callback using a semaphore}}
dispatch_semaphore_t sema1 = dispatch_semaphore_create(0);
[t acceptBlock:^{
dispatch_semaphore_signal(sema1);
}];
- dispatch_semaphore_wait(sema1, 100); // expected-warning{{Waiting on a semaphore with Grand Central Dispatch creates useless threads and is subject to priority inversion}}
+ dispatch_semaphore_wait(sema1, 100); // expected-warning{{Waiting on a callback}}
}
@end
@@ -305,7 +305,7 @@ void dispatch_group_wait_func(MyInterface1 *M) {
func(^{
dispatch_group_leave(group);
});
- dispatch_group_wait(group, 100); // expected-warning{{Waiting on a group with Grand Central Dispatch}}
+ dispatch_group_wait(group, 100); // expected-warning{{Waiting on a callback using a group}}
}
@@ -315,7 +315,7 @@ void dispatch_group_wait_cfunc(MyInterface1 *M) {
[M acceptBlock:^{
dispatch_group_leave(group);
}];
- dispatch_group_wait(group, 100); // expected-warning{{Waiting on a group with Grand Central Dispatch}}
+ dispatch_group_wait(group, 100); // expected-warning{{Waiting on a callback using a group}}
}
void dispatch_group_and_semaphore_use(MyInterface1 *M) {
@@ -324,12 +324,12 @@ void dispatch_group_and_semaphore_use(MyInterface1 *M) {
[M acceptBlock:^{
dispatch_group_leave(group);
}];
- dispatch_group_wait(group, 100); // expected-warning{{Waiting on a group with Grand Central Dispatch}}
+ dispatch_group_wait(group, 100); // expected-warning{{Waiting on a callback using a group}}
dispatch_semaphore_t sema1 = dispatch_semaphore_create(0);
[M acceptBlock:^{
dispatch_semaphore_signal(sema1);
}];
- dispatch_semaphore_wait(sema1, 100); // expected-warning{{Waiting on a semaphore with Grand Central Dispatch creates useless threads and is subject to priority inversion}}
+ dispatch_semaphore_wait(sema1, 100); // expected-warning{{Waiting on a callback using a semaphore}}
}
OpenPOWER on IntegriCloud