Commit Graph

76 Commits

Author SHA1 Message Date
Evgeniy Stepanov
4f01aa8fb8 ABI versioning macros for libc++.
C++ macros and CMake options that specify the default ABI version of
the library, and can be overridden to pick up new ABI-changing
features.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@250254 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-13 23:48:28 +00:00
Marshall Clow
7ed093bde7 Implement LWG#2063, and update the issues links to point to the github generated pages
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@249325 91177308-0d34-0410-b5e6-96231b3b80d8
2015-10-05 16:17:34 +00:00
Eric Fiselier
e2d4892682 Fix most GCC warnings during build. Only -Wattribute left.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@246280 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-28 07:02:42 +00:00
Eric Fiselier
4f241823a2 [libcxx] Optimize away unneeded length calculation in basic_string::compare(const char*)
Summary:
This patch optimizes basic_string::compare to use strcmp when the default char_traits has been given.
See PR19900 for more information. https://llvm.org/bugs/show_bug.cgi?id=19900

Reviewers: mclow.lists

Subscribers: bkramer, cfe-commits

Differential Revision: http://reviews.llvm.org/D12355

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@246266 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-28 03:02:37 +00:00
Marshall Clow
af961ed8cf implement more of N4258 - Cleaning up noexcept in the standard library. Specifically add new noexcept stuff to vector and string's move-assignment operations
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@245330 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-18 18:57:00 +00:00
Marshall Clow
9a3c689b8a Change char_traits<char16_t>::eof() to return 0xFFFF instead of 0xDFFF. Fixes PR#24342
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@243937 91177308-0d34-0410-b5e6-96231b3b80d8
2015-08-04 01:38:34 +00:00
Eric Fiselier
692177d022 Enable and fix warnings during the build.
Although CMake adds warning flags, they are ignored in the libc++ headers
because the headers '#pragma system header' themselves.

This patch disables the system header pragma when building libc++ and fixes
the warnings that arose.

