Revert "Revert "Update aosp/master libcxx rebase to r263688""

This reverts commit 1d4a1edbc7.

Change-Id: I2909937fe582f2c5552bc86e7f4d2d5cff0de0aa
This commit is contained in:
Dan Austin
2016-06-08 22:25:43 +00:00
parent 1d4a1edbc7
commit ee226c05af
1396 changed files with 38992 additions and 11535 deletions

View File

@@ -11,14 +11,11 @@
// iterator insert(const_iterator p, charT c);
#if _LIBCPP_DEBUG >= 1
#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#endif
#include <string>
#include <stdexcept>
#include <cassert>
#include "test_macros.h"
#include "min_allocator.h"
template <class S>
@@ -28,7 +25,7 @@ test(S& s, typename S::const_iterator p, typename S::value_type c, S expected)
bool sufficient_cap = s.size() < s.capacity();
typename S::difference_type pos = p - s.begin();
typename S::iterator i = s.insert(p, c);
assert(s.__invariants());
LIBCPP_ASSERT(s.__invariants());
assert(s == expected);
assert(i - s.begin() == pos);
assert(*i == c);
@@ -56,7 +53,7 @@ int main()
test(s, s.begin()+5, 'B', S("a567AB1432dcb"));
test(s, s.begin()+6, 'C', S("a567ABC1432dcb"));
}
#if __cplusplus >= 201103L
#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
S s;
@@ -76,13 +73,4 @@ int main()
test(s, s.begin()+6, 'C', S("a567ABC1432dcb"));
}
#endif
#if _LIBCPP_DEBUG >= 1
{
typedef std::string S;
S s;
S s2;
s.insert(s2.begin(), '1');
assert(false);
}
#endif
}

View File

@@ -29,7 +29,7 @@ int main()
assert(i - s.begin() == 3);
assert(s == "123abc456");
}
#if __cplusplus >= 201103L
#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
S s("123456");

View File

@@ -19,7 +19,7 @@
#include <string>
#include <cassert>
#include "../../input_iterator.h"
#include "test_iterators.h"
#include "min_allocator.h"
template <class S, class It>
@@ -28,11 +28,28 @@ test(S s, typename S::difference_type pos, It first, It last, S expected)
{
typename S::const_iterator p = s.cbegin() + pos;
typename S::iterator i = s.insert(p, first, last);
assert(s.__invariants());
LIBCPP_ASSERT(s.__invariants());
assert(i - s.begin() == pos);
assert(s == expected);
}
#ifndef TEST_HAS_NO_EXCEPTIONS
template <class S, class It>
void
test_exceptions(S s, typename S::difference_type pos, It first, It last)
{
typename S::const_iterator p = s.cbegin() + pos;
S aCopy = s;
try {
s.insert(p, first, last);
assert(false);
}
catch (...) {}
LIBCPP_ASSERT(s.__invariants());
assert(s == aCopy);
}
#endif
int main()
{
{
@@ -80,7 +97,7 @@ int main()
test(S("12345678901234567890"), 20, input_iterator<const char*>(s), input_iterator<const char*>(s+52),
S("12345678901234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"));
}
#if __cplusplus >= 201103L
#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
const char* s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
@@ -127,6 +144,21 @@ int main()
S("12345678901234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"));
}
#endif
#ifndef TEST_HAS_NO_EXCEPTIONS
{ // test iterator operations that throw
typedef std::string S;
typedef ThrowingIterator<char> TIter;
typedef input_iterator<TIter> IIter;
const char* s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
test_exceptions(S(), 0, IIter(TIter(s, s+10, 4, TIter::TAIncrement)), IIter());
test_exceptions(S(), 0, IIter(TIter(s, s+10, 5, TIter::TADereference)), IIter());
test_exceptions(S(), 0, IIter(TIter(s, s+10, 6, TIter::TAComparison)), IIter());
test_exceptions(S(), 0, TIter(s, s+10, 4, TIter::TAIncrement), TIter());
test_exceptions(S(), 0, TIter(s, s+10, 5, TIter::TADereference), TIter());
test_exceptions(S(), 0, TIter(s, s+10, 6, TIter::TAComparison), TIter());
}
#endif
#if _LIBCPP_DEBUG >= 1
{
std::string v;

View File

@@ -11,13 +11,10 @@
// iterator insert(const_iterator p, size_type n, charT c);
#if _LIBCPP_DEBUG >= 1
#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::exit(0))
#endif
#include <string>
#include <cassert>
#include "test_macros.h"
#include "min_allocator.h"
template <class S>
@@ -27,7 +24,7 @@ test(S s, typename S::difference_type pos, typename S::size_type n,
{
typename S::const_iterator p = s.cbegin() + pos;
typename S::iterator i = s.insert(p, n, c);
assert(s.__invariants());
LIBCPP_ASSERT(s.__invariants());
assert(i - s.begin() == pos);
assert(s == expected);
}
@@ -101,7 +98,7 @@ int main()
test(S("abcdefghijklmnopqrst"), 20, 10, '1', S("abcdefghijklmnopqrst1111111111"));
test(S("abcdefghijklmnopqrst"), 20, 20, '1', S("abcdefghijklmnopqrst11111111111111111111"));
}
#if __cplusplus >= 201103L
#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test(S(""), 0, 0, '1', S(""));
@@ -170,12 +167,4 @@ int main()
test(S("abcdefghijklmnopqrst"), 20, 20, '1', S("abcdefghijklmnopqrst11111111111111111111"));
}
#endif
#if _LIBCPP_DEBUG >= 1
{
std::string s;
std::string s2;
s.insert(s2.begin(), 1, 'a');
assert(false);
}
#endif
}

