From 51b4aee94f71bc75100465f336fa8b34161e8a11 Mon Sep 17 00:00:00 2001 From: Sebastian Pop Date: Thu, 11 Aug 2016 16:51:48 +0000 Subject: [PATCH] Add 'inline' attribute to __init to inline the basic_string's constructor basic_string's constructor calls init which was not getting inlined. This prevented optimization of const string as init would appear as a call in between a string's def and use. Patch by Laxman Sole and Aditya Kumar. Differential Revision: https://reviews.llvm.org/D22782 llvm-svn: 278356 --- libcxx/include/string | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libcxx/include/string b/libcxx/include/string index 94e70e0..8d947c6 100644 --- a/libcxx/include/string +++ b/libcxx/include/string @@ -1442,6 +1442,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const allocator_type& __ } template +inline _LIBCPP_INLINE_VISIBILITY void basic_string<_CharT, _Traits, _Allocator>::__init(const value_type* __s, size_type __sz, size_type __reserve) { @@ -1466,6 +1467,7 @@ basic_string<_CharT, _Traits, _Allocator>::__init(const value_type* __s, size_ty } template +inline _LIBCPP_INLINE_VISIBILITY void basic_string<_CharT, _Traits, _Allocator>::__init(const value_type* __s, size_type __sz) { @@ -1603,6 +1605,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(basic_string&& __str, co #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES template +inline _LIBCPP_INLINE_VISIBILITY void basic_string<_CharT, _Traits, _Allocator>::__init(size_type __n, value_type __c) { @@ -1699,6 +1702,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(__self_view __sv, const template template +inline _LIBCPP_INLINE_VISIBILITY typename enable_if < __is_exactly_input_iterator<_InputIterator>::value, @@ -1726,6 +1730,7 @@ basic_string<_CharT, _Traits, _Allocator>::__init(_InputIterator __first, _Input template template +inline _LIBCPP_INLINE_VISIBILITY typename enable_if < __is_forward_iterator<_ForwardIterator>::value, -- 2.7.4