Howard Hinnant
f0544c2086
Nico Rieck: this patch series fixes visibility issues on Windows as explained in < http://lists.cs.uiuc.edu/pipermail/cfe-dev/2013-August/031214.html >.
...
llvm-svn: 188192
2013-08-12 18:38:34 +00:00
Howard Hinnant
42a3046eef
Ok, 3 major changes for debug mode in one commit:
...
1. I had been detecting and trapping iterator == and \!= among iterators
in different containers as an error. But the trapping itself is actually
an error.
Consider:
#include <iostream>
#include <vector>
#include <algorithm>
template <class C>
void
display(const C& c)
{
std::cout << "{";
bool first = true;
for (const auto& x : c)
{
if (\!first)
std::cout << ", ";
first = false;
std::cout << x;
}
std::cout << "}\n";
}
int
main()
{
typedef std::vector<int> V;
V v1 = {1, 3, 5};
V v2 = {2, 4, 6};
display(v1);
display(v2);
V::iterator i = std::find(v1.begin(), v1.end(), 1);
V::iterator j = std::find(v2.begin(), v2.end(), 2);
if (*i == *j)
i = j; // perfectly legal
// ...
if (i \!= j) // the only way to check
v2.push_back(*i);
display(v1);
display(v2);
}
It is legal to assign an iterator from one container to another of the
same type. This is required to work. One might want to test whether or
not such an assignment had been made. The way one performs such a check
is using the iterator's ==, \!= operator. This is a logical and necessary
function and does not constitute an error.
2. I had a header circular dependence bug when _LIBCPP_DEBUG2 is defined.
This caused a problem in several of the libc++ tests.
Fixed.
3. There is a serious problem when _LIBCPP_DEBUG2=1 at the moment in that
std::basic_string is inoperable. std::basic_string uses __wrap_iterator
to implement its iterators. __wrap_iterator has been rigged up in debug
mode to support vector. But string hasn't been rigged up yet. This means
that one gets false positives when using std::string in debug mode. I've
upped std::string's priority in www/debug_mode.html.
llvm-svn: 187636
2013-08-02 00:26:35 +00:00
Howard Hinnant
0be8f64c44
Nico Rieck: Currently _MSC_VER and _WIN32 are used to guard code which is
...
MSVC-specific, MSVCRT-specific, or Windows-specific. Because Clang can
also define _MSC_VER, and MSVCRT is not necessarily the only C runtime,
these macros should not be used interchangeably.
This patch divides all Windows-related bits into the aforementioned
categories. Two new macros are introduced:
- _LIBCPP_MSVC: Defined when compiling with MSVC. Detected using
_MSC_VER, excluding Clang.
- _LIBCPP_MSVCRT: Defined when using the Microsoft CRT. This is the default
when _WIN32 is defined.
This leaves _WIN32 for code using the Windows API.
This also corrects the spelling of _LIBCP_HAS_IS_BASE_OF to _LIBCPP_HAS_IS_BASE_OF.
Nico, please prepare a patch for CREDITS.TXT, thanks.
llvm-svn: 187593
2013-08-01 18:17:34 +00:00
Howard Hinnant
3ec1f00b73
Implement full support for non-pointer pointers in custom allocators for vector.
...
llvm-svn: 185093
2013-06-27 19:35:32 +00:00
Howard Hinnant
ab65a6f560
After years of telling people: 'If you ever find any of my code that self-move-assigns, send me a bug report.' Somebody finally took me up on it. vector::erase(begin(), begin()) does a self-move-assign of every element in the vector, leaving all of those elements in an unspecified state. I checked the other containers for this same bug and did not find it. Added test case.
...
llvm-svn: 179760
2013-04-18 15:02:57 +00:00
Howard Hinnant
b3adefc34c
Second try at r178075. The llvm breakage has been fixed by r178240.
...
llvm-svn: 178253
2013-03-28 17:44:32 +00:00
Daniel Dunbar
15eaebea15
Revert r178075, "Tighten up the iterator requirements ...", it breaks LLVM
...
bootstrap with libc++.
llvm-svn: 178116
2013-03-27 04:10:25 +00:00
Howard Hinnant
5a13d8dcea
Tighten up the iterator requirements for the vector member templates. This is especially important for the constructors so that is_constructible<vector<T>, I, I> gives the right answer when T can not be constructed from *I. Test case included for this latter point.
...
llvm-svn: 178075
2013-03-26 21:40:54 +00:00
Howard Hinnant
cd4a9fd301
Another vector debug mode test, and a static test on Allocator::value_type. This partially addresses http://llvm.org/bugs/show_bug.cgi?id=15576 .
...
llvm-svn: 178064
2013-03-26 19:04:56 +00:00
Howard Hinnant
ea1bbbd135
Added debug tests for indexing, pop_back and both forms of erase. Added an improved error message for erasing a single element with end().
...
llvm-svn: 177929
2013-03-25 22:12:26 +00:00
Howard Hinnant
6e41256f68
No functionality change at this time. I've split _LIBCPP_VISIBLE up into two flags: _LIBCPP_TYPE_VIS and _LIBCPP_FUNC_VIS. This is in preparation for taking advantage of clang's new __type_visibility__ attribute.
...
llvm-svn: 176593
2013-03-06 23:30:19 +00:00
Howard Hinnant
aba500d633
Revert accidental check-in. These changes are probably good, but premature at this point.
...
llvm-svn: 174625
2013-02-07 15:31:44 +00:00
Howard Hinnant
804f9116e5
Michael van der Westhuizen: The attached patch add support for building against libc++abi and libcxxrt to CMake builds of libc++.
...
Usage (with the appropriate CC and CXX environment variables) is:
$ cmake -DLIBCXX_CXX_ABI=libcxxabi '-DLIBCXX_LIBCXXABI_INCLUDE_PATHS=/home/michael/libcxxabi/include' ../libcxx
and:
$ cmake -DLIBCXX_CXX_ABI=libcxxrt '-DLIBCXX_LIBCXXRT_INCLUDE_PATHS=/home/michael/libcxxrt/src' ../libcxx
llvm-svn: 174623
2013-02-07 15:27:39 +00:00
Howard Hinnant
8d9aec8802
Fix exception safety bug in vector::push_back
...
llvm-svn: 172250
2013-01-11 20:36:59 +00:00
Howard Hinnant
cd47cbc7a4
Provide a way to disable use of extern templates in libc++. This is intended for the clients of libc++, not the libc++ build. The dylib should always contain the extern templates. To disable the client needs to put -D'_LIBCPP_EXTERN_TEMPLATE(...)=' on the command line.
...
llvm-svn: 167486
2012-11-06 21:08:48 +00:00
Argyrios Kyrtzidis
88db3171dd
Don't neglect to "return *this".
...
llvm-svn: 165860
2012-10-13 02:03:45 +00:00
Howard Hinnant
7ee271360d
Consistently label __bit_array as a struct, not a class.
...
llvm-svn: 162108
2012-08-17 17:10:18 +00:00
Howard Hinnant
598f702b04
Change emplace for vector and deque to create the temporary (when necessary) before any changes to the container are made. Nikolay Ivchenkov deserves the credit for pushing this problem and the solution for it.
...
llvm-svn: 159918
2012-07-08 23:23:04 +00:00
Howard Hinnant
0ae9efeb1a
SFINAE __bit_iterator such that it will only get instantiated with a container that has the nested type __storage_type. This prevents accidental instantiation such as in http://llvm.org/bugs/show_bug.cgi?id=12755 . This fixes http://llvm.org/bugs/show_bug.cgi?id=12755 .
...
llvm-svn: 156308
2012-05-07 16:50:38 +00:00
Howard Hinnant
9ffe10106e
vector::emplace_back was mistakenly requiring move assignable. Fixed that and did a little drive-by optimization at the same time. This fixes http://llvm.org/bugs/show_bug.cgi?id=12085 .
...
llvm-svn: 151492
2012-02-26 15:30:12 +00:00
Howard Hinnant
9741d6c96e
Implement a few optimizations for vector push_back and insert. Fixes r10828365.
...
llvm-svn: 150542
2012-02-15 00:41:34 +00:00
Howard Hinnant
c206366fd7
Quash a whole bunch of warnings
...
llvm-svn: 145624
2011-12-01 20:21:04 +00:00
Howard Hinnant
c003db1fca
Further macro protection by replacing _[A-Z] with _[A-Z]p
...
llvm-svn: 145410
2011-11-29 18:15:50 +00:00
Howard Hinnant
ab4f438239
Add protection from min/max macros
...
llvm-svn: 145407
2011-11-29 16:45:27 +00:00
Howard Hinnant
e4383379ae
More windows port work by Ruben Van Boxem
...
llvm-svn: 142732
2011-10-22 20:59:45 +00:00
Howard Hinnant
073458b1ab
Windows support by Ruben Van Boxem.
...
llvm-svn: 142235
2011-10-17 20:05:10 +00:00
Howard Hinnant
c756bb3574
Chris Jefferson noted that vector iterator ownership can be transferred from source to target under move construction and move assignment. This commit makes that happen for debug mode.
...
llvm-svn: 140023
2011-09-19 16:34:29 +00:00
Howard Hinnant
0695db06d7
The vector test suite now passes for no-debug, debug-lite and debug-regular
...
llvm-svn: 139930
2011-09-16 18:41:29 +00:00
Howard Hinnant
cec9af9ead
Create multilevel debug mode
...
llvm-svn: 139913
2011-09-16 17:29:17 +00:00
Howard Hinnant
f554add54e
Initial checkin for debug mode (version 2)
...
llvm-svn: 139711
2011-09-14 18:33:51 +00:00
Howard Hinnant
8668139f36
Fix const correctness bug in __move_assign. Found and fixed by Ion Gaztañaga.
...
llvm-svn: 139032
2011-09-02 20:42:31 +00:00
Howard Hinnant
54976f2619
Fixed PR10574: http://llvm.org/bugs/show_bug.cgi?id=10574
...
llvm-svn: 137522
2011-08-12 21:56:02 +00:00
Alexis Hunt
8324378195
Explicitly invoke the size_type specialization of max and min. This
...
avoids bugs where, when the allocator's size_type was smaller than int,
the multiplication or division would cause integral promotions and, with
two different integer types as arguments, deduction of the template
arguments would fail.
llvm-svn: 136540
2011-07-29 23:31:58 +00:00
Howard Hinnant
7ae42ef0bf
Make vector<bool>::reference and const_reference public
...
llvm-svn: 134815
2011-07-09 15:50:42 +00:00
Howard Hinnant
a77445621b
http://llvm.org/bugs/show_bug.cgi?id=10248
...
llvm-svn: 134327
2011-07-02 20:33:23 +00:00
Howard Hinnant
ce48a1137d
_STD -> _VSTD to avoid macro clash on windows
...
llvm-svn: 134190
2011-06-30 21:18:19 +00:00
Howard Hinnant
3297ed7065
noexcept for <vector>. This also includes installing move_if_noexcept() into vector.
...
llvm-svn: 132577
2011-06-03 19:40:40 +00:00
Howard Hinnant
a0fe8c436e
Chris Jefferson noted many places where function calls needed to be qualified (thanks Chris).
...
llvm-svn: 125510
2011-02-14 19:12:38 +00:00
Howard Hinnant
36fd9f96cf
Reverting an old optimization that conflicts with the new allocator model, and causes some test casees to compile that shouldn't.
...
llvm-svn: 122830
2011-01-04 19:53:31 +00:00
Howard Hinnant
c950e77d1d
Effort to reduce the number of exported symbols
...
llvm-svn: 122057
2010-12-17 14:46:43 +00:00
Howard Hinnant
ca74048398
N3142. Many of these traits are just placeholders with medium quality emulation; waiting on compiler intrinsics to do it right.
...
llvm-svn: 119854
2010-11-19 22:17:28 +00:00
Howard Hinnant
412dbebe1b
license change
...
llvm-svn: 119395
2010-11-16 22:09:02 +00:00
Howard Hinnant
789847ddbb
visibility-decoration sweep completed.
...
llvm-svn: 114685
2010-09-23 18:58:28 +00:00
Howard Hinnant
f9cca3b7d0
I am experimenting with putting visibility-default attributes on all struct/classes in libc++. This checkin decorates only basic_string and vector as an experiment, and for review by those in this audience that might know more about visibilty than I do. If I get no negative feedback on this procedure I will begin to decorate the entire library in this way.
...
llvm-svn: 113590
2010-09-10 16:42:26 +00:00
Howard Hinnant
7609c9b665
Changed __config to react to all of clang's currently documented has_feature flags, and renamed _LIBCPP_MOVE to _LIBCPP_HAS_NO_RVALUE_REFERENCES to be more consistent with the rest of the libc++'s flags, and with clang's nomenclature.
...
llvm-svn: 113086
2010-09-04 23:28:19 +00:00
Howard Hinnant
b3371f6f49
Fixing whitespace problems
...
llvm-svn: 111750
2010-08-22 00:02:43 +00:00
Howard Hinnant
128ba7191d
patch by Jeffrey Yasskin for porting to Ubuntu Hardy. Everything was accepted except there were some bug fixes needed in <locale> for the __nolocale_* series. For the apple branch I ended up using templates instead of the var_args solution because it seemed both safer and more efficient.
...
llvm-svn: 104516
2010-05-24 17:49:41 +00:00
Howard Hinnant
5b08a8a432
Wiped out some non-ascii characters that snuck into the copyright.
...
llvm-svn: 103516
2010-05-11 21:36:01 +00:00
Howard Hinnant
3e519524c1
libcxx initial import
...
llvm-svn: 103490
2010-05-11 19:42:16 +00:00