View File

@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
// XFAIL: libcpp-no-exceptions
// <string>
// basic_string<charT,traits,Allocator>&
@@ -16,6 +17,7 @@
#include <stdexcept>
#include <cassert>
#include "test_macros.h"
#include "min_allocator.h"
template <class S>
@@ -27,7 +29,7 @@ test(S s, typename S::size_type pos, const typename S::value_type* str, S expect
try
{
s.insert(pos, str);
assert(s.__invariants());
LIBCPP_ASSERT(s.__invariants());
assert(pos <= old_size);
assert(s == expected);
}
@@ -123,7 +125,7 @@ int main()
test(S("abcdefghijklmnopqrst"), 21, "1234567890", S("can't happen"));
test(S("abcdefghijklmnopqrst"), 21, "12345678901234567890", S("can't happen"));
}
#if __cplusplus >= 201103L
#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test(S(""), 0, "", S(""));

View File

@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
// XFAIL: libcpp-no-exceptions
// <string>
// basic_string<charT,traits,Allocator>&
@@ -16,6 +17,7 @@
#include <stdexcept>
#include <cassert>
#include "test_macros.h"
#include "min_allocator.h"
template <class S>
@@ -28,7 +30,7 @@ test(S s, typename S::size_type pos, const typename S::value_type* str,
try
{
s.insert(pos, str, n);
assert(s.__invariants());
LIBCPP_ASSERT(s.__invariants());
assert(pos <= old_size);
assert(s == expected);
}
@@ -364,7 +366,7 @@ int main()
test(S("abcdefghijklmnopqrst"), 21, "12345678901234567890", 19, S("can't happen"));
test(S("abcdefghijklmnopqrst"), 21, "12345678901234567890", 20, S("can't happen"));
}
#if __cplusplus >= 201103L
#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test(S(""), 0, "", 0, S(""));

View File

@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
// XFAIL: libcpp-no-exceptions
// <string>
// basic_string<charT,traits,Allocator>&
@@ -16,6 +17,7 @@
#include <stdexcept>
#include <cassert>
#include "test_macros.h"
#include "min_allocator.h"
template <class S>
@@ -28,7 +30,7 @@ test(S s, typename S::size_type pos, typename S::size_type n,
try
{
s.insert(pos, n, str);
assert(s.__invariants());
LIBCPP_ASSERT(s.__invariants());
assert(pos <= old_size);
assert(s == expected);
}
@@ -124,7 +126,7 @@ int main()
test(S("abcdefghijklmnopqrst"), 21, 10, '1', S("can't happen"));
test(S("abcdefghijklmnopqrst"), 21, 20, '1', S("can't happen"));
}
#if __cplusplus >= 201103L
#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test(S(""), 0, 0, '1', S(""));

View File

@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
// XFAIL: libcpp-no-exceptions
// <string>
// basic_string<charT,traits,Allocator>&
@@ -16,6 +17,7 @@
#include <stdexcept>
#include <cassert>
#include "test_macros.h"
#include "min_allocator.h"
template <class S>
@@ -27,7 +29,7 @@ test(S s, typename S::size_type pos, S str, S expected)
try
{
s.insert(pos, str);
assert(s.__invariants());
LIBCPP_ASSERT(s.__invariants());
assert(pos <= old_size);
assert(s == expected);
}
@@ -123,7 +125,7 @@ int main()
test(S("abcdefghijklmnopqrst"), 21, S("1234567890"), S("can't happen"));
test(S("abcdefghijklmnopqrst"), 21, S("12345678901234567890"), S("can't happen"));
}
#if __cplusplus >= 201103L
#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test(S(""), 0, S(""), S(""));

View File

@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
// XFAIL: libcpp-no-exceptions
// <string>
// basic_string<charT,traits,Allocator>&
@@ -18,6 +19,7 @@
#include <stdexcept>
#include <cassert>
#include "test_macros.h"
#include "min_allocator.h"
template <class S>
@@ -30,7 +32,7 @@ test(S s, typename S::size_type pos1, S str, typename S::size_type pos2,
try
{
s.insert(pos1, str, pos2, n);
assert(s.__invariants());
LIBCPP_ASSERT(s.__invariants());
assert(pos1 <= old_size && pos2 <= str.size());
assert(s == expected);
}
@@ -50,7 +52,7 @@ test_npos(S s, typename S::size_type pos1, S str, typename S::size_type pos2, S
try
{
s.insert(pos1, str, pos2);
assert(s.__invariants());
LIBCPP_ASSERT(s.__invariants());
assert(pos1 <= old_size && pos2 <= str.size());
assert(s == expected);
}
@@ -1745,7 +1747,7 @@ int main()
test29<S>();
test30<S>();
}
#if __cplusplus >= 201103L
#if TEST_STD_VER >= 11
{
typedef std::basic_string<char, std::char_traits<char>, min_allocator<char>> S;
test0<S>();