[compiler-rt] r358205 - [TSan][libdispatch] Replace usage of NSMutableData with stack array
Julian Lettner via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 11 11:14:19 PDT 2019
Author: yln
Date: Thu Apr 11 11:14:19 2019
New Revision: 358205
URL: http://llvm.org/viewvc/llvm-project?rev=358205&view=rev
Log:
[TSan][libdispatch] Replace usage of NSMutableData with stack array
Reviewed By: kubamracek
Differential Revision: https://reviews.llvm.org/D60477
Modified:
compiler-rt/trunk/test/tsan/Darwin/gcd-fd.mm
compiler-rt/trunk/test/tsan/Darwin/gcd-io-barrier-race.mm
compiler-rt/trunk/test/tsan/Darwin/gcd-io-barrier.mm
compiler-rt/trunk/test/tsan/Darwin/gcd-io-race.mm
compiler-rt/trunk/test/tsan/Darwin/gcd-io.mm
Modified: compiler-rt/trunk/test/tsan/Darwin/gcd-fd.mm
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/tsan/Darwin/gcd-fd.mm?rev=358205&r1=358204&r2=358205&view=diff
==============================================================================
--- compiler-rt/trunk/test/tsan/Darwin/gcd-fd.mm (original)
+++ compiler-rt/trunk/test/tsan/Darwin/gcd-fd.mm Thu Apr 11 11:14:19 2019
@@ -17,8 +17,8 @@ int main(int argc, const char *argv[]) {
0666, queue, ^(int error) { });
dispatch_io_set_high_water(channel, 1);
- NSData *ns_data = [NSMutableData dataWithLength:1000];
- dispatch_data_t data = dispatch_data_create(ns_data.bytes, ns_data.length, NULL, DISPATCH_DATA_DESTRUCTOR_DEFAULT);
+ char buf[1000];
+ dispatch_data_t data = dispatch_data_create(buf, sizeof(buf), NULL, DISPATCH_DATA_DESTRUCTOR_DEFAULT);
my_global++;
dispatch_io_write(channel, 0, data, queue, ^(bool done, dispatch_data_t remainingData, int error) {
Modified: compiler-rt/trunk/test/tsan/Darwin/gcd-io-barrier-race.mm
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/tsan/Darwin/gcd-io-barrier-race.mm?rev=358205&r1=358204&r2=358205&view=diff
==============================================================================
--- compiler-rt/trunk/test/tsan/Darwin/gcd-io-barrier-race.mm (original)
+++ compiler-rt/trunk/test/tsan/Darwin/gcd-io-barrier-race.mm Thu Apr 11 11:14:19 2019
@@ -21,8 +21,8 @@ int main(int argc, const char *argv[]) {
sem = dispatch_semaphore_create(0);
NSString *ns_path = [NSTemporaryDirectory() stringByAppendingPathComponent:[NSString stringWithFormat:@"temp-gcd-io.%d", getpid()]];
path = ns_path.fileSystemRepresentation;
- NSData *ns_data = [NSMutableData dataWithLength:1000];
- data = dispatch_data_create(ns_data.bytes, ns_data.length, NULL, DISPATCH_DATA_DESTRUCTOR_DEFAULT);
+ char buf[1000];
+ data = dispatch_data_create(buf, sizeof(buf), NULL, DISPATCH_DATA_DESTRUCTOR_DEFAULT);
dispatch_io_t channel = dispatch_io_create_with_path(DISPATCH_IO_STREAM, path, O_CREAT | O_WRONLY, 0666, queue, ^(int error) { });
if (! channel) abort();
Modified: compiler-rt/trunk/test/tsan/Darwin/gcd-io-barrier.mm
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/tsan/Darwin/gcd-io-barrier.mm?rev=358205&r1=358204&r2=358205&view=diff
==============================================================================
--- compiler-rt/trunk/test/tsan/Darwin/gcd-io-barrier.mm (original)
+++ compiler-rt/trunk/test/tsan/Darwin/gcd-io-barrier.mm Thu Apr 11 11:14:19 2019
@@ -17,8 +17,8 @@ int main(int argc, const char *argv[]) {
sem = dispatch_semaphore_create(0);
NSString *ns_path = [NSTemporaryDirectory() stringByAppendingPathComponent:[NSString stringWithFormat:@"temp-gcd-io.%d", getpid()]];
path = ns_path.fileSystemRepresentation;
- NSData *ns_data = [NSMutableData dataWithLength:1000];
- data = dispatch_data_create(ns_data.bytes, ns_data.length, NULL, DISPATCH_DATA_DESTRUCTOR_DEFAULT);
+ char buf[1000];
+ data = dispatch_data_create(buf, sizeof(buf), NULL, DISPATCH_DATA_DESTRUCTOR_DEFAULT);
dispatch_io_t channel = dispatch_io_create_with_path(DISPATCH_IO_STREAM, path, O_CREAT | O_WRONLY, 0666, queue, ^(int error) { });
if (! channel) abort();
Modified: compiler-rt/trunk/test/tsan/Darwin/gcd-io-race.mm
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/tsan/Darwin/gcd-io-race.mm?rev=358205&r1=358204&r2=358205&view=diff
==============================================================================
--- compiler-rt/trunk/test/tsan/Darwin/gcd-io-race.mm (original)
+++ compiler-rt/trunk/test/tsan/Darwin/gcd-io-race.mm Thu Apr 11 11:14:19 2019
@@ -23,8 +23,8 @@ int main(int argc, const char *argv[]) {
sem = dispatch_semaphore_create(0);
NSString *ns_path = [NSTemporaryDirectory() stringByAppendingPathComponent:[NSString stringWithFormat:@"temp-gcd-io.%d", getpid()]];
path = ns_path.fileSystemRepresentation;
- NSData *ns_data = [NSMutableData dataWithLength:1000];
- data = dispatch_data_create(ns_data.bytes, ns_data.length, NULL, DISPATCH_DATA_DESTRUCTOR_DEFAULT);
+ char buf[1000];
+ data = dispatch_data_create(buf, sizeof(buf), NULL, DISPATCH_DATA_DESTRUCTOR_DEFAULT);
dispatch_io_t channel = dispatch_io_create_with_path(DISPATCH_IO_STREAM, path, O_CREAT | O_WRONLY, 0666, queue, ^(int error) { });
if (! channel) abort();
Modified: compiler-rt/trunk/test/tsan/Darwin/gcd-io.mm
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/tsan/Darwin/gcd-io.mm?rev=358205&r1=358204&r2=358205&view=diff
==============================================================================
--- compiler-rt/trunk/test/tsan/Darwin/gcd-io.mm (original)
+++ compiler-rt/trunk/test/tsan/Darwin/gcd-io.mm Thu Apr 11 11:14:19 2019
@@ -100,8 +100,8 @@ int main(int argc, const char *argv[]) {
sem = dispatch_semaphore_create(0);
NSString *ns_path = [NSTemporaryDirectory() stringByAppendingPathComponent:[NSString stringWithFormat:@"temp-gcd-io.%d", getpid()]];
path = ns_path.fileSystemRepresentation;
- NSData *ns_data = [NSMutableData dataWithLength:1000];
- data = dispatch_data_create(ns_data.bytes, ns_data.length, NULL, DISPATCH_DATA_DESTRUCTOR_DEFAULT);
+ char buf[1000];
+ data = dispatch_data_create(buf, sizeof(buf), NULL, DISPATCH_DATA_DESTRUCTOR_DEFAULT);
test_dispatch_io_write();
test_dispatch_write();
More information about the llvm-commits
mailing list