The warnings fixed were:
1. <memory> - anonymous structs are a GNU extension
2. <functional> - anonymous structs are a GNU extension.
3. <__hash_table> - Embedded preprocessor directives have undefined behavior.
4. <string> - Definition is missing noexcept from declaration.
5. <__std_stream> - Unused variable.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@242623 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-18 20:40:46 +00:00
Marshall Clow
7d914d1bff Implement the first part of N4258: 'Cleaning up noexcept in the Library'. This patch deals with swapping containers, and implements a more strict noexcept specification (a conforming extension) than the standard mandates.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@242056 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-13 20:04:56 +00:00
Marshall Clow
c912c0ce7c While applying N4258, I forgot about LWG#2455, which modified the modifications. Correct those - h/t: Howard
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@239004 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-04 02:05:41 +00:00
Marshall Clow
7b193f7797 More of N4258 implementation. Mark all of our test_allocators as noexcept constructible. Make the constructors for basic_string noexcept all the time (under C++14). Update tests to reflect the new world order. More to come.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@238957 91177308-0d34-0410-b5e6-96231b3b80d8
2015-06-03 19:56:43 +00:00
Marshall Clow
6bcbced54f Rooting out more undefined behavior in char_traits.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@229119 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-13 16:04:42 +00:00
Marshall Clow
f2e36ef093 Move the test for zero-length into the char_traits (from string_view). Add tests to char_traits specializations
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@228981 91177308-0d34-0410-b5e6-96231b3b80d8
2015-02-12 23:34:52 +00:00
Eric Fiselier
b991975439 [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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@220706 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-27 19:28:20 +00:00
Dan Albert
6d9505ad8a 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


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@217961 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-17 16:34:29 +00:00
Eric Fiselier
b9536101dc 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.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@215332 91177308-0d34-0410-b5e6-96231b3b80d8
2014-08-10 23:53:08 +00:00
Marshall Clow
d5549ccac1 Fix bug #20335 - memory leak when move-constructing a string with unequal allocator. Thanks to Thomas Koeppe for the report
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@213269 91177308-0d34-0410-b5e6-96231b3b80d8
2014-07-17 15:32:20 +00:00
Marshall Clow
37025e1b32 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.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@210561 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-10 18:51:55 +00:00
Marshall Clow
360f3196d7 Preparation for <string_view>. More helper functions that can be shared between <string> and <string_view>. No functionality change
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@210002 91177308-0d34-0410-b5e6-96231b3b80d8
2014-06-02 02:22:49 +00:00
Alp Toker
ec34c48976 Fix typos
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@208869 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-15 11:27:39 +00:00
Marshall Clow
a93b5e27a8 Implement LWG #2268: Setting a default argument in the declaration of a member function assign of std::basic_string.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@202876 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-04 19:17:19 +00:00
Marshall Clow
8eb5acc3c7 Remove tabs that crept in during an earlier refactoring. No functionality change
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@201472 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-16 01:57:26 +00:00
Marshall Clow
b671fc9b2d Refactor some of the operations in <string> so that they can be reused; no functionality change
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@196788 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-09 16:00:28 +00:00
Marshall Clow
ecc8d7b334 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
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@194151 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-06 14:24:38 +00:00
Marshall Clow
09f8550e1c Fixes PR17148
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@193772 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-31 17:23:08 +00:00
Marshall Clow
8d9dd7a968 Mark namespaces for user defined literals as 'inline'
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@192047 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-05 21:18:32 +00:00
Howard Hinnant
1e564246ec 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.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@191987 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-04 22:09:00 +00:00
Howard Hinnant
499cea12bb 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.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@189114 91177308-0d34-0410-b5e6-96231b3b80d8
2013-08-23 17:37:05 +00:00
Howard Hinnant
7f76450ee9 Xing Xue: port to IBM XLC++/AIX.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@188396 91177308-0d34-0410-b5e6-96231b3b80d8
2013-08-14 18:00:20 +00:00
Howard Hinnant
0f678bd69e 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>.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@188192 91177308-0d34-0410-b5e6-96231b3b80d8
2013-08-12 18:38:34 +00:00
Howard Hinnant
ab61b2c9f1 War on tabs
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@187906 91177308-0d34-0410-b5e6-96231b3b80d8
2013-08-07 19:39:48 +00:00
Howard Hinnant
e9df0a5c6c 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.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@187593 91177308-0d34-0410-b5e6-96231b3b80d8
2013-08-01 18:17:34 +00:00
Marshall Clow
152343260f Implement string suffixes from N3642
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@186956 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-23 17:05:24 +00:00
Howard Hinnant
9dcdcdee25 Implement full support for non-pointer pointers in custom allocators for string. This completes the custom pointer support for the entire library.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@185167 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-28 16:59:19 +00:00
Howard Hinnant
15467189c3 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.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@180811 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-30 21:44:48 +00:00
Howard Hinnant
08dd25303e Modest performance improvement for std::string's operator==.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@180072 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-22 23:55:13 +00:00
Howard Hinnant
83eade6abb 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.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@176593 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-06 23:30:19 +00:00
Howard Hinnant
635bbbb6d1 Revert accidental check-in. These changes are probably good, but premature at this point.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@174625 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-07 15:31:44 +00:00
Howard Hinnant
46c49d19aa 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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@174623 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-07 15:27:39 +00:00
Howard Hinnant
352bd3a273 Klaas de Vries: Fix bug in libc++'s std::string::find_first_not_of.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@171321 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-31 20:09:48 +00:00
Howard Hinnant
ff9267709d 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.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@167486 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-06 21:08:48 +00:00
Howard Hinnant
9c0df1416f Rename uses of _ and __ because these are getting stepped on by macros from other system code.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@167038 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-30 19:06:59 +00:00
Argyrios Kyrtzidis
1dc6f7ab97 Don't neglect to "return *this".
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@165860 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-13 02:03:45 +00:00
Howard Hinnant
03d7181b0e constexpr applied to <string>.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@160563 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-20 19:09:12 +00:00
Howard Hinnant
c00f75dc75 Installation of CityHash by Craig Silverstein
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@146329 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-10 20:28:56 +00:00
Howard Hinnant
40c13d31c5 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.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@145795 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-05 00:08:45 +00:00
Howard Hinnant
ec3773c2da Quash a whole bunch of warnings
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@145624 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-01 20:21:04 +00:00
Howard Hinnant
66c6f9733b Add protection from min/max macros
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@145407 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-29 16:45:27 +00:00
Howard Hinnant
78b6828f14 More windows port work by Ruben Van Boxem
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@142732 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-22 20:59:45 +00:00
Howard Hinnant
08e17472e4 Windows support by Ruben Van Boxem.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@142235 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-17 20:05:10 +00:00
Howard Hinnant
9cbee430da Fix const correctness bug in __move_assign. Found and fixed by Ion Gaztañaga.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@139032 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-02 20:42:31 +00:00