Eric Fiselier
910285b238
[libcxx] Fix use of operator comma where the types can be user defined
...
Summary:
An evil user might overload operator comma. Use a void cast to make sure any user overload is not selected.
Modify all the test iterators to define operator comma.
Reviewers: danalbert, mclow.lists
Reviewed By: mclow.lists
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D5929
llvm-svn: 220706
2014-10-27 19:28:20 +00:00
Dan Albert
353f358d24
Fix char_traits functions for GCC compatibility.
...
GCC 4.9 fails to inline these functions at -O1 because they are used
indirectly. Declare them as inline instead of always_inline. Discussion
in GCC bugreport: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63220
llvm-svn: 217961
2014-09-17 16:34:29 +00:00
Eric Fiselier
c1bd9197eb
NFC. Move definition of _LIBCPP_ASSERT into __debug header and remove external include guards.
...
Things done in this patch:
1. Make __debug include __config since it uses macros from it.
2. The current method of defining _LIBCPP_ASSERT is prone to redefinitions. Move
the null _LIBCPP_ASSERT definition into the __debug header to prevent this.
3. Remove external <__debug> include gaurds. <__debug> guards almost all of its
contents internally. There is no reason to be doing it externally.
This patch should not change any functionality.
llvm-svn: 215332
2014-08-10 23:53:08 +00:00
Marshall Clow
3dd8846840
Fix bug #20335 - memory leak when move-constructing a string with unequal allocator. Thanks to Thomas Koeppe for the report
...
llvm-svn: 213269
2014-07-17 15:32:20 +00:00
Marshall Clow
9b0af34d96
Make the helper routines in string really be constexpr. This required a bit of refacoring in algorithm as well. Give them better names while we're at it. All of these are internal rotines; no visible functionality change.
...
llvm-svn: 210561
2014-06-10 18:51:55 +00:00
Marshall Clow
5f0701f270
Preparation for <string_view>. More helper functions that can be shared between <string> and <string_view>. No functionality change
...
llvm-svn: 210002
2014-06-02 02:22:49 +00:00
Alp Toker
f03763a44b
Fix typos
...
llvm-svn: 208869
2014-05-15 11:27:39 +00:00
Marshall Clow
53b88dad6f
Implement LWG #2268 : Setting a default argument in the declaration of a member function assign of std::basic_string.
...
llvm-svn: 202876
2014-03-04 19:17:19 +00:00
Marshall Clow
53d8b20078
Remove tabs that crept in during an earlier refactoring. No functionality change
...
llvm-svn: 201472
2014-02-16 01:57:26 +00:00
Marshall Clow
8283ba3704
Refactor some of the operations in <string> so that they can be reused; no functionality change
...
llvm-svn: 196788
2013-12-09 16:00:28 +00:00
Marshall Clow
e427322327
Fix an off-by-one error in basic_string::__grow_by, where it would incorrectly throw length_error (instead of bad_alloc) when attempting to resize the string to 'max_size()'. Add tests for resizing to max_size +/-1
...
llvm-svn: 194151
2013-11-06 14:24:38 +00:00
Marshall Clow
f5fa53882f
Fixes PR17148
...
llvm-svn: 193772
2013-10-31 17:23:08 +00:00
Marshall Clow
3ceafc7f01
Mark namespaces for user defined literals as 'inline'
...
llvm-svn: 192047
2013-10-05 21:18:32 +00:00
Howard Hinnant
3af48ef76e
G M: Changes all references to "x inline" to "inline x" where x = _libcpp_always_inline or _libcpp_inline_visibility macros.
...
The patch touches these files:
locale
array
deque
new
string
utility
vector
__bit_reference
__split_buffer
locale_win32.h
There is no intended functionality change and it is expected that reversing the position of the inline keyword with regard to the other keywords does not change the meaning of anything, least not for apple/Linux etc.
It is intended to make libcxx more consistent with itself and to prevent the 1000 or so
"inline.cpp(3) : warning C4141: 'inline' : used more than once" warnings that MS's cl.exe compiler emits without this patch, i.e. if inline is not the first keyword before a function name etc.
Prefer "inline [other inline related keyword]" over "[other related keyword] inline".
After this patch, libcxx should be consistent to this pattern.
llvm-svn: 191987
2013-10-04 22:09:00 +00:00
Howard Hinnant
fc88dbd298
Debug mode for string. This commit also marks the first time libc++ debug-mode has found a bug (found one in regex). Had to play with extern templates a bit to get this to work since string is heavily used within libc++.dylib.
...
llvm-svn: 189114
2013-08-23 17:37:05 +00:00
Howard Hinnant
5d1a701d6d
Xing Xue: port to IBM XLC++/AIX.
...
llvm-svn: 188396
2013-08-14 18:00:20 +00:00
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
d098713aaf
War on tabs
...
llvm-svn: 187906
2013-08-07 19:39:48 +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
Marshall Clow
ca0be23b39
Implement string suffixes from N3642
...
llvm-svn: 186956
2013-07-23 17:05:24 +00:00
Howard Hinnant
eec721826c
Implement full support for non-pointer pointers in custom allocators for string. This completes the custom pointer support for the entire library.
...
llvm-svn: 185167
2013-06-28 16:59:19 +00:00
Howard Hinnant
35abaab7d3
This patch introduces an alternative layout for basic_string which when the string is short, the data pointer will be word-aligned. It can be activated with -D_LIBCPP_ALTERNATE_STRING_LAYOUT. These two different layouts (the default and _LIBCPP_ALTERNATE_STRING_LAYOUT) are not ABI compatible with each other. Once one is chosen for a given platform, it is disruptive to change it.
...
llvm-svn: 180811
2013-04-30 21:44:48 +00:00
Howard Hinnant
210051548e
Modest performance improvement for std::string's operator==.
...
llvm-svn: 180072
2013-04-22 23:55:13 +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
861f006d3f
Klaas de Vries: Fix bug in libc++'s std::string::find_first_not_of.
...
llvm-svn: 171321
2012-12-31 20:09:48 +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
Howard Hinnant
54d333a601
Rename uses of _ and __ because these are getting stepped on by macros from other system code.
...
llvm-svn: 167038
2012-10-30 19:06:59 +00:00
Argyrios Kyrtzidis
88db3171dd
Don't neglect to "return *this".
...
llvm-svn: 165860
2012-10-13 02:03:45 +00:00
Howard Hinnant
931644bfec
constexpr applied to <string>.
...
llvm-svn: 160563
2012-07-20 19:09:12 +00:00
Howard Hinnant
53d2fb0aa2
Installation of CityHash by Craig Silverstein
...
llvm-svn: 146329
2011-12-10 20:28:56 +00:00
Howard Hinnant
f3d14a65ca
Starting using murmur2 when combining multiple size_t's into a single hash, and also for basic_string. Also made hash<thread::id> ever so slighly more portable. I had to tweak one test which is questionable (definitely not portable) anyway.
...
llvm-svn: 145795
2011-12-05 00:08:45 +00:00
Howard Hinnant
c206366fd7
Quash a whole bunch of warnings
...
llvm-svn: 145624
2011-12-01 20:21:04 +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
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
e41124ade1
Don't move assign string::allocator_type when propagate_on_container_move_assignment is false.
...
llvm-svn: 137862
2011-08-17 20:36:18 +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
8d2ed56644
Add a new hash class in __gnu_ext for the extension containers. There
...
are two motivations for this.
First, this allows users who are specializing __gnu_ext::hash to
continue doing so without changing their code.
Second, SGI specifies hash overloads for char* and const char* that
perform a hash of the string, not of the pointer.
In order to support this, the hashing code for string is factored out.
llvm-svn: 136539
2011-07-29 23:31:56 +00:00
Howard Hinnant
520a61383c
Optimization of string::operator< by M.E. O'Neill. Discussion in http://llvm.org/bugs/show_bug.cgi?id=10461
...
llvm-svn: 135893
2011-07-24 21:45:06 +00:00
Howard Hinnant
5b0bdc2043
http://llvm.org/bugs/show_bug.cgi?id=10461
...
llvm-svn: 135873
2011-07-24 15:07:21 +00:00
Howard Hinnant
e3163f5ae3
http://llvm.org/bugs/show_bug.cgi?id=10390
...
llvm-svn: 135393
2011-07-18 15:51:59 +00:00
Howard Hinnant
11af28bdbd
Fixing up some ABI issues
...
llvm-svn: 134639
2011-07-07 21:03:52 +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
ce53420e37
Provide names for template and function parameters in forward declarations. The purpose is to aid automated documentation tools.
...
llvm-svn: 133008
2011-06-14 19:58:17 +00:00
Howard Hinnant
2d45a18c24
Bring noexcept for <string> inline with other containers.
...
llvm-svn: 132573
2011-06-03 18:40:47 +00:00
Howard Hinnant
76c7cd0e15
noexcept for Chapter 21 [strings].
...
llvm-svn: 132296
2011-05-29 19:57:12 +00:00
Howard Hinnant
ad16003517
Add always_inline to string move constructors
...
llvm-svn: 124252
2011-01-26 00:06:59 +00:00