compiler-rt: Try to appease lint script.

A bot complains:

/b/sanitizer-x86_64-linux-autoconf/build/llvm/projects/compiler-rt/lib/sanitizer_common/tests/malloc_stress_transfer_test.cpp:2:  Streams are highly discouraged.  [readability/streams] [3]
/b/sanitizer-x86_64-linux-autoconf/build/llvm/projects/compiler-rt/lib/sanitizer_common/tests/sanitizer_libc_test.cpp:11:  Streams are highly discouraged.  [readability/streams] [3]
lib/CMakeFiles/SanitizerLintCheck.dir/build.make:57: recipe for target 'lib/CMakeFiles/SanitizerLintCheck' failed

I do not know why this apparently wasn't a problem when the files
had extension .cc.

llvm-svn: 367493
This commit is contained in:
Nico Weber 2019-07-31 23:34:07 +00:00
parent 89b80f1239
commit 45ff4868c4
2 changed files with 7 additions and 9 deletions

View File

@ -1,5 +1,4 @@
#include <thread>
#include <iostream>
const size_t kAllocSize = 16;
const size_t kInitialNumAllocs = 1 << 10;
@ -8,8 +7,6 @@ const size_t kNumIterations = 1 << 7;
const size_t kNumThreads = 16;
void Thread() {
// int sp;
// std::cerr << "Thread starting, sp = " << &sp << std::endl;
char *InitialAllocations[kInitialNumAllocs];
char *PeriodicaAllocations[kPeriodicNumAllocs];
for (auto &p : InitialAllocations) p = new char[kAllocSize];
@ -26,8 +23,6 @@ void Thread() {
}
int main() {
// Thread();
// return 0;
std::thread *Threads[kNumThreads];
for (auto &T : Threads) T = new std::thread(&Thread);
for (auto T : Threads) {

View File

@ -8,7 +8,8 @@
// Tests for sanitizer_libc.h.
//===----------------------------------------------------------------------===//
#include <algorithm>
#include <fstream>
#include <vector>
#include <stdio.h>
#include "sanitizer_common/sanitizer_common.h"
#include "sanitizer_common/sanitizer_file.h"
@ -173,9 +174,11 @@ class SanitizerCommonFileTest : public ::testing::TestWithParam<uptr> {
temp_file_name(file_name_, sizeof(file_name_),
"sanitizer_common.ReadFile.tmp.");
std::ofstream f(file_name_, std::ios::out | std::ios::binary);
if (!data_.empty())
f.write(data_.data(), data_.size());
if (FILE *f = fopen(file_name_, "wb")) {
if (!data_.empty())
fwrite(data_.data(), data_.size(), 1, f);
fclose(f);
}
}
void TearDown() override { Unlink(file_name_); }