Add Filesystem TS -- Complete

Add the completed std::experimental::filesystem implementation and tests.
The implementation supports C++11 or newer.

The TS is built as part of 'libc++experimental.a'. Users of the TS need to
manually link this library. Building and testing the TS can be disabled using
the CMake option '-DLIBCXX_ENABLE_FILESYSTEM=OFF'.

Currently 'libc++experimental.a' is not installed by default. To turn on the
installation of the library use '-DLIBCXX_INSTALL_EXPERIMENTAL_LIBRARY=ON'.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@273034 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Eric Fiselier
2016-06-17 19:46:40 +00:00
parent a8f47cc800
commit 6e9a694dce
147 changed files with 15301 additions and 11 deletions

View File

@@ -11,6 +11,9 @@
#define MIN_ALLOCATOR_H
#include <cstddef>
#include <cstdlib>
#include <cstddef>
#include <cassert>
#include "test_macros.h"
@@ -39,6 +42,57 @@ public:
friend bool operator!=(bare_allocator x, bare_allocator y) {return !(x == y);}
};
struct malloc_allocator_base {
static size_t alloc_count;
static size_t dealloc_count;
static bool disable_default_constructor;
static size_t outstanding_alloc() {
assert(alloc_count >= dealloc_count);
return (alloc_count - dealloc_count);
}
static void reset() {
assert(outstanding_alloc() == 0);
disable_default_constructor = false;
alloc_count = 0;
dealloc_count = 0;
}
};
size_t malloc_allocator_base::alloc_count = 0;
size_t malloc_allocator_base::dealloc_count = 0;
bool malloc_allocator_base::disable_default_constructor = false;
template <class T>
class malloc_allocator : public malloc_allocator_base
{
public:
typedef T value_type;
malloc_allocator() TEST_NOEXCEPT { assert(!disable_default_constructor); }
template <class U>
malloc_allocator(malloc_allocator<U>) TEST_NOEXCEPT {}
T* allocate(std::size_t n)
{
++alloc_count;
return static_cast<T*>(std::malloc(n*sizeof(T)));
}
void deallocate(T* p, std::size_t)
{
++dealloc_count;
std::free(static_cast<void*>(p));
}
friend bool operator==(malloc_allocator, malloc_allocator) {return true;}
friend bool operator!=(malloc_allocator x, malloc_allocator y) {return !(x == y);}
};
#if TEST_STD_VER >= 11