tsan/asan: kill STL

First, placement new from standard library conflicts with our own.
Second, we are in trouble if user uses the same function (we either get instrumented code in runtime, or non-instrumented code in user program).

llvm-svn: 159738
This commit is contained in:
Dmitry Vyukov 2012-07-05 09:23:37 +00:00
parent ba235522e0
commit 5dc3f01676
1 changed files with 13 additions and 5 deletions

View File

@ -13,10 +13,7 @@
#include "sanitizer_common.h"
#include "sanitizer_libc.h"
// Should not add dependency on libstdc++,
// since most of the stuff here is inlinable.
#include <algorithm>
#include <stdlib.h>
namespace __sanitizer {
@ -60,8 +57,19 @@ uptr ReadFileToBuffer(const char *file_name, char **buff,
return read_len;
}
static int comp(const void *p1, const void *p2) {
uptr v1 = *(uptr*)p1;
uptr v2 = *(uptr*)p2;
if (v1 < v2)
return -1;
else if (v1 > v2)
return 1;
else
return 0;
}
void SortArray(uptr *array, uptr size) {
std::sort(array, array + size);
qsort(array, size, sizeof(array[0]), &comp);
}
} // namespace __sanitizer