[libcxx] r340406 - Attempt to unbreak filesystem tests on certain linux distros.
Author: ericwf Date: Wed Aug 22 06:29:52 2018 New Revision: 340406 URL: http://llvm.org/viewvc/llvm-project?rev=340406&view=rev Log: Attempt to unbreak filesystem tests on certain linux distros. On some platforms clock_gettime is in librt, which we don't link by default when building the tests. However it is required by the filesystem tests. This patch introduces a workaround which links librt whenever the filesystem tests are enabled. The workaround should later be replaced with a patch that selectively links both libc++fs and librt only when building filesystem specific tests. However, the way the test configuration is set up right now, this is non-trivial. Modified: libcxx/trunk/utils/libcxx/test/target_info.py Modified: libcxx/trunk/utils/libcxx/test/target_info.py URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/utils/libcxx/test/target_info.py?rev=340406&r1=340405&r2=340406&view=diff == --- libcxx/trunk/utils/libcxx/test/target_info.py (original) +++ libcxx/trunk/utils/libcxx/test/target_info.py Wed Aug 22 06:29:52 2018 @@ -222,12 +222,17 @@ class LinuxLocalTI(DefaultTargetInfo): self.full_config.config.available_features) llvm_unwinder = self.full_config.get_lit_bool('llvm_unwinder', False) shared_libcxx = self.full_config.get_lit_bool('enable_shared', True) +# FIXME: Remove the need to link -lrt in all the tests, and instead +# limit it only to the filesystem tests. This ensures we don't cause an +# implicit dependency on librt except when filesystem is needed. +enable_fs = self.full_config.get_lit_bool('enable_filesystem', + default=False) flags += ['-lm'] if not llvm_unwinder: flags += ['-lgcc_s', '-lgcc'] if enable_threads: flags += ['-lpthread'] -if not shared_libcxx: +if not shared_libcxx or enable_fs: flags += ['-lrt'] flags += ['-lc'] if llvm_unwinder: ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r340426 - Add diagnostics for min/max algorithms when a InputIterator is used.
Author: ericwf Date: Wed Aug 22 10:47:13 2018 New Revision: 340426 URL: http://llvm.org/viewvc/llvm-project?rev=340426&view=rev Log: Add diagnostics for min/max algorithms when a InputIterator is used. These algorithms require a ForwardIterator or better. Ensure we diagnose the contract violation at compile time instead of of silently doing the wrong thing. Further algorithms will be audited in upcoming patches. Added: libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/requires_forward_iterator.fail.cpp Modified: libcxx/trunk/include/algorithm Modified: libcxx/trunk/include/algorithm URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/algorithm?rev=340426&r1=340425&r2=340426&view=diff == --- libcxx/trunk/include/algorithm (original) +++ libcxx/trunk/include/algorithm Wed Aug 22 10:47:13 2018 @@ -2398,6 +2398,8 @@ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP _ForwardIterator min_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp) { +static_assert(__is_forward_iterator<_ForwardIterator>::value, +"std::min_element requires a ForwardIterator"); if (__first != __last) { _ForwardIterator __i = __first; @@ -2462,6 +2464,8 @@ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP _ForwardIterator max_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp) { +static_assert(__is_forward_iterator<_ForwardIterator>::value, +"std::max_element requires a ForwardIterator"); if (__first != __last) { _ForwardIterator __i = __first; @@ -2548,6 +2552,8 @@ _LIBCPP_CONSTEXPR_AFTER_CXX11 std::pair<_ForwardIterator, _ForwardIterator> minmax_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __comp) { + static_assert(__is_forward_iterator<_ForwardIterator>::value, +"std::minmax_element requires a ForwardIterator"); std::pair<_ForwardIterator, _ForwardIterator> __result(__first, __first); if (__first != __last) { Added: libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/requires_forward_iterator.fail.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/requires_forward_iterator.fail.cpp?rev=340426&view=auto == --- libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/requires_forward_iterator.fail.cpp (added) +++ libcxx/trunk/test/std/algorithms/alg.sorting/alg.min.max/requires_forward_iterator.fail.cpp Wed Aug 22 10:47:13 2018 @@ -0,0 +1,37 @@ +//===--===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===--===// + +// + +// template +// max_element(Iter first, Iter last); + +#include +#include + +#include "test_iterators.h" + +int main() { + int arr[] = {1, 2, 3}; + const int *b = std::begin(arr), *e = std::end(arr); + typedef input_iterator Iter; + { +// expected-error@algorithm:* {{"std::min_element requires a ForwardIterator"}} +std::min_element(Iter(b), Iter(e)); + } + { +// expected-error@algorithm:* {{"std::max_element requires a ForwardIterator"}} +std::max_element(Iter(b), Iter(e)); + } + { +// expected-error@algorithm:* {{"std::minmax_element requires a ForwardIterator"}} +std::minmax_element(Iter(b), Iter(e)); + } + +} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r331957 - [Itanium] Emit type info names with external linkage.
Author: ericwf Date: Wed May 9 22:25:15 2018 New Revision: 331957 URL: http://llvm.org/viewvc/llvm-project?rev=331957&view=rev Log: [Itanium] Emit type info names with external linkage. Summary: The Itanium ABI requires that the type info for pointer-to-incomplete types to have internal linkage, so that it doesn't interfere with the type info once completed. Currently it also marks the type info name as internal as well. However, this causes a bug with the STL implementations, which use the type info name pointer to perform ordering and hashing of type infos. For example: ``` // header.h struct T; extern std::type_info const& Info; // tu_one.cpp #include "header.h" std::type_info const& Info = typeid(T*); // tu_two.cpp #include "header.h" struct T {}; int main() { auto &TI1 = Info; auto &TI2 = typeid(T*); assert(TI1 == TI2); // Fails assert(TI1.hash_code() == TI2.hash_code()); // Fails } ``` This patch fixes the STL bug by emitting the type info name as linkonce_odr when the type-info is for a pointer-to-incomplete type. Note that libc++ could fix this without a compiler change, but the quality of fix would be poor. The library would either have to: (A) Always perform strcmp/string hashes. (B) Determine if we have a pointer-to-incomplete type, and only do strcmp then. This would require an ABI break for libc++. Reviewers: rsmith, rjmccall, majnemer, vsapsai Reviewed By: rjmccall Subscribers: smeenai, cfe-commits Differential Revision: https://reviews.llvm.org/D46665 Modified: cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp cfe/trunk/test/CodeGenCXX/rtti-linkage.cpp Modified: cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp?rev=331957&r1=331956&r2=331957&view=diff == --- cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp (original) +++ cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp Wed May 9 22:25:15 2018 @@ -3008,8 +3008,46 @@ void ItaniumRTTIBuilder::BuildVTablePoin /// Return the linkage that the type info and type info name constants /// should have for the given type. -static llvm::GlobalVariable::LinkageTypes getTypeInfoLinkage(CodeGenModule &CGM, - QualType Ty) { +static std::pair +getTypeInfoLinkage(CodeGenModule &CGM, QualType Ty) { + llvm::GlobalValue::LinkageTypes TypeLinkage = [&]() { +switch (Ty->getLinkage()) { +case NoLinkage: +case InternalLinkage: +case UniqueExternalLinkage: + return llvm::GlobalValue::InternalLinkage; + +case VisibleNoLinkage: +case ModuleInternalLinkage: +case ModuleLinkage: +case ExternalLinkage: + // RTTI is not enabled, which means that this type info struct is going + // to be used for exception handling. Give it linkonce_odr linkage. + if (!CGM.getLangOpts().RTTI) +return llvm::GlobalValue::LinkOnceODRLinkage; + + if (const RecordType *Record = dyn_cast(Ty)) { +const CXXRecordDecl *RD = cast(Record->getDecl()); +if (RD->hasAttr()) + return llvm::GlobalValue::WeakODRLinkage; +if (CGM.getTriple().isWindowsItaniumEnvironment()) + if (RD->hasAttr() && + ShouldUseExternalRTTIDescriptor(CGM, Ty)) +return llvm::GlobalValue::ExternalLinkage; +// MinGW always uses LinkOnceODRLinkage for type info. +if (RD->isCompleteDefinition() && RD->isDynamicClass() && +!CGM.getContext() + .getTargetInfo() + .getTriple() + .isWindowsGNUEnvironment()) + return CGM.getVTableLinkage(RD); + } + + return llvm::GlobalValue::LinkOnceODRLinkage; +} +llvm_unreachable("Invalid linkage!"); + }(); // Itanium C++ ABI 2.9.5p7: // In addition, it and all of the intermediate abi::__pointer_type_info // structs in the chain down to the abi::__class_type_info for the @@ -3020,44 +3058,8 @@ static llvm::GlobalVariable::LinkageType // complete class RTTI (because the latter need not exist), possibly by // making it a local static object. if (ContainsIncompleteClassType(Ty)) -return llvm::GlobalValue::InternalLinkage; - - switch (Ty->getLinkage()) { - case NoLinkage: - case InternalLinkage: - case UniqueExternalLinkage: -return llvm::GlobalValue::InternalLinkage; - - case VisibleNoLinkage: - case ModuleInternalLinkage: - case ModuleLinkage: - case ExternalLinkage: -// RTTI is not enabled, which means that this type info struct is going -// to be used for exception handling. Give it linkonce_odr linkage. -if (!CGM.getLangOpts().RTTI) - return llvm::GlobalValue::LinkOnceODRLinkage; - -if (const RecordType *Record = dyn_cast(Ty)) { - const CXXRecordDecl *RD = cast(Record->getDecl()); - if (RD->hasAttr()) -return llvm::GlobalValue::WeakODRLinkage; - if (CGM.getTriple().is
r331963 - Revert "[Itanium] Emit type info names with external linkage."
Author: ericwf Date: Thu May 10 01:10:57 2018 New Revision: 331963 URL: http://llvm.org/viewvc/llvm-project?rev=331963&view=rev Log: Revert "[Itanium] Emit type info names with external linkage." This reverts commit r331957. It seems to be causing failures on ppc64le-linux. Modified: cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp cfe/trunk/test/CodeGenCXX/rtti-linkage.cpp Modified: cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp?rev=331963&r1=331962&r2=331963&view=diff == --- cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp (original) +++ cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp Thu May 10 01:10:57 2018 @@ -3008,46 +3008,8 @@ void ItaniumRTTIBuilder::BuildVTablePoin /// Return the linkage that the type info and type info name constants /// should have for the given type. -static std::pair -getTypeInfoLinkage(CodeGenModule &CGM, QualType Ty) { - llvm::GlobalValue::LinkageTypes TypeLinkage = [&]() { -switch (Ty->getLinkage()) { -case NoLinkage: -case InternalLinkage: -case UniqueExternalLinkage: - return llvm::GlobalValue::InternalLinkage; - -case VisibleNoLinkage: -case ModuleInternalLinkage: -case ModuleLinkage: -case ExternalLinkage: - // RTTI is not enabled, which means that this type info struct is going - // to be used for exception handling. Give it linkonce_odr linkage. - if (!CGM.getLangOpts().RTTI) -return llvm::GlobalValue::LinkOnceODRLinkage; - - if (const RecordType *Record = dyn_cast(Ty)) { -const CXXRecordDecl *RD = cast(Record->getDecl()); -if (RD->hasAttr()) - return llvm::GlobalValue::WeakODRLinkage; -if (CGM.getTriple().isWindowsItaniumEnvironment()) - if (RD->hasAttr() && - ShouldUseExternalRTTIDescriptor(CGM, Ty)) -return llvm::GlobalValue::ExternalLinkage; -// MinGW always uses LinkOnceODRLinkage for type info. -if (RD->isCompleteDefinition() && RD->isDynamicClass() && -!CGM.getContext() - .getTargetInfo() - .getTriple() - .isWindowsGNUEnvironment()) - return CGM.getVTableLinkage(RD); - } - - return llvm::GlobalValue::LinkOnceODRLinkage; -} -llvm_unreachable("Invalid linkage!"); - }(); +static llvm::GlobalVariable::LinkageTypes getTypeInfoLinkage(CodeGenModule &CGM, + QualType Ty) { // Itanium C++ ABI 2.9.5p7: // In addition, it and all of the intermediate abi::__pointer_type_info // structs in the chain down to the abi::__class_type_info for the @@ -3058,8 +3020,44 @@ getTypeInfoLinkage(CodeGenModule &CGM, Q // complete class RTTI (because the latter need not exist), possibly by // making it a local static object. if (ContainsIncompleteClassType(Ty)) -return {llvm::GlobalValue::InternalLinkage, TypeLinkage}; - return {TypeLinkage, TypeLinkage}; +return llvm::GlobalValue::InternalLinkage; + + switch (Ty->getLinkage()) { + case NoLinkage: + case InternalLinkage: + case UniqueExternalLinkage: +return llvm::GlobalValue::InternalLinkage; + + case VisibleNoLinkage: + case ModuleInternalLinkage: + case ModuleLinkage: + case ExternalLinkage: +// RTTI is not enabled, which means that this type info struct is going +// to be used for exception handling. Give it linkonce_odr linkage. +if (!CGM.getLangOpts().RTTI) + return llvm::GlobalValue::LinkOnceODRLinkage; + +if (const RecordType *Record = dyn_cast(Ty)) { + const CXXRecordDecl *RD = cast(Record->getDecl()); + if (RD->hasAttr()) +return llvm::GlobalValue::WeakODRLinkage; + if (CGM.getTriple().isWindowsItaniumEnvironment()) +if (RD->hasAttr() && +ShouldUseExternalRTTIDescriptor(CGM, Ty)) + return llvm::GlobalValue::ExternalLinkage; + // MinGW always uses LinkOnceODRLinkage for type info. + if (RD->isDynamicClass() && + !CGM.getContext() + .getTargetInfo() + .getTriple() + .isWindowsGNUEnvironment()) +return CGM.getVTableLinkage(RD); +} + +return llvm::GlobalValue::LinkOnceODRLinkage; + } + + llvm_unreachable("Invalid linkage!"); } llvm::Constant *ItaniumRTTIBuilder::BuildTypeInfo(QualType Ty, bool Force, @@ -3086,25 +3084,23 @@ llvm::Constant *ItaniumRTTIBuilder::Buil return GetAddrOfExternalRTTIDescriptor(Ty); // Emit the standard library with external linkage. - llvm::GlobalVariable::LinkageTypes InfoLinkage, NameLinkage; + llvm::GlobalVariable::LinkageTypes Linkage; if (IsStdLib) -InfoLinkage = NameLinkage = llvm::GlobalValue::ExternalLinkage; - else { -auto LinkagePair = getTypeInfoLinkage(CGM, Ty); -InfoLinkage = LinkagePair.first; -NameLinkage = LinkagePair.second; - }
r332028 - [Itanium] Emit type info names with external linkage.
Author: ericwf Date: Thu May 10 12:51:56 2018 New Revision: 332028 URL: http://llvm.org/viewvc/llvm-project?rev=332028&view=rev Log: [Itanium] Emit type info names with external linkage. Summary: The Itanium ABI requires that the type info for pointer-to-incomplete types to have internal linkage, so that it doesn't interfere with the type info once completed. Currently it also marks the type info name as internal as well. However, this causes a bug with the STL implementations, which use the type info name pointer to perform ordering and hashing of type infos. For example: ``` // header.h struct T; extern std::type_info const& Info; // tu_one.cpp #include "header.h" std::type_info const& Info = typeid(T*); // tu_two.cpp #include "header.h" struct T {}; int main() { auto &TI1 = Info; auto &TI2 = typeid(T*); assert(TI1 == TI2); // Fails assert(TI1.hash_code() == TI2.hash_code()); // Fails } ``` This patch fixes the STL bug by emitting the type info name as linkonce_odr when the type-info is for a pointer-to-incomplete type. Note that libc++ could fix this without a compiler change, but the quality of fix would be poor. The library would either have to: (A) Always perform strcmp/string hashes. (B) Determine if we have a pointer-to-incomplete type, and only do strcmp then. This would require an ABI break for libc++. Reviewers: rsmith, rjmccall, majnemer, vsapsai Reviewed By: rjmccall Subscribers: smeenai, cfe-commits Differential Revision: https://reviews.llvm.org/D46665 Modified: cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp cfe/trunk/test/CodeGenCXX/rtti-linkage.cpp Modified: cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp?rev=332028&r1=332027&r2=332028&view=diff == --- cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp (original) +++ cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp Thu May 10 12:51:56 2018 @@ -3008,8 +3008,46 @@ void ItaniumRTTIBuilder::BuildVTablePoin /// Return the linkage that the type info and type info name constants /// should have for the given type. -static llvm::GlobalVariable::LinkageTypes getTypeInfoLinkage(CodeGenModule &CGM, - QualType Ty) { +static std::pair +getTypeInfoLinkage(CodeGenModule &CGM, QualType Ty) { + llvm::GlobalValue::LinkageTypes TypeLinkage = [&]() { +switch (Ty->getLinkage()) { +case NoLinkage: +case InternalLinkage: +case UniqueExternalLinkage: + return llvm::GlobalValue::InternalLinkage; + +case VisibleNoLinkage: +case ModuleInternalLinkage: +case ModuleLinkage: +case ExternalLinkage: + // RTTI is not enabled, which means that this type info struct is going + // to be used for exception handling. Give it linkonce_odr linkage. + if (!CGM.getLangOpts().RTTI) +return llvm::GlobalValue::LinkOnceODRLinkage; + + if (const RecordType *Record = dyn_cast(Ty)) { +const CXXRecordDecl *RD = cast(Record->getDecl()); +if (RD->hasAttr()) + return llvm::GlobalValue::WeakODRLinkage; +if (CGM.getTriple().isWindowsItaniumEnvironment()) + if (RD->hasAttr() && + ShouldUseExternalRTTIDescriptor(CGM, Ty)) +return llvm::GlobalValue::ExternalLinkage; +// MinGW always uses LinkOnceODRLinkage for type info. +if (RD->isCompleteDefinition() && RD->isDynamicClass() && +!CGM.getContext() + .getTargetInfo() + .getTriple() + .isWindowsGNUEnvironment()) + return CGM.getVTableLinkage(RD); + } + + return llvm::GlobalValue::LinkOnceODRLinkage; +} +llvm_unreachable("Invalid linkage!"); + }(); // Itanium C++ ABI 2.9.5p7: // In addition, it and all of the intermediate abi::__pointer_type_info // structs in the chain down to the abi::__class_type_info for the @@ -3020,44 +3058,8 @@ static llvm::GlobalVariable::LinkageType // complete class RTTI (because the latter need not exist), possibly by // making it a local static object. if (ContainsIncompleteClassType(Ty)) -return llvm::GlobalValue::InternalLinkage; - - switch (Ty->getLinkage()) { - case NoLinkage: - case InternalLinkage: - case UniqueExternalLinkage: -return llvm::GlobalValue::InternalLinkage; - - case VisibleNoLinkage: - case ModuleInternalLinkage: - case ModuleLinkage: - case ExternalLinkage: -// RTTI is not enabled, which means that this type info struct is going -// to be used for exception handling. Give it linkonce_odr linkage. -if (!CGM.getLangOpts().RTTI) - return llvm::GlobalValue::LinkOnceODRLinkage; - -if (const RecordType *Record = dyn_cast(Ty)) { - const CXXRecordDecl *RD = cast(Record->getDecl()); - if (RD->hasAttr()) -return llvm::GlobalValue::WeakODRLinkage; - if (CGM.getTriple().is
[libcxx] r332040 - Fix PR37407 - callable traits don't correctly check complete types.
Author: ericwf Date: Thu May 10 13:59:35 2018 New Revision: 332040 URL: http://llvm.org/viewvc/llvm-project?rev=332040&view=rev Log: Fix PR37407 - callable traits don't correctly check complete types. Checking for complete types is really rather tricky when you consider the amount of specializations required to check a function type. This specifically caused PR37407 where we incorrectly diagnosed noexcept function types as incomplete (but there were plenty of other cases that would cause this). This patch removes the complete type checking for now. I'm going to look into adding a clang builtin to correctly do this for us. Modified: libcxx/trunk/include/type_traits libcxx/trunk/test/std/utilities/meta/meta.trans/meta.trans.other/result_of.pass.cpp libcxx/trunk/test/std/utilities/meta/meta.trans/meta.trans.other/result_of11.pass.cpp Modified: libcxx/trunk/include/type_traits URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/type_traits?rev=332040&r1=332039&r2=332040&view=diff == --- libcxx/trunk/include/type_traits (original) +++ libcxx/trunk/include/type_traits Thu May 10 13:59:35 2018 @@ -4168,147 +4168,6 @@ template struct __is_referen #ifndef _LIBCPP_CXX03_LANG -// Check for complete types - -template struct __check_complete; - -template <> -struct __check_complete<> -{ -}; - -template -struct __check_complete<_Hp, _T0, _Tp...> -: private __check_complete<_Hp>, - private __check_complete<_T0, _Tp...> -{ -}; - -template -struct __check_complete<_Hp, _Hp> -: private __check_complete<_Hp> -{ -}; - -template -struct __check_complete<_Tp> -{ -static_assert(sizeof(_Tp) > 0, "Type must be complete."); -}; - -template -struct __check_complete<_Tp&> -: private __check_complete<_Tp> -{ -}; - -template -struct __check_complete<_Tp&&> -: private __check_complete<_Tp> -{ -}; - -template -struct __check_complete<_Rp (*)(_Param...)> -: private __check_complete<_Rp> -{ -}; - -template -struct __check_complete -{ -}; - -template -struct __check_complete<_Rp (_Param...)> -: private __check_complete<_Rp> -{ -}; - -template -struct __check_complete -{ -}; - -template -struct __check_complete<_Rp (_Class::*)(_Param...)> -: private __check_complete<_Class> -{ -}; - -template -struct __check_complete<_Rp (_Class::*)(_Param...) const> -: private __check_complete<_Class> -{ -}; - -template -struct __check_complete<_Rp (_Class::*)(_Param...) volatile> -: private __check_complete<_Class> -{ -}; - -template -struct __check_complete<_Rp (_Class::*)(_Param...) const volatile> -: private __check_complete<_Class> -{ -}; - -template -struct __check_complete<_Rp (_Class::*)(_Param...) &> -: private __check_complete<_Class> -{ -}; - -template -struct __check_complete<_Rp (_Class::*)(_Param...) const&> -: private __check_complete<_Class> -{ -}; - -template -struct __check_complete<_Rp (_Class::*)(_Param...) volatile&> -: private __check_complete<_Class> -{ -}; - -template -struct __check_complete<_Rp (_Class::*)(_Param...) const volatile&> -: private __check_complete<_Class> -{ -}; - -template -struct __check_complete<_Rp (_Class::*)(_Param...) &&> -: private __check_complete<_Class> -{ -}; - -template -struct __check_complete<_Rp (_Class::*)(_Param...) const&&> -: private __check_complete<_Class> -{ -}; - -template -struct __check_complete<_Rp (_Class::*)(_Param...) volatile&&> -: private __check_complete<_Class> -{ -}; - -template -struct __check_complete<_Rp (_Class::*)(_Param...) const volatile&&> -: private __check_complete<_Class> -{ -}; - -template -struct __check_complete<_Rp _Class::*> -: private __check_complete<_Class> -{ -}; - - template ::type, class _DecayA0 = typename decay<_A0>::type, @@ -4491,8 +4350,9 @@ _LIBCPP_INVOKE_RETURN(_VSTD::forward<_Fp template struct __invokable_r -: private __check_complete<_Fp> { +// FIXME: Check that _Ret, _Fp, and _Args... are all complete types, cv void, +// or incomplete array types as required by the standard. using _Result = decltype( _VSTD::__invoke(_VSTD::declval<_Fp>(), _VSTD::declval<_Args>()...)); Modified: libcxx/trunk/test/std/utilities/meta/meta.trans/meta.trans.other/result_of.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/meta/meta.trans/meta.trans.other/result_of.pass.cpp?rev=332040&r1=332039&r2=332040&view=diff == --- libcxx/trunk/test/std/utilities/meta/meta.trans/meta.trans.other/result_of.pass.cpp (original) +++ libcxx/trunk/test/std/utilities/meta/meta.trans/meta.trans.other/result_of.pass.cpp Thu May 10 13:59:35 2018 @@ -104,36 +104,43 @@ int main() test_result_of (); } { // pointer to function -typedef bool (&RF0)(); +typedef bool(&RF0)(); typedef
[libcxx] r332066 - Fix failing test due to incorrect use of noexcept
Author: ericwf Date: Thu May 10 17:33:20 2018 New Revision: 332066 URL: http://llvm.org/viewvc/llvm-project?rev=332066&view=rev Log: Fix failing test due to incorrect use of noexcept Modified: libcxx/trunk/test/std/utilities/meta/meta.trans/meta.trans.other/result_of11.pass.cpp Modified: libcxx/trunk/test/std/utilities/meta/meta.trans/meta.trans.other/result_of11.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/meta/meta.trans/meta.trans.other/result_of11.pass.cpp?rev=332066&r1=332065&r2=332066&view=diff == --- libcxx/trunk/test/std/utilities/meta/meta.trans/meta.trans.other/result_of11.pass.cpp (original) +++ libcxx/trunk/test/std/utilities/meta/meta.trans/meta.trans.other/result_of11.pass.cpp Thu May 10 17:33:20 2018 @@ -58,20 +58,6 @@ void test_result_of_imp() int main() { -{ // Function types with noexcept -typedef bool (&RF0)(int) noexcept; -typedef bool (&RF1)(int, ...) noexcept; -typedef bool (*PF0)(int) noexcept; -typedef bool (*PF1)(int, ...) noexcept; -typedef bool (*&PRF0)(int) noexcept; -typedef bool (*&PRF1)(int, ...) noexcept; -test_result_of_imp(); -test_result_of_imp(); -test_result_of_imp(); -test_result_of_imp(); -test_result_of_imp(); -test_result_of_imp(); -} { typedef char F::*PMD; test_result_of_imp(); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxxabi] r332763 - private_typeinfo: propagate static flags in vmi search_above_dst method
Author: ericwf Date: Fri May 18 13:39:57 2018 New Revision: 332763 URL: http://llvm.org/viewvc/llvm-project?rev=332763&view=rev Log: private_typeinfo: propagate static flags in vmi search_above_dst method Patch by Ryan Prichard Propagate the found_our_static_ptr and found_any_static_type flags from __vmi_class_type_info::search_above_dst to its caller. Fixes PR33425 and PR33487 Reviewed as https://reviews.llvm.org/D36446 Modified: libcxxabi/trunk/src/private_typeinfo.cpp Modified: libcxxabi/trunk/src/private_typeinfo.cpp URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/private_typeinfo.cpp?rev=332763&r1=332762&r2=332763&view=diff == --- libcxxabi/trunk/src/private_typeinfo.cpp (original) +++ libcxxabi/trunk/src/private_typeinfo.cpp Fri May 18 13:39:57 2018 @@ -1181,6 +1181,8 @@ __vmi_class_type_info::search_above_dst( info->found_our_static_ptr = false; info->found_any_static_type = false; p->search_above_dst(info, dst_ptr, current_ptr, path_below, use_strcmp); +found_our_static_ptr |= info->found_our_static_ptr; +found_any_static_type |= info->found_any_static_type; if (++p < e) { do @@ -1210,6 +1212,8 @@ __vmi_class_type_info::search_above_dst( info->found_our_static_ptr = false; info->found_any_static_type = false; p->search_above_dst(info, dst_ptr, current_ptr, path_below, use_strcmp); +found_our_static_ptr |= info->found_our_static_ptr; +found_any_static_type |= info->found_any_static_type; } while (++p < e); } // Restore flags ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxxabi] r332764 - private_typeinfo: propagate static flags in vmi search_above_dst method
Author: ericwf Date: Fri May 18 13:42:53 2018 New Revision: 332764 URL: http://llvm.org/viewvc/llvm-project?rev=332764&view=rev Log: private_typeinfo: propagate static flags in vmi search_above_dst method This adds the test which was mistakenly not committed in r332763. Patch by Ryan Prichard Propagate the found_our_static_ptr and found_any_static_type flags from __vmi_class_type_info::search_above_dst to its caller. Fixes PR33425 and PR33487 Reviewed as https://reviews.llvm.org/D36446 Added: libcxxabi/trunk/test/dynamic_cast.pass.cpp Added: libcxxabi/trunk/test/dynamic_cast.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/test/dynamic_cast.pass.cpp?rev=332764&view=auto == --- libcxxabi/trunk/test/dynamic_cast.pass.cpp (added) +++ libcxxabi/trunk/test/dynamic_cast.pass.cpp Fri May 18 13:42:53 2018 @@ -0,0 +1,103 @@ +//===- dynamic_cast.pass.cpp --===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===--===// + +#include + +// This test explicitly tests dynamic cast with types that have inaccessible +// bases. +#if defined(__clang__) +#pragma clang diagnostic ignored "-Winaccessible-base" +#endif + +typedef char Pad1[43981]; +typedef char Pad2[34981]; +typedef char Pad3[93481]; +typedef char Pad4[13489]; +typedef char Pad5[81349]; +typedef char Pad6[34819]; +typedef char Pad7[3489]; + +namespace t1 +{ + +// PR33425 +struct C3 { virtual ~C3() {} Pad1 _; }; +struct C5 : protected virtual C3 { Pad2 _; }; +struct C6 : virtual C5 { Pad3 _; }; +struct C7 : virtual C3 { Pad4 _; }; +struct C9 : C6, C7 { Pad5 _; }; + +C9 c9; +C3 *c3 = &c9; + +void test() +{ +assert(dynamic_cast(c3) == static_cast(&c9)); +assert(dynamic_cast(c3) == static_cast(&c9)); +assert(dynamic_cast(c3) == static_cast(&c9)); +assert(dynamic_cast(c3) == static_cast(&c9)); +assert(dynamic_cast(c3) == static_cast(&c9)); +} + +} // t1 + +namespace t2 +{ + +// PR33425 +struct Src { virtual ~Src() {} Pad1 _; }; +struct Mask : protected virtual Src { Pad2 _; }; +struct Dest : Mask { Pad3 _; }; +struct Root : Dest, virtual Src { Pad4 _; }; + +Root root; +Src *src = &root; + +void test() +{ +assert(dynamic_cast(src) == static_cast(&root)); +assert(dynamic_cast(src) == static_cast(&root)); +assert(dynamic_cast(src) == static_cast(&root)); +assert(dynamic_cast(src) == static_cast(&root)); +} + +} // t2 + +namespace t3 +{ + +// PR33487 +struct Class1 { virtual ~Class1() {} Pad1 _; }; +struct Shared : virtual Class1 { Pad2 _; }; +struct Class6 : virtual Shared { Pad3 _; }; +struct Left : Class6 { Pad4 _; }; +struct Right : Class6 { Pad5 _; }; +struct Main : Left, Right { Pad6 _; }; + +Main m; +Class1 *c1 = &m; + +void test() +{ +assert(dynamic_cast(c1) == static_cast(&m)); +assert(dynamic_cast(c1) == static_cast(&m)); +assert(dynamic_cast(c1) == 0); +assert(dynamic_cast(c1) == static_cast(&m)); +assert(dynamic_cast(c1) == static_cast(&m)); +assert(dynamic_cast(c1) == static_cast(&m)); +} + +} // t3 + +int main() +{ +t1::test(); +t2::test(); +t3::test(); +} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxxabi] r332767 - private_typeinfo: limit is_dst_type_derived_from_static_type optimization
Author: ericwf Date: Fri May 18 13:51:38 2018 New Revision: 332767 URL: http://llvm.org/viewvc/llvm-project?rev=332767&view=rev Log: private_typeinfo: limit is_dst_type_derived_from_static_type optimization Patch by Ryan Prichard If the destination type does not derive from the static type, we can skip the search_above_dst call, but we still need to run the !does_dst_type_point_to_our_static_type block of code. That block of code will increment info->number_to_dst_ptr to 2, and because dest isn't derived from static, the cast will ultimately fail. Fixes PR33439 Reviewed as https://reviews.llvm.org/D36447 Modified: libcxxabi/trunk/src/private_typeinfo.cpp libcxxabi/trunk/test/dynamic_cast.pass.cpp Modified: libcxxabi/trunk/src/private_typeinfo.cpp URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/private_typeinfo.cpp?rev=332767&r1=332766&r2=332767&view=diff == --- libcxxabi/trunk/src/private_typeinfo.cpp (original) +++ libcxxabi/trunk/src/private_typeinfo.cpp Fri May 18 13:51:38 2018 @@ -859,13 +859,14 @@ __vmi_class_type_info::search_below_dst( // Record the access path that got us here // If there is more than one dst_type this path doesn't matter. info->path_dynamic_ptr_to_dst_ptr = path_below; +bool does_dst_type_point_to_our_static_type = false; // Only search above here if dst_type derives from static_type, or //if it is unknown if dst_type derives from static_type. if (info->is_dst_type_derived_from_static_type != no) { // Set up flags to record results from all base classes bool is_dst_type_derived_from_static_type = false; -bool does_dst_type_point_to_our_static_type = false; + // We've found a dst_type with a potentially public path to here. // We have to assume the path is public because it may become // public later (if we get back to here with a public path). @@ -909,21 +910,6 @@ __vmi_class_type_info::search_below_dst( } } } -if (!does_dst_type_point_to_our_static_type) -{ -// We found a dst_type that doesn't point to (static_ptr, static_type) -// So record the address of this dst_ptr and increment the -// count of the number of such dst_types found in the tree. -info->dst_ptr_not_leading_to_static_ptr = current_ptr; -info->number_to_dst_ptr += 1; -// If there exists another dst with a private path to -//(static_ptr, static_type), then the cast from -// (dynamic_ptr, dynamic_type) to dst_type is now ambiguous, -// so stop search. -if (info->number_to_static_ptr == 1 && -info->path_dst_ptr_to_static_ptr == not_public_path) -info->search_done = true; -} // If we found no static_type,s then dst_type doesn't derive // from static_type, else it does. Record this result so that // next time we hit a dst_type we will know not to search above @@ -932,7 +918,22 @@ __vmi_class_type_info::search_below_dst( info->is_dst_type_derived_from_static_type = yes; else info->is_dst_type_derived_from_static_type = no; -} + } + if (!does_dst_type_point_to_our_static_type) + { + // We found a dst_type that doesn't point to (static_ptr, static_type) + // So record the address of this dst_ptr and increment the + // count of the number of such dst_types found in the tree. + info->dst_ptr_not_leading_to_static_ptr = current_ptr; + info->number_to_dst_ptr += 1; + // If there exists another dst with a private path to + //(static_ptr, static_type), then the cast from + // (dynamic_ptr, dynamic_type) to dst_type is now ambiguous, + // so stop search. + if (info->number_to_static_ptr == 1 && + info->path_dst_ptr_to_static_ptr == not_public_path) + info->search_done = true; + } } } else @@ -1030,13 +1031,13 @@ __si_class_type_info::search_below_dst(_ // Record the access path that got us here // If there is more than one dst_type this path doesn't matter. info->path_dynamic_ptr_to_dst_ptr = path_below; +bool does_dst_type_point_to_our_static_type = false;
r332799 - [Clang Tablegen][RFC] Allow Early Textual Substitutions in `Diagnostic` messages.
Author: ericwf Date: Fri May 18 20:12:04 2018 New Revision: 332799 URL: http://llvm.org/viewvc/llvm-project?rev=332799&view=rev Log: [Clang Tablegen][RFC] Allow Early Textual Substitutions in `Diagnostic` messages. Summary: There are cases where the same string or select is repeated verbatim in a lot of diagnostics. This can be a pain to maintain and update. Tablegen provides no way stash the common text somewhere and reuse it in the diagnostics, until now! This patch allows diagnostic texts to contain `%sub{}`, where `` names a Tablegen record of type `TextSubstitution`. These substitutions are done early, before the diagnostic string is otherwise processed. All `%sub` modifiers will be replaced before the diagnostic definitions are emitted. The substitution must specify all arguments used by the substitution, and modifier indexes in the substitution are re-numbered accordingly. For example: ``` def select_ovl_candidate : TextSubstitution<"%select{function|constructor}0%select{| template| %2}1">; ``` when used as ``` "candidate `%sub{select_ovl_candidate}3,2,1 not viable" ``` will act as if we wrote: ``` "candidate %select{function|constructor}3%select{| template| %1}2 not viable" ``` Reviewers: rsmith, rjmccall, aaron.ballman, a.sidorin Reviewed By: rjmccall Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D46740 Added: cfe/trunk/test/TableGen/DiagnosticDocs.inc cfe/trunk/test/TableGen/emit-diag-docs.td cfe/trunk/test/TableGen/text-substitution.td Modified: cfe/trunk/docs/InternalsManual.rst cfe/trunk/include/clang/Basic/Diagnostic.td cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td cfe/trunk/test/SemaCXX/anonymous-struct.cpp cfe/trunk/test/SemaCXX/cxx98-compat.cpp cfe/trunk/test/TableGen/DiagnosticBase.inc cfe/trunk/test/lit.cfg.py cfe/trunk/utils/TableGen/ClangDiagnosticsEmitter.cpp Modified: cfe/trunk/docs/InternalsManual.rst URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/InternalsManual.rst?rev=332799&r1=332798&r2=332799&view=diff == --- cfe/trunk/docs/InternalsManual.rst (original) +++ cfe/trunk/docs/InternalsManual.rst Fri May 18 20:12:04 2018 @@ -319,6 +319,32 @@ they should be discussed before they are repetitive diagnostics and/or have an idea for a useful formatter, please bring it up on the cfe-dev mailing list. +**"sub" format** + +Example: + Given the following record definition of type ``TextSubstitution``: + + .. code-block:: text + +def select_ovl_candidate : TextSubstitution< + "%select{function|constructor}0%select{| template| %2}1">; + + which can be used as + + .. code-block:: text + +def note_ovl_candidate : Note< + "candidate %sub{select_ovl_candidate}3,2,1 not viable">; + + and will act as if it was written + ``"candidate %select{function|constructor}3%select{| template| %1}2 not viable"``. +Description: + This format specifier is used to avoid repeating strings verbatim in multiple + diagnostics. The argument to ``%sub`` must name a ``TextSubstitution`` tblgen + record. The substitution must specify all arguments used by the substitution, + and the modifier indexes in the substitution are re-numbered accordingly. The + substituted text must itself be a valid format string before substitution. + .. _internals-producing-diag: Producing the Diagnostic Modified: cfe/trunk/include/clang/Basic/Diagnostic.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Diagnostic.td?rev=332799&r1=332798&r2=332799&view=diff == --- cfe/trunk/include/clang/Basic/Diagnostic.td (original) +++ cfe/trunk/include/clang/Basic/Diagnostic.td Fri May 18 20:12:04 2018 @@ -39,6 +39,15 @@ def SFINAE_Suppress: SFINAER def SFINAE_Report : SFINAEResponse; def SFINAE_AccessControl : SFINAEResponse; +// Textual substitutions which may be performed on the text of diagnostics +class TextSubstitution { + string Substitution = Text; + // TODO: These are only here to allow substitutions to be declared inline with + // diagnostics + string Component = ""; + string CategoryName = ""; +} + // Diagnostic Categories. These can be applied to groups or individual // diagnostics to specify a category. class DiagCategory { Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=332799&r1=332798&r2=332799&view=diff == --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original) +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Fri May 18 20:12:04 2018 @@ -1622,13 +1622,16 @@ def warn_call_to_pure_virtual_member_fun "overrides of %0 in subclasses are not available in the " "%select
r332800 - Adjust and fix failing CXX tests after r332799
Author: ericwf Date: Fri May 18 20:33:56 2018 New Revision: 332800 URL: http://llvm.org/viewvc/llvm-project?rev=332800&view=rev Log: Adjust and fix failing CXX tests after r332799 Modified: cfe/trunk/test/CXX/class/class.union/p1.cpp cfe/trunk/test/CXX/drs/dr5xx.cpp Modified: cfe/trunk/test/CXX/class/class.union/p1.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/class/class.union/p1.cpp?rev=332800&r1=332799&r2=332800&view=diff == --- cfe/trunk/test/CXX/class/class.union/p1.cpp (original) +++ cfe/trunk/test/CXX/class/class.union/p1.cpp Fri May 18 20:33:56 2018 @@ -38,9 +38,9 @@ class Dtor { union U1 { Virtual v; // expected-error {{union member 'v' has a non-trivial copy constructor}} VirtualBase vbase; // expected-error {{union member 'vbase' has a non-trivial copy constructor}} - Ctor ctor; // expected-error {{union member 'ctor' has a non-trivial constructor}} - Ctor2 ctor2; // expected-error {{union member 'ctor2' has a non-trivial constructor}} - CtorTmpl ctortmpl; // expected-error {{union member 'ctortmpl' has a non-trivial constructor}} + Ctor ctor; // expected-error {{union member 'ctor' has a non-trivial default constructor}} + Ctor2 ctor2; // expected-error {{union member 'ctor2' has a non-trivial default constructor}} + CtorTmpl ctortmpl; // expected-error {{union member 'ctortmpl' has a non-trivial default constructor}} CopyCtor copyctor; // expected-error {{union member 'copyctor' has a non-trivial copy constructor}} CopyAssign copyassign; // expected-error {{union member 'copyassign' has a non-trivial copy assignment operator}} Dtor dtor; // expected-error {{union member 'dtor' has a non-trivial destructor}} @@ -56,10 +56,10 @@ union U2 { } m2; // expected-error {{union member 'm2' has a non-trivial copy constructor}} struct { Ctor ctor; // expected-note {{because field of type 'Ctor' has a user-provided default constructor}} - } m3; // expected-error {{union member 'm3' has a non-trivial constructor}} + } m3; // expected-error {{union member 'm3' has a non-trivial default constructor}} struct { Ctor2 ctor2; // expected-note {{because field of type 'Ctor2' has a user-provided default constructor}} - } m3a; // expected-error {{union member 'm3a' has a non-trivial constructor}} + } m3a; // expected-error {{union member 'm3a' has a non-trivial default constructor}} struct { // expected-note {{no constructor can be used to copy an object of type 'const}} CopyCtor copyctor; } m4; // expected-error {{union member 'm4' has a non-trivial copy constructor}} @@ -80,9 +80,9 @@ union U3 { struct s2 : VirtualBase { // expected-note {{because the function selected to copy base class of type 'VirtualBase' is not trivial}} } m2; // expected-error {{union member 'm2' has a non-trivial copy constructor}} struct s3 : Ctor { // expected-note {{because base class of type 'Ctor' has a user-provided default constructor}} - } m3; // expected-error {{union member 'm3' has a non-trivial constructor}} + } m3; // expected-error {{union member 'm3' has a non-trivial default constructor}} struct s3a : Ctor2 { // expected-note {{because base class of type 'Ctor2' has a user-provided default constructor}} - } m3a; // expected-error {{union member 'm3a' has a non-trivial constructor}} + } m3a; // expected-error {{union member 'm3a' has a non-trivial default constructor}} struct s4 : CopyCtor { // expected-note {{because no constructor can be used to copy an object of type 'const U3::s4'}} } m4; // expected-error {{union member 'm4' has a non-trivial copy constructor}} struct s5 : CopyAssign { // expected-note {{because no assignment operator can be used to copy an object of type 'const U3::s5'}} @@ -93,7 +93,7 @@ union U3 { } m7; struct s8 { s8(...) = delete; // expected-note {{because it is a variadic function}} expected-warning {{C++11}} - } m8; // expected-error {{union member 'm8' has a non-trivial constructor}} + } m8; // expected-error {{union member 'm8' has a non-trivial default constructor}} }; union U4 { Modified: cfe/trunk/test/CXX/drs/dr5xx.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/drs/dr5xx.cpp?rev=332800&r1=332799&r2=332800&view=diff == --- cfe/trunk/test/CXX/drs/dr5xx.cpp (original) +++ cfe/trunk/test/CXX/drs/dr5xx.cpp Fri May 18 20:33:56 2018 @@ -74,7 +74,7 @@ namespace dr512 { // dr512: yes }; union U { A a; }; #if __cplusplus < 201103L - // expected-error@-2 {{has a non-trivial constructor}} + // expected-error@-2 {{has a non-trivial default constructor}} // expected-note@-6 {{no default constructor}} // expected-note@-6 {{suppressed by user-declared constructor}} #endif ___ cfe-commits mailing list cfe-commits@lists.llvm
[libcxx] r333384 - LWG 2969 "polymorphic_allocator::construct() shouldn't pass resource()"
Author: ericwf Date: Mon May 28 17:08:47 2018 New Revision: 84 URL: http://llvm.org/viewvc/llvm-project?rev=84&view=rev Log: LWG 2969 "polymorphic_allocator::construct() shouldn't pass resource()" Patch from Arthur O'Dwyer. In the TS, `uses_allocator` construction for `pair` tried to use an allocator type of `memory_resource*`, which is incorrect because `memory_resource*` is not an allocator type. LWG 2969 fixed it to use `polymorphic_allocator` as the allocator type instead. https://wg21.link/lwg2969 (D47090 included this in ``; at Eric's request, I've split this out into its own patch applied to the existing `` instead.) Reviewed as https://reviews.llvm.org/D47109 Added: libcxx/trunk/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_piecewise_pair_evil.pass.cpp Modified: libcxx/trunk/include/experimental/memory_resource libcxx/trunk/test/libcxx/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_piecewise_pair.pass.cpp libcxx/trunk/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_pair_const_lvalue_pair.pass.cpp libcxx/trunk/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_pair_rvalue.pass.cpp libcxx/trunk/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_pair_values.pass.cpp libcxx/trunk/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_piecewise_pair.pass.cpp libcxx/trunk/test/std/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_types.pass.cpp libcxx/trunk/test/support/test_memory_resource.hpp Modified: libcxx/trunk/include/experimental/memory_resource URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/experimental/memory_resource?rev=84&r1=83&r2=84&view=diff == --- libcxx/trunk/include/experimental/memory_resource (original) +++ libcxx/trunk/include/experimental/memory_resource Mon May 28 17:08:47 2018 @@ -206,7 +206,7 @@ public: void construct(_Tp* __p, _Ts &&... __args) { _VSTD_LFTS::__lfts_user_alloc_construct( -__p, resource(), _VSTD::forward<_Ts>(__args)... +__p, *this, _VSTD::forward<_Ts>(__args)... ); } @@ -218,14 +218,14 @@ public: ::new ((void*)__p) pair<_T1, _T2>(piecewise_construct , __transform_tuple( typename __lfts_uses_alloc_ctor< - _T1, memory_resource*, _Args1... + _T1, polymorphic_allocator&, _Args1... >::type() , _VSTD::move(__x) , typename __make_tuple_indices::type{} ) , __transform_tuple( typename __lfts_uses_alloc_ctor< - _T2, memory_resource*, _Args2... + _T2, polymorphic_allocator&, _Args2... >::type() , _VSTD::move(__y) , typename __make_tuple_indices::type{} @@ -289,23 +289,23 @@ private: template _LIBCPP_INLINE_VISIBILITY -tuple +tuple __transform_tuple(integral_constant, tuple<_Args...> && __t, - __tuple_indices<_Idx...>) const + __tuple_indices<_Idx...>) { -using _Tup = tuple; -return _Tup(allocator_arg, resource(), +using _Tup = tuple; +return _Tup(allocator_arg, *this, _VSTD::get<_Idx>(_VSTD::move(__t))...); } template _LIBCPP_INLINE_VISIBILITY -tuple<_Args&&..., memory_resource*> +tuple<_Args&&..., polymorphic_allocator&> __transform_tuple(integral_constant, tuple<_Args...> && __t, - __tuple_indices<_Idx...>) const + __tuple_indices<_Idx...>) { -using _Tup = tuple<_Args&&..., memory_resource*>; -return _Tup(_VSTD::get<_Idx>(_VSTD::move(__t))..., resource()); +using _Tup = tuple<_Args&&..., polymorphic_allocator&>; +return _Tup(_VSTD::get<_Idx>(_VSTD::move(__t))..., *this); } _LIBCPP_INLINE_VISIBILITY Modified: libcxx/trunk/test/libcxx/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_piecewise_pair.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_piecewise_pair.pass.cpp?rev=84&r1=83&r2=84&view=diff == --- libcxx/trunk/test/libcxx/experimental/memory/memory.polymorphic.allocator.class/memory.polymorphic.allocator.mem/construct_piecewise_pair.pass.cpp (origina
r333485 - [Sema] Use %sub to cleanup overload diagnostics
Author: ericwf Date: Tue May 29 18:00:41 2018 New Revision: 333485 URL: http://llvm.org/viewvc/llvm-project?rev=333485&view=rev Log: [Sema] Use %sub to cleanup overload diagnostics Summary: This patch adds the newly added `%sub` diagnostic modifier to cleanup repetition in the overload candidate diagnostics. I think this should be good to go. @rsmith: Some of the notes now emit `function template` where they only said `function` previously. It seems OK to me, but I would like your sign off on it. Reviewers: rsmith, EricWF Reviewed By: EricWF Subscribers: cfe-commits, rsmith Differential Revision: https://reviews.llvm.org/D47101 Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td cfe/trunk/lib/Sema/SemaOverload.cpp cfe/trunk/test/CXX/drs/dr4xx.cpp cfe/trunk/test/CXX/special/class.inhctor/p1.cpp cfe/trunk/test/SemaCXX/attr-noreturn.cpp cfe/trunk/test/SemaCXX/cxx1y-generic-lambdas.cpp cfe/trunk/test/SemaCXX/overload-call.cpp cfe/trunk/test/SemaCXX/overload-member-call.cpp Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=333485&r1=333484&r2=333485&view=diff == --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original) +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Tue May 29 18:00:41 2018 @@ -3525,27 +3525,29 @@ def err_ovl_deleted_member_call : Error< def note_ovl_too_many_candidates : Note< "remaining %0 candidate%s0 omitted; " "pass -fshow-overloads=all to show them">; -def note_ovl_candidate : Note<"candidate " -"%select{function|function|constructor|" -"function |function |constructor |" -"is the implicit default constructor|" -"is the implicit copy constructor|" -"is the implicit move constructor|" -"is the implicit copy assignment operator|" -"is the implicit move assignment operator|" -"inherited constructor|" -"inherited constructor }0%2" -"%select{| has different class%diff{ (expected $ but has $)|}4,5" -"| has different number of parameters (expected %4 but has %5)" -"| has type mismatch at %ordinal4 parameter" -"%diff{ (expected $ but has $)|}5,6" -"| has different return type%diff{ ($ expected but has $)|}4,5" + +def select_ovl_candidate_kind : TextSubstitution< + "%select{function|function|constructor|" +"constructor (the implicit default constructor)|" +"constructor (the implicit copy constructor)|" +"constructor (the implicit move constructor)|" +"function (the implicit copy assignment operator)|" +"function (the implicit move assignment operator)|" +"inherited constructor}0%select{| template| %2}1">; + +def note_ovl_candidate : Note< +"candidate %sub{select_ovl_candidate_kind}0,1,3" +"%select{| has different class%diff{ (expected $ but has $)|}5,6" +"| has different number of parameters (expected %5 but has %6)" +"| has type mismatch at %ordinal5 parameter" +"%diff{ (expected $ but has $)|}6,7" +"| has different return type%diff{ ($ expected but has $)|}5,6" "| has different qualifiers (expected " "%select{none|const|restrict|const and restrict|volatile|const and volatile" -"|volatile and restrict|const, volatile, and restrict}4 but found " +"|volatile and restrict|const, volatile, and restrict}5 but found " "%select{none|const|restrict|const and restrict|volatile|const and volatile" -"|volatile and restrict|const, volatile, and restrict}5)" -"| has different exception specification}3">; +"|volatile and restrict|const, volatile, and restrict}6)" +"| has different exception specification}4">; def note_ovl_candidate_inherited_constructor : Note< "constructor from base class %0 inherited here">; @@ -3615,225 +3617,97 @@ def note_ovl_candidate_non_deduced_misma // Note that we don't treat templates differently for this diagnostic. def note_ovl_candidate_arity : Note<"candidate " -"%select{function|function|constructor|function|function|constructor|" -"constructor (the implicit default constructor)|" -"constructor (the implicit copy constructor)|" -"constructor (the implicit move constructor)|" -"function (the implicit copy assignment operator)|" -"function (the implicit move assignment operator)|" -"inherited constructor|" -"inherited constructor}0 %select{|template }1" -"not viable: requires%select{ at least| at most|}2 %3 argument%s3, but %4 " -"%plural{1:was|:were}4 provided">; +"%sub{select_ovl_candidate_kind}0,1,2 not viable: " +"requires%select{ at least| at most|}3 %4 argument%s4, but %5 " +"%plural{1:was|:were}5 provided">; def note_ovl_candidate_arity_one : Note<"candidate " -"%select{function|function|constructor|function|function|constructor|" -"constructor (the implicit default constructor)|" -
r333488 - Fix test failure after r333485.
Author: ericwf Date: Tue May 29 18:22:14 2018 New Revision: 333488 URL: http://llvm.org/viewvc/llvm-project?rev=333488&view=rev Log: Fix test failure after r333485. I missed adjusting a test under Misc in the last commit. This patch updates that test. Modified: cfe/trunk/test/Misc/diag-template-diffing.cpp Modified: cfe/trunk/test/Misc/diag-template-diffing.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Misc/diag-template-diffing.cpp?rev=333488&r1=333487&r2=333488&view=diff == --- cfe/trunk/test/Misc/diag-template-diffing.cpp (original) +++ cfe/trunk/test/Misc/diag-template-diffing.cpp Tue May 29 18:22:14 2018 @@ -1265,7 +1265,7 @@ void test() { foo>(X); } // CHECK-ELIDE-NOTREE: no matching function for call to 'foo' -// CHECK-ELIDE-NOTREE: candidate function not viable: no known conversion from 'BoolT' to 'BoolT' for 1st argument +// CHECK-ELIDE-NOTREE: candidate function template not viable: no known conversion from 'BoolT' to 'BoolT' for 1st argument } namespace DifferentIntegralTypes { ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: r333485 - [Sema] Use %sub to cleanup overload diagnostics
Sorry for the breakage. Fix incoming as soon as my test suite run completes. On Tue, May 29, 2018 at 7:00 PM, Eric Fiselier via cfe-commits < cfe-commits@lists.llvm.org> wrote: > Author: ericwf > Date: Tue May 29 18:00:41 2018 > New Revision: 333485 > > URL: http://llvm.org/viewvc/llvm-project?rev=333485&view=rev > Log: > [Sema] Use %sub to cleanup overload diagnostics > > Summary: > This patch adds the newly added `%sub` diagnostic modifier to cleanup > repetition in the overload candidate diagnostics. > > I think this should be good to go. > > @rsmith: Some of the notes now emit `function template` where they only > said `function` previously. It seems OK to me, but I would like your sign > off on it. > > > Reviewers: rsmith, EricWF > > Reviewed By: EricWF > > Subscribers: cfe-commits, rsmith > > Differential Revision: https://reviews.llvm.org/D47101 > > Modified: > cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td > cfe/trunk/lib/Sema/SemaOverload.cpp > cfe/trunk/test/CXX/drs/dr4xx.cpp > cfe/trunk/test/CXX/special/class.inhctor/p1.cpp > cfe/trunk/test/SemaCXX/attr-noreturn.cpp > cfe/trunk/test/SemaCXX/cxx1y-generic-lambdas.cpp > cfe/trunk/test/SemaCXX/overload-call.cpp > cfe/trunk/test/SemaCXX/overload-member-call.cpp > > Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td > URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/ > DiagnosticSemaKinds.td?rev=333485&r1=333484&r2=333485&view=diff > > == > --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original) > +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Tue May 29 > 18:00:41 2018 > @@ -3525,27 +3525,29 @@ def err_ovl_deleted_member_call : Error< > def note_ovl_too_many_candidates : Note< > "remaining %0 candidate%s0 omitted; " > "pass -fshow-overloads=all to show them">; > -def note_ovl_candidate : Note<"candidate " > -"%select{function|function|constructor|" > -"function |function |constructor |" > -"is the implicit default constructor|" > -"is the implicit copy constructor|" > -"is the implicit move constructor|" > -"is the implicit copy assignment operator|" > -"is the implicit move assignment operator|" > -"inherited constructor|" > -"inherited constructor }0%2" > -"%select{| has different class%diff{ (expected $ but has $)|}4,5" > -"| has different number of parameters (expected %4 but has %5)" > -"| has type mismatch at %ordinal4 parameter" > -"%diff{ (expected $ but has $)|}5,6" > -"| has different return type%diff{ ($ expected but has $)|}4,5" > + > +def select_ovl_candidate_kind : TextSubstitution< > + "%select{function|function|constructor|" > +"constructor (the implicit default constructor)|" > +"constructor (the implicit copy constructor)|" > +"constructor (the implicit move constructor)|" > +"function (the implicit copy assignment operator)|" > +"function (the implicit move assignment operator)|" > +"inherited constructor}0%select{| template| %2}1">; > + > +def note_ovl_candidate : Note< > +"candidate %sub{select_ovl_candidate_kind}0,1,3" > +"%select{| has different class%diff{ (expected $ but has $)|}5,6" > +"| has different number of parameters (expected %5 but has %6)" > +"| has type mismatch at %ordinal5 parameter" > +"%diff{ (expected $ but has $)|}6,7" > +"| has different return type%diff{ ($ expected but has $)|}5,6" > "| has different qualifiers (expected " > "%select{none|const|restrict|const and restrict|volatile|const and > volatile" > -"|volatile and restrict|const, volatile, and restrict}4 but found " > +"|volatile and restrict|const, volatile, and restrict}5 but found " > "%select{none|const|restrict|const and restrict|volatile|const and > volatile" > -"|volatile and restrict|const, volatile, and restrict}5)" > -"| has different exception specification}3">; > +"|volatile and restrict|const, volatile, and restrict}6)" > +"| has different exception specification}4">; > > def note_ovl_candidate_inherited_constructor : Note< > "constructor from base class %0 inherited here">; > @
r333491 - Fix test failure after r333485. Try 2.
Author: ericwf Date: Tue May 29 19:20:40 2018 New Revision: 333491 URL: http://llvm.org/viewvc/llvm-project?rev=333491&view=rev Log: Fix test failure after r333485. Try 2. Sorry for the breakage. Modified: cfe/trunk/test/Misc/diag-template-diffing.cpp Modified: cfe/trunk/test/Misc/diag-template-diffing.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Misc/diag-template-diffing.cpp?rev=333491&r1=333490&r2=333491&view=diff == --- cfe/trunk/test/Misc/diag-template-diffing.cpp (original) +++ cfe/trunk/test/Misc/diag-template-diffing.cpp Tue May 29 19:20:40 2018 @@ -1401,7 +1401,7 @@ void run() { f(1, integral_constant{}); } // CHECK-ELIDE-NOTREE: error: no matching function for call to 'f' -// CHECK-ELIDE-NOTREE: note: candidate function not viable: no known conversion from 'integral_constant<[...], true>' to 'integral_constant<[...], false>' for 2nd argument +// CHECK-ELIDE-NOTREE: note: candidate function template not viable: no known conversion from 'integral_constant<[...], true>' to 'integral_constant<[...], false>' for 2nd argument } namespace ZeroArgs { @@ -1454,7 +1454,7 @@ void run() { D(VectorType()); } // CHECK-ELIDE-NOTREE: error: no matching function for call to 'D' -// CHECK-ELIDE-NOTREE: note: candidate function not viable: no known conversion from 'VectorType' to 'const VectorType<(TypeAlias::X)0>' for 1st argument +// CHECK-ELIDE-NOTREE: note: candidate function template not viable: no known conversion from 'VectorType' to 'const VectorType<(TypeAlias::X)0>' for 1st argument } namespace TypeAlias2 { ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r314735 - Improve test runner output for broken configurations.
Author: ericwf Date: Mon Oct 2 15:52:51 2017 New Revision: 314735 URL: http://llvm.org/viewvc/llvm-project?rev=314735&view=rev Log: Improve test runner output for broken configurations. Previously LIT would often fail while attempting to set up/configure the test compiler; normally when attempting to dump the builtin macros. This sort of failure provided no useful information about what went wrong with the compiler, making the actual issues hard --- if not impossible --- to debug easily. This patch changes the LIT configuration to report the failure explicitly, including the failed compile command and the stdout/stderr output. Modified: libcxx/trunk/utils/libcxx/compiler.py libcxx/trunk/utils/libcxx/test/config.py Modified: libcxx/trunk/utils/libcxx/compiler.py URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/utils/libcxx/compiler.py?rev=314735&r1=314734&r2=314735&view=diff == --- libcxx/trunk/utils/libcxx/compiler.py (original) +++ libcxx/trunk/utils/libcxx/compiler.py Mon Oct 2 15:52:51 2017 @@ -204,7 +204,7 @@ class CXXCompiler(object): flags = ['-dM'] + flags cmd, out, err, rc = self.preprocess(source_files, flags=flags, cwd=cwd) if rc != 0: -return None +return cmd, out, err, rc parsed_macros = {} lines = [l.strip() for l in out.split('\n') if l.strip()] for l in lines: Modified: libcxx/trunk/utils/libcxx/test/config.py URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/utils/libcxx/test/config.py?rev=314735&r1=314734&r2=314735&view=diff == --- libcxx/trunk/utils/libcxx/test/config.py (original) +++ libcxx/trunk/utils/libcxx/test/config.py Mon Oct 2 15:52:51 2017 @@ -259,6 +259,16 @@ class Configuration(object): compile_flags=compile_flags, link_flags=link_flags) +def _dump_macros_verbose(self, *args, **kwargs): +macros_or_error = self.cxx.dumpMacros(*args, **kwargs) +if isinstance(macros_or_error, tuple): +cmd, out, err, rc = macros_or_error +report = libcxx.util.makeReport(cmd, out, err, rc) +report += "Compiler failed unexpectedly when dumping macros!" +self.lit_config.fatal(report) +return None +assert isinstance(macros_or_error, dict) +return macros_or_error def configure_src_root(self): self.libcxx_src_root = self.get_lit_conf( @@ -446,7 +456,7 @@ class Configuration(object): if self.get_lit_bool('has_libatomic', False): self.config.available_features.add('libatomic') -macros = self.cxx.dumpMacros() +macros = self._dump_macros_verbose() if '__cpp_if_constexpr' not in macros: self.config.available_features.add('libcpp-no-if-constexpr') @@ -468,7 +478,7 @@ class Configuration(object): # Attempt to detect the glibc version by querying for __GLIBC__ # in 'features.h'. -macros = self.cxx.dumpMacros(flags=['-include', 'features.h']) +macros = self._dump_macros_verbose(flags=['-include', 'features.h']) if macros is not None and '__GLIBC__' in macros: maj_v, min_v = (macros['__GLIBC__'], macros['__GLIBC_MINOR__']) self.config.available_features.add('glibc') @@ -627,8 +637,8 @@ class Configuration(object): """ # Parse the macro contents of __config_site by dumping the macros # using 'c++ -dM -E' and filtering the predefines. -predefines = self.cxx.dumpMacros() -macros = self.cxx.dumpMacros(header) +predefines = self._dump_macros_verbose() +macros = self._dump_macros_verbose(header) feature_macros_keys = set(macros.keys()) - set(predefines.keys()) feature_macros = {} for k in feature_macros_keys: @@ -980,7 +990,7 @@ class Configuration(object): def configure_coroutines(self): if self.cxx.hasCompileFlag('-fcoroutines-ts'): -macros = self.cxx.dumpMacros(flags=['-fcoroutines-ts']) +macros = self._dump_macros_verbose(flags=['-fcoroutines-ts']) if '__cpp_coroutines' not in macros: self.lit_config.warning('-fcoroutines-ts is supported but ' '__cpp_coroutines is not defined') ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r314755 - Fix test suite misconfiguration on OS X
Author: ericwf Date: Mon Oct 2 19:25:05 2017 New Revision: 314755 URL: http://llvm.org/viewvc/llvm-project?rev=314755&view=rev Log: Fix test suite misconfiguration on OS X Modified: libcxx/trunk/utils/libcxx/test/config.py Modified: libcxx/trunk/utils/libcxx/test/config.py URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/utils/libcxx/test/config.py?rev=314755&r1=314754&r2=314755&view=diff == --- libcxx/trunk/utils/libcxx/test/config.py (original) +++ libcxx/trunk/utils/libcxx/test/config.py Mon Oct 2 19:25:05 2017 @@ -478,8 +478,8 @@ class Configuration(object): # Attempt to detect the glibc version by querying for __GLIBC__ # in 'features.h'. -macros = self._dump_macros_verbose(flags=['-include', 'features.h']) -if macros is not None and '__GLIBC__' in macros: +macros = self.cxx.dumpMacros(flags=['-include', 'features.h']) +if isinstance(macros, dict) and '__GLIBC__' in macros: maj_v, min_v = (macros['__GLIBC__'], macros['__GLIBC_MINOR__']) self.config.available_features.add('glibc') self.config.available_features.add('glibc-%s' % maj_v) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r314864 - Add C++17 explicit deduction guides to std::pair.
Author: ericwf Date: Tue Oct 3 17:04:26 2017 New Revision: 314864 URL: http://llvm.org/viewvc/llvm-project?rev=314864&view=rev Log: Add C++17 explicit deduction guides to std::pair. This patch adds the newly standardized deduction guides for std::pair, allowing it to work class template deduction. Added: libcxx/trunk/test/std/utilities/utility/pairs/pairs.pair/implicit_deduction_guides.pass.cpp Modified: libcxx/trunk/include/tuple libcxx/trunk/include/utility libcxx/trunk/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/implicit_deduction_guides.pass.cpp Modified: libcxx/trunk/include/tuple URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/tuple?rev=314864&r1=314863&r2=314864&view=diff == --- libcxx/trunk/include/tuple (original) +++ libcxx/trunk/include/tuple Tue Oct 3 17:04:26 2017 @@ -929,7 +929,7 @@ public: void swap(tuple&) _NOEXCEPT {} }; -#ifdef __cpp_deduction_guides +#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES // NOTE: These are not yet standardized, but are required to simulate the // implicit deduction guide that should be generated had libc++ declared the // tuple-like constructors "correctly" Modified: libcxx/trunk/include/utility URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/utility?rev=314864&r1=314863&r2=314864&view=diff == --- libcxx/trunk/include/utility (original) +++ libcxx/trunk/include/utility Tue Oct 3 17:04:26 2017 @@ -545,6 +545,11 @@ private: #endif }; +#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES +template +pair(_T1, _T2) -> pair<_T1, _T2>; +#endif // _LIBCPP_HAS_NO_DEDUCTION_GUIDES + template inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 bool Modified: libcxx/trunk/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/implicit_deduction_guides.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/implicit_deduction_guides.pass.cpp?rev=314864&r1=314863&r2=314864&view=diff == --- libcxx/trunk/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/implicit_deduction_guides.pass.cpp (original) +++ libcxx/trunk/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/implicit_deduction_guides.pass.cpp Tue Oct 3 17:04:26 2017 @@ -15,10 +15,11 @@ // against libstdc++. // XFAIL: gcc -// +// -// Test that the constructors offered by std::basic_string are formulated -// so they're compatible with implicit deduction guides. +// Test that the constructors offered by std::tuple are formulated +// so they're compatible with implicit deduction guides, or if that's not +// possible that they provide explicit guides to make it work. #include #include Added: libcxx/trunk/test/std/utilities/utility/pairs/pairs.pair/implicit_deduction_guides.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/utility/pairs/pairs.pair/implicit_deduction_guides.pass.cpp?rev=314864&view=auto == --- libcxx/trunk/test/std/utilities/utility/pairs/pairs.pair/implicit_deduction_guides.pass.cpp (added) +++ libcxx/trunk/test/std/utilities/utility/pairs/pairs.pair/implicit_deduction_guides.pass.cpp Tue Oct 3 17:04:26 2017 @@ -0,0 +1,80 @@ +//===--===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===--===// + +// UNSUPPORTED: c++98, c++03, c++11, c++14 +// UNSUPPORTED: libcpp-no-deduction-guides + +// GCC's implementation of class template deduction is still immature and runs +// into issues with libc++. However GCC accepts this code when compiling +// against libstdc++. +// XFAIL: gcc + +// + +// Test that the constructors offered by std::pair are formulated +// so they're compatible with implicit deduction guides, or if that's not +// possible that they provide explicit guides to make it work. + +#include +#include +#include +#include + +#include "test_macros.h" +#include "archetypes.hpp" + + +// Overloads +// --- +// (1) pair(const T1&, const T2&) -> pair +// (2) explicit pair(const T1&, const T2&) -> pair +// (3) pair(pair const& t) -> decltype(t) +// (4) pair(pair&& t) -> decltype(t) +// (5) pair(pair const&) -> pair +// (6) explicit pair(pair const&) -> pair +// (7) pair(pair &&) -> pair +// (8) explicit pair(pair &&) -> pair +int main() +{ + using E = ExplicitTestTypes::TestType; + static_assert(!std::is_convertible::value, ""); + { // Testing (1) +int const x = 42; +std::pair t1("abc", x); +ASSERT_SAME_TYPE(declty
[libcxx] r314947 - Fix accidental assignment inside test asserts
Author: ericwf Date: Wed Oct 4 16:21:18 2017 New Revision: 314947 URL: http://llvm.org/viewvc/llvm-project?rev=314947&view=rev Log: Fix accidental assignment inside test asserts Modified: libcxx/trunk/test/std/utilities/utility/pairs/pairs.pair/const_pair_U_V.pass.cpp libcxx/trunk/test/std/utilities/utility/pairs/pairs.pair/rv_pair_U_V.pass.cpp Modified: libcxx/trunk/test/std/utilities/utility/pairs/pairs.pair/const_pair_U_V.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/utility/pairs/pairs.pair/const_pair_U_V.pass.cpp?rev=314947&r1=314946&r2=314947&view=diff == --- libcxx/trunk/test/std/utilities/utility/pairs/pairs.pair/const_pair_U_V.pass.cpp (original) +++ libcxx/trunk/test/std/utilities/utility/pairs/pairs.pair/const_pair_U_V.pass.cpp Wed Oct 4 16:21:18 2017 @@ -71,7 +71,7 @@ int main() P1 p1(42, 101); P2 p2(p1); assert(p2.first == 42); -assert(p2.second = 101); +assert(p2.second == 101); } { test_pair_const(); // copy construction Modified: libcxx/trunk/test/std/utilities/utility/pairs/pairs.pair/rv_pair_U_V.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/utility/pairs/pairs.pair/rv_pair_U_V.pass.cpp?rev=314947&r1=314946&r2=314947&view=diff == --- libcxx/trunk/test/std/utilities/utility/pairs/pairs.pair/rv_pair_U_V.pass.cpp (original) +++ libcxx/trunk/test/std/utilities/utility/pairs/pairs.pair/rv_pair_U_V.pass.cpp Wed Oct 4 16:21:18 2017 @@ -81,7 +81,7 @@ int main() P1 p1(42, 101); P2 p2(std::move(p1)); assert(p2.first == 42); -assert(p2.second = 101); +assert(p2.second == 101); } { test_pair_rv(); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [libcxx] r314949 - [libc++] Allow users to explicitly specify ABI
On Wed, Oct 4, 2017 at 5:44 PM, Shoaib Meenai via cfe-commits < cfe-commits@lists.llvm.org> wrote: > Author: smeenai > Date: Wed Oct 4 16:44:38 2017 > New Revision: 314949 > > URL: http://llvm.org/viewvc/llvm-project?rev=314949&view=rev > Log: > [libc++] Allow users to explicitly specify ABI > > libc++'s current heuristic for detecting Itanium vs. Microsoft ABI falls > short in some cases. For example, it will detect windows-itanium targets > as using the Microsoft ABI, since they set `_MSC_VER` (for compatibility > with Microsoft headers). Leave the current heuristic in place by default > but also allow users to explicitly specify the ABI if need be. > > Modified: > libcxx/trunk/CMakeLists.txt > libcxx/trunk/include/__config > libcxx/trunk/include/__config_site.in > > Modified: libcxx/trunk/CMakeLists.txt > URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/ > CMakeLists.txt?rev=314949&r1=314948&r2=314949&view=diff > > == > --- libcxx/trunk/CMakeLists.txt (original) > +++ libcxx/trunk/CMakeLists.txt Wed Oct 4 16:44:38 2017 > @@ -99,6 +99,8 @@ cmake_dependent_option(LIBCXX_INSTALL_EX > "LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY;LIBCXX_INSTALL_LIBRARY" OFF) > set(LIBCXX_ABI_VERSION 1 CACHE STRING "ABI version of libc++.") > option(LIBCXX_ABI_UNSTABLE "Unstable ABI of libc++." OFF) > +option(LIBCXX_ABI_ITANIUM "Ignore auto-detection and force use of the > Itanium ABI.") > +option(LIBCXX_ABI_MICROSOFT "Ignore auto-detection and force use of the > Microsoft ABI.") > Shouldn't these specify a default option? > option(LIBCXX_USE_COMPILER_RT "Use compiler-rt instead of libgcc" OFF) > > if (NOT LIBCXX_ENABLE_SHARED AND NOT LIBCXX_ENABLE_STATIC) > @@ -337,6 +339,10 @@ if (LIBCXX_HAS_MUSL_LIBC AND NOT LIBCXX_ >"when building for Musl with LIBCXX_HAS_MUSL_LIBC.") > endif() > > +if (LIBCXX_ABI_ITANIUM AND LIBCXX_ABI_MICROSOFT) > + message(FATAL_ERROR "Only one of LIBCXX_ABI_ITANIUM and > LIBCXX_ABI_MICROSOFT can be specified.") > +endif () > + > #=== > > # Configure System > #=== > > @@ -594,6 +600,8 @@ if (NOT LIBCXX_ABI_VERSION EQUAL "1") >config_define(${LIBCXX_ABI_VERSION} _LIBCPP_ABI_VERSION) > endif() > config_define_if(LIBCXX_ABI_UNSTABLE _LIBCPP_ABI_UNSTABLE) > +config_define_if(LIBCXX_ABI_ITANIUM _LIBCPP_ABI_ITANIUM) > +config_define_if(LIBCXX_ABI_MICROSOFT _LIBCPP_ABI_MICROSOFT) > > I'm not a fan of the direction this is going in. It seems to require the generation and use of a __config_site header in all cases where it's used. I don't think we want to require that in the common case where you're using Itanium on Linux or Windows. However, like you said, the attempt of this is to override the automatic detection done in the headers. Maybe the name should reflect that (Ex. _LIBCPP_ABI_ITANIUM_OVERRIDE)? And then the autodetection can operate by checking for an override first? > config_define_if_not(LIBCXX_ENABLE_GLOBAL_FILESYSTEM_NAMESPACE > _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE) > config_define_if_not(LIBCXX_ENABLE_STDIN _LIBCPP_HAS_NO_STDIN) > > Modified: libcxx/trunk/include/__config > URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/_ > _config?rev=314949&r1=314948&r2=314949&view=diff > > == > --- libcxx/trunk/include/__config (original) > +++ libcxx/trunk/include/__config Wed Oct 4 16:44:38 2017 > @@ -157,11 +157,15 @@ > > // FIXME: ABI detection should be done via compiler builtin macros. This > // is just a placeholder until Clang implements such macros. For now > assume > -// that Windows compilers pretending to be MSVC++ target the microsoft > ABI. > -#if defined(_WIN32) && defined(_MSC_VER) > -# define _LIBCPP_ABI_MICROSOFT > -#else > -# define _LIBCPP_ABI_ITANIUM > +// that Windows compilers pretending to be MSVC++ target the Microsoft > ABI, > +// and allow the user to explicitly specify the ABI to handle cases where > this > +// heuristic falls short. > +#if !defined(_LIBCPP_ABI_ITANIUM) && !defined(_LIBCPP_ABI_MICROSOFT) > +# if defined(_WIN32) && defined(_MSC_VER) > +# define _LIBCPP_ABI_MICROSOFT > +# else > +# define _LIBCPP_ABI_ITANIUM > +# endif > #endif > > // Need to detect which libc we're using if we're on Linux. > > Modified: libcxx/trunk/include/__config_site.in > URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/_ > _config_site.in?rev=314949&r1=314948&r2=314949&view=diff > > == > --- libcxx/trunk/include/__config_site.in (original) > +++ libcxx/trunk/include/__config_site.in Wed Oct 4 16:44:38 2017 > @@ -12,6 +12,8 @@ > > #cmakedefine _LIBCPP_ABI_VERSION @_LIBCPP_ABI_VERSION@ > #cmakedefine _LIBCPP_A
Re: [PATCH] D31363: [libc++] Remove cmake glob for source files
On Thu, Oct 5, 2017 at 10:20 AM, Chris Bieneman via Phabricator < revi...@reviews.llvm.org> wrote: > beanz added a comment. > > Building libcxx without LLVM's CMake modules is very important, not just > to Apple. *Why* is it important? The reason isn't obvious to me. The only additional cost is downloading the LLVM sources, and I don't see why that's show stopping. Sure it takes *slightly longer* than before, but that can't be the issue here, is it? > This is how several open source distributions work, and it would be a huge > disservice to break this. Same is true for compiler-rt, libcxxabi, > libunwind, etc. > > Historically we've been drawing the line that building and running tests > for runtime projects can require LLVM, but building the runtime libraries > themselves must work without LLVM. I believe that is still the correct line > to draw. > > > https://reviews.llvm.org/D31363 > > > > ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r315994 - [libc++] Fix PR34898 - vector iterator constructors and assign method perform push_back instead of emplace_back.
Author: ericwf Date: Tue Oct 17 06:03:17 2017 New Revision: 315994 URL: http://llvm.org/viewvc/llvm-project?rev=315994&view=rev Log: [libc++] Fix PR34898 - vector iterator constructors and assign method perform push_back instead of emplace_back. Summary: The constructors `vector(Iter, Iter, Alloc = Alloc{})` and `assign(Iter, Iter)` don't correctly perform EmplaceConstruction from the result of dereferencing the iterator. This results in them performing an additional and unneeded copy. This patch addresses the issue by correctly using `emplace_back` in C++11 and newer. There are also some bugs in our `insert` implementation, but those will be handled separately. @mclow.lists We should probably merge this into 5.1, agreed? Reviewers: mclow.lists, dlj, EricWF Reviewed By: mclow.lists, EricWF Subscribers: cfe-commits, mclow.lists Differential Revision: https://reviews.llvm.org/D38757 Added: libcxx/trunk/test/std/containers/sequences/vector/vector.cons/assign_iter_iter.pass.cpp libcxx/trunk/test/support/emplace_constructible.h Modified: libcxx/trunk/include/deque libcxx/trunk/include/list libcxx/trunk/include/vector libcxx/trunk/test/std/containers/sequences/deque/deque.cons/assign_iter_iter.pass.cpp libcxx/trunk/test/std/containers/sequences/deque/deque.cons/iter_iter.pass.cpp libcxx/trunk/test/std/containers/sequences/deque/deque.cons/iter_iter_alloc.pass.cpp libcxx/trunk/test/std/containers/sequences/list/list.cons/input_iterator.pass.cpp libcxx/trunk/test/std/containers/sequences/vector/vector.cons/construct_iter_iter.pass.cpp libcxx/trunk/test/std/containers/sequences/vector/vector.cons/construct_iter_iter_alloc.pass.cpp libcxx/trunk/test/support/container_test_types.h Modified: libcxx/trunk/include/deque URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/deque?rev=315994&r1=315993&r2=315994&view=diff == --- libcxx/trunk/include/deque (original) +++ libcxx/trunk/include/deque Tue Oct 17 06:03:17 2017 @@ -1356,7 +1356,6 @@ public: iterator insert(const_iterator __p, initializer_list __il) {return insert(__p, __il.begin(), __il.end());} #endif // _LIBCPP_CXX03_LANG - iterator insert(const_iterator __p, const value_type& __v); iterator insert(const_iterator __p, size_type __n, const value_type& __v); template @@ -2224,7 +2223,11 @@ deque<_Tp, _Allocator>::__append(_InpIte !__is_forward_iterator<_InpIter>::value>::type*) { for (; __f != __l; ++__f) +#ifdef _LIBCPP_CXX03_LANG push_back(*__f); +#else +emplace_back(*__f); +#endif } template Modified: libcxx/trunk/include/list URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/list?rev=315994&r1=315993&r2=315994&view=diff == --- libcxx/trunk/include/list (original) +++ libcxx/trunk/include/list Tue Oct 17 06:03:17 2017 @@ -992,6 +992,15 @@ public: void push_front(const value_type& __x); void push_back(const value_type& __x); +#ifndef _LIBCPP_CXX03_LANG +template +_LIBCPP_INLINE_VISIBILITY +void __emplace_back(_Arg&& __arg) { emplace_back(_VSTD::forward<_Arg>(__arg)); } +#else +_LIBCPP_INLINE_VISIBILITY +void __emplace_back(value_type const& __arg) { push_back(__arg); } +#endif + iterator insert(const_iterator __p, const value_type& __x); iterator insert(const_iterator __p, size_type __n, const value_type& __x); template @@ -1189,7 +1198,7 @@ list<_Tp, _Alloc>::list(_InpIter __f, _I __get_db()->__insert_c(this); #endif for (; __f != __l; ++__f) -push_back(*__f); +__emplace_back(*__f); } template @@ -1202,7 +1211,7 @@ list<_Tp, _Alloc>::list(_InpIter __f, _I __get_db()->__insert_c(this); #endif for (; __f != __l; ++__f) -push_back(*__f); +__emplace_back(*__f); } template Modified: libcxx/trunk/include/vector URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/vector?rev=315994&r1=315993&r2=315994&view=diff == --- libcxx/trunk/include/vector (original) +++ libcxx/trunk/include/vector Tue Oct 17 06:03:17 2017 @@ -674,6 +674,17 @@ public: const value_type* data() const _NOEXCEPT {return _VSTD::__to_raw_pointer(this->__begin_);} +#ifdef _LIBCPP_CXX03_LANG +_LIBCPP_INLINE_VISIBILITY +void __emplace_back(const value_type& __x) { push_back(__x); } +#else +template +_LIBCPP_INLINE_VISIBILITY +void __emplace_back(_Arg&& __arg) { + emplace_back(_VSTD::forward<_Arg>(__arg)); +} +#endif + _LIBCPP_INLINE_VISIBILITY void push_back(const_reference __x); #ifndef _LIBCPP_CXX03_LANG @@ -1128,7 +1139,7 @@ vector<_Tp, _Allocator>::vector(_InputIt __get_db()->__insert_c(this
[libcxx] r315995 - Refactor _LIBCPP__ENDIAN
Author: ericwf Date: Tue Oct 17 06:16:01 2017 New Revision: 315995 URL: http://llvm.org/viewvc/llvm-project?rev=315995&view=rev Log: Refactor _LIBCPP__ENDIAN Previously this macro used 0/1 to indicate if it was set. This is unlike all other libc++ configuration macros which use ifdef/ifndef. This patch makes this macro consistent with everything else. Modified: libcxx/trunk/include/__config libcxx/trunk/include/string Modified: libcxx/trunk/include/__config URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config?rev=315995&r1=315994&r2=315995&view=diff == --- libcxx/trunk/include/__config (original) +++ libcxx/trunk/include/__config Tue Oct 17 06:16:01 2017 @@ -184,36 +184,30 @@ #ifdef __LITTLE_ENDIAN__ #if __LITTLE_ENDIAN__ -#define _LIBCPP_LITTLE_ENDIAN 1 -#define _LIBCPP_BIG_ENDIAN0 +#define _LIBCPP_LITTLE_ENDIAN #endif // __LITTLE_ENDIAN__ #endif // __LITTLE_ENDIAN__ #ifdef __BIG_ENDIAN__ #if __BIG_ENDIAN__ -#define _LIBCPP_LITTLE_ENDIAN 0 -#define _LIBCPP_BIG_ENDIAN1 +#define _LIBCPP_BIG_ENDIAN #endif // __BIG_ENDIAN__ #endif // __BIG_ENDIAN__ #ifdef __BYTE_ORDER__ #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ -#define _LIBCPP_LITTLE_ENDIAN 1 -#define _LIBCPP_BIG_ENDIAN 0 +#define _LIBCPP_LITTLE_ENDIAN #elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ -#define _LIBCPP_LITTLE_ENDIAN 0 -#define _LIBCPP_BIG_ENDIAN 1 +#define _LIBCPP_BIG_ENDIAN #endif // __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ #endif // __BYTE_ORDER__ #ifdef __FreeBSD__ # include # if _BYTE_ORDER == _LITTLE_ENDIAN -# define _LIBCPP_LITTLE_ENDIAN 1 -# define _LIBCPP_BIG_ENDIAN0 +# define _LIBCPP_LITTLE_ENDIAN # else // _BYTE_ORDER == _LITTLE_ENDIAN -# define _LIBCPP_LITTLE_ENDIAN 0 -# define _LIBCPP_BIG_ENDIAN1 +# define _LIBCPP_BIG_ENDIAN # endif // _BYTE_ORDER == _LITTLE_ENDIAN # ifndef __LONG_LONG_SUPPORTED # define _LIBCPP_HAS_NO_LONG_LONG @@ -223,19 +217,16 @@ #ifdef __NetBSD__ # include # if _BYTE_ORDER == _LITTLE_ENDIAN -# define _LIBCPP_LITTLE_ENDIAN 1 -# define _LIBCPP_BIG_ENDIAN0 +# define _LIBCPP_LITTLE_ENDIAN # else // _BYTE_ORDER == _LITTLE_ENDIAN -# define _LIBCPP_LITTLE_ENDIAN 0 -# define _LIBCPP_BIG_ENDIAN1 +# define _LIBCPP_BIG_ENDIAN # endif // _BYTE_ORDER == _LITTLE_ENDIAN # define _LIBCPP_HAS_QUICK_EXIT #endif // __NetBSD__ #if defined(_WIN32) # define _LIBCPP_WIN32API -# define _LIBCPP_LITTLE_ENDIAN 1 -# define _LIBCPP_BIG_ENDIAN0 +# define _LIBCPP_LITTLE_ENDIAN # define _LIBCPP_SHORT_WCHAR 1 // Both MinGW and native MSVC provide a "MSVC"-like enviroment # define _LIBCPP_MSVCRT_LIKE @@ -265,11 +256,9 @@ #ifdef __sun__ # include # ifdef _LITTLE_ENDIAN -# define _LIBCPP_LITTLE_ENDIAN 1 -# define _LIBCPP_BIG_ENDIAN0 +# define _LIBCPP_LITTLE_ENDIAN # else -# define _LIBCPP_LITTLE_ENDIAN 0 -# define _LIBCPP_BIG_ENDIAN1 +# define _LIBCPP_BIG_ENDIAN # endif #endif // __sun__ @@ -290,18 +279,16 @@ # define _LIBCPP_USING_DEV_RANDOM #endif -#if !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN) +#if !defined(_LIBCPP_LITTLE_ENDIAN) && !defined(_LIBCPP_BIG_ENDIAN) # include # if __BYTE_ORDER == __LITTLE_ENDIAN -# define _LIBCPP_LITTLE_ENDIAN 1 -# define _LIBCPP_BIG_ENDIAN0 +# define _LIBCPP_LITTLE_ENDIAN # elif __BYTE_ORDER == __BIG_ENDIAN -# define _LIBCPP_LITTLE_ENDIAN 0 -# define _LIBCPP_BIG_ENDIAN1 +# define _LIBCPP_BIG_ENDIAN # else // __BYTE_ORDER == __BIG_ENDIAN # error unable to determine endian # endif -#endif // !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN) +#endif // !defined(_LIBCPP_LITTLE_ENDIAN) && !defined(_LIBCPP_BIG_ENDIAN) #if __has_attribute(__no_sanitize__) && !defined(_LIBCPP_COMPILER_GCC) #define _LIBCPP_NO_CFI __attribute__((__no_sanitize__("cfi"))) Modified: libcxx/trunk/include/string URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/string?rev=315995&r1=315994&r2=315995&view=diff == --- libcxx/trunk/include/string (original) +++ libcxx/trunk/include/string Tue Oct 17 06:16:01 2017 @@ -670,7 +670,7 @@ private: size_type __cap_; }; -#if _LIBCPP_BIG_ENDIAN +#ifdef _LIBCPP_BIG_ENDIAN static const size_type __short_mask = 0x01; static const size_type __long_mask = 0x1ul; #else // _LIBCPP_BIG_ENDIAN @@ -700,7 +700,7 @@ private: pointer __data_; }; -#if _LIBCPP_BIG_ENDIAN +#ifdef _LIBCPP_BIG_ENDIAN static const size_type __short_mask = 0x80; static const size_type __long_mask = ~(size_type(~0) >> 1); #else // _LIBCPP_BIG_ENDIAN @@ -1241,7 +1241,7 @@ private: _LIBCPP_INLINE_VISIBILITY void __set_short_size(size_type __s) _NOEXCEPT -# if _LIBCPP_BIG_ENDIAN +# ifdef _LIBCPP_BIG_ENDIAN {__r_.first().__s.__size_ = (unsigned char)(__s << 1);}
[libcxx] r315997 - fix shadowing warnings in new tests
Author: ericwf Date: Tue Oct 17 06:45:20 2017 New Revision: 315997 URL: http://llvm.org/viewvc/llvm-project?rev=315997&view=rev Log: fix shadowing warnings in new tests Modified: libcxx/trunk/test/support/emplace_constructible.h Modified: libcxx/trunk/test/support/emplace_constructible.h URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/emplace_constructible.h?rev=315997&r1=315996&r2=315997&view=diff == --- libcxx/trunk/test/support/emplace_constructible.h (original) +++ libcxx/trunk/test/support/emplace_constructible.h Tue Oct 17 06:45:20 2017 @@ -7,7 +7,7 @@ template struct EmplaceConstructible { T value; - explicit EmplaceConstructible(T value) : value(value) {} + explicit EmplaceConstructible(T xvalue) : value(xvalue) {} EmplaceConstructible(EmplaceConstructible const&) = delete; }; @@ -15,7 +15,7 @@ template struct EmplaceConstructibleAndMoveInsertable { int copied = 0; T value; - explicit EmplaceConstructibleAndMoveInsertable(T value) : value(value) {} + explicit EmplaceConstructibleAndMoveInsertable(T xvalue) : value(xvalue) {} EmplaceConstructibleAndMoveInsertable( EmplaceConstructibleAndMoveInsertable&& Other) @@ -27,7 +27,7 @@ struct EmplaceConstructibleAndMoveable { int copied = 0; int assigned = 0; T value; - explicit EmplaceConstructibleAndMoveable(T value) noexcept : value(value) {} + explicit EmplaceConstructibleAndMoveable(T xvalue) noexcept : value(xvalue) {} EmplaceConstructibleAndMoveable(EmplaceConstructibleAndMoveable&& Other) noexcept : copied(Other.copied + 1), ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r316009 - fix shadowing warnings in new tests, try 2
Author: ericwf Date: Tue Oct 17 09:06:42 2017 New Revision: 316009 URL: http://llvm.org/viewvc/llvm-project?rev=316009&view=rev Log: fix shadowing warnings in new tests, try 2 Modified: libcxx/trunk/test/support/emplace_constructible.h Modified: libcxx/trunk/test/support/emplace_constructible.h URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/emplace_constructible.h?rev=316009&r1=316008&r2=316009&view=diff == --- libcxx/trunk/test/support/emplace_constructible.h (original) +++ libcxx/trunk/test/support/emplace_constructible.h Tue Oct 17 09:06:42 2017 @@ -47,8 +47,8 @@ struct EmplaceConstructibleMoveableAndAs int copied = 0; int assigned = 0; T value; - explicit EmplaceConstructibleMoveableAndAssignable(T value) noexcept - : value(value) {} + explicit EmplaceConstructibleMoveableAndAssignable(T xvalue) noexcept + : value(xvalue) {} EmplaceConstructibleMoveableAndAssignable( EmplaceConstructibleMoveableAndAssignable&& Other) noexcept ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [libcxx] r315994 - [libc++] Fix PR34898 - vector iterator constructors and assign method perform push_back instead of emplace_back.
These shadowing warnings should be fixed now. /Eric On Tue, Oct 17, 2017 at 10:03 AM, Maxim Kuvyrkov wrote: > Hi Eric, > > This seems to have broken ARM and AArch64 buildbots: > > http://lab.llvm.org:8011/builders/libcxx-libcxxabi- > libunwind-arm-linux/builds/850 > http://lab.llvm.org:8011/builders/libcxx-libcxxabi-libunwind-arm-linux- > noexceptions/builds/931 > http://lab.llvm.org:8011/builders/libcxx-libcxxabi- > libunwind-aarch64-linux/builds/873 > http://lab.llvm.org:8011/builders/libcxx-libcxxabi- > libunwind-aarch64-linux-noexceptions/builds/826 > > Would you please take a look? > > -- > Maxim Kuvyrkov > www.linaro.org > > > > > On Oct 17, 2017, at 4:03 PM, Eric Fiselier via cfe-commits < > cfe-commits@lists.llvm.org> wrote: > > > > Author: ericwf > > Date: Tue Oct 17 06:03:17 2017 > > New Revision: 315994 > > > > URL: http://llvm.org/viewvc/llvm-project?rev=315994&view=rev > > Log: > > [libc++] Fix PR34898 - vector iterator constructors and assign method > perform push_back instead of emplace_back. > > > > Summary: > > The constructors `vector(Iter, Iter, Alloc = Alloc{})` and `assign(Iter, > Iter)` don't correctly perform EmplaceConstruction from the result of > dereferencing the iterator. This results in them performing an additional > and unneeded copy. > > > > This patch addresses the issue by correctly using `emplace_back` in > C++11 and newer. > > > > There are also some bugs in our `insert` implementation, but those will > be handled separately. > > > > @mclow.lists We should probably merge this into 5.1, agreed? > > > > Reviewers: mclow.lists, dlj, EricWF > > > > Reviewed By: mclow.lists, EricWF > > > > Subscribers: cfe-commits, mclow.lists > > > > Differential Revision: https://reviews.llvm.org/D38757 > > > > Added: > >libcxx/trunk/test/std/containers/sequences/vector/ > vector.cons/assign_iter_iter.pass.cpp > >libcxx/trunk/test/support/emplace_constructible.h > > Modified: > >libcxx/trunk/include/deque > >libcxx/trunk/include/list > >libcxx/trunk/include/vector > >libcxx/trunk/test/std/containers/sequences/deque/ > deque.cons/assign_iter_iter.pass.cpp > >libcxx/trunk/test/std/containers/sequences/deque/ > deque.cons/iter_iter.pass.cpp > >libcxx/trunk/test/std/containers/sequences/deque/ > deque.cons/iter_iter_alloc.pass.cpp > >libcxx/trunk/test/std/containers/sequences/list/ > list.cons/input_iterator.pass.cpp > >libcxx/trunk/test/std/containers/sequences/vector/ > vector.cons/construct_iter_iter.pass.cpp > >libcxx/trunk/test/std/containers/sequences/vector/ > vector.cons/construct_iter_iter_alloc.pass.cpp > >libcxx/trunk/test/support/container_test_types.h > > > > Modified: libcxx/trunk/include/deque > > URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/ > deque?rev=315994&r1=315993&r2=315994&view=diff > > > == > > --- libcxx/trunk/include/deque (original) > > +++ libcxx/trunk/include/deque Tue Oct 17 06:03:17 2017 > > @@ -1356,7 +1356,6 @@ public: > > iterator insert(const_iterator __p, initializer_list > __il) > > {return insert(__p, __il.begin(), __il.end());} > > #endif // _LIBCPP_CXX03_LANG > > - > > iterator insert(const_iterator __p, const value_type& __v); > > iterator insert(const_iterator __p, size_type __n, const value_type& > __v); > > template > > @@ -2224,7 +2223,11 @@ deque<_Tp, _Allocator>::__append(_InpIte > > > !__is_forward_iterator<_InpIter>::value>::type*) > > { > > for (; __f != __l; ++__f) > > +#ifdef _LIBCPP_CXX03_LANG > > push_back(*__f); > > +#else > > +emplace_back(*__f); > > +#endif > > } > > > > template > > > > Modified: libcxx/trunk/include/list > > URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/ > list?rev=315994&r1=315993&r2=315994&view=diff > > > == > > --- libcxx/trunk/include/list (original) > > +++ libcxx/trunk/include/list Tue Oct 17 06:03:17 2017 > > @@ -992,6 +992,15 @@ public: > > void push_front(const value_type& __x); > > void push_back(const value_type& __x); > > > > +#ifndef _LIBCPP_CXX03_LANG > > +template > > +_LIBCPP_INLINE_VISIBILITY > > +void __emplace_back(_A
[libcxx] r316021 - Refactor std::list node allocation logic.
Author: ericwf Date: Tue Oct 17 12:12:23 2017 New Revision: 316021 URL: http://llvm.org/viewvc/llvm-project?rev=316021&view=rev Log: Refactor std::list node allocation logic. The logic to allocate a node within std::list was repeated in a bunch of places. This is unneeded. This patch refactors the shared logic into a single function to reduce duplication. This patch is part of a set to clean up node construction in general, but refactoring construction requires some more work to make it work cleanly in C++03 Modified: libcxx/trunk/include/list Modified: libcxx/trunk/include/list URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/list?rev=316021&r1=316020&r2=316021&view=diff == --- libcxx/trunk/include/list (original) +++ libcxx/trunk/include/list Tue Oct 17 12:12:23 2017 @@ -1071,6 +1071,16 @@ public: bool __invariants() const; +typedef __allocator_destructor<__node_allocator> __node_destructor; +typedef unique_ptr<__node, __node_destructor> __hold_pointer; + +_LIBCPP_INLINE_VISIBILITY +__hold_pointer __allocate_node(__node_allocator& __na) { + __node_pointer __p = __node_alloc_traits::allocate(__na, 1); + __p->__prev_ = nullptr; + return __hold_pointer(__p, __node_destructor(__na, 1)); +} + #if _LIBCPP_DEBUG_LEVEL >= 2 bool __dereferenceable(const const_iterator* __i) const; @@ -1397,9 +1407,7 @@ list<_Tp, _Alloc>::insert(const_iterator " referring to this list"); #endif __node_allocator& __na = base::__node_alloc(); -typedef __allocator_destructor<__node_allocator> _Dp; -unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1)); -__hold->__prev_ = 0; +__hold_pointer __hold = __allocate_node(__na); __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x); __link_nodes(__p.__ptr_, __hold->__as_link(), __hold->__as_link()); ++base::__sz(); @@ -1426,9 +1434,7 @@ list<_Tp, _Alloc>::insert(const_iterator { size_type __ds = 0; __node_allocator& __na = base::__node_alloc(); -typedef __allocator_destructor<__node_allocator> _Dp; -unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1)); -__hold->__prev_ = 0; +__hold_pointer __hold = __allocate_node(__na); __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x); ++__ds; #if _LIBCPP_DEBUG_LEVEL >= 2 @@ -1494,9 +1500,7 @@ list<_Tp, _Alloc>::insert(const_iterator { size_type __ds = 0; __node_allocator& __na = base::__node_alloc(); -typedef __allocator_destructor<__node_allocator> _Dp; -unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1)); -__hold->__prev_ = 0; +__hold_pointer __hold = __allocate_node(__na); __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), *__f); ++__ds; #if _LIBCPP_DEBUG_LEVEL >= 2 @@ -1549,8 +1553,7 @@ void list<_Tp, _Alloc>::push_front(const value_type& __x) { __node_allocator& __na = base::__node_alloc(); -typedef __allocator_destructor<__node_allocator> _Dp; -unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1)); +__hold_pointer __hold = __allocate_node(__na); __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x); __link_pointer __nl = __hold->__as_link(); __link_nodes_at_front(__nl, __nl); @@ -1563,8 +1566,7 @@ void list<_Tp, _Alloc>::push_back(const value_type& __x) { __node_allocator& __na = base::__node_alloc(); -typedef __allocator_destructor<__node_allocator> _Dp; -unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1)); +__hold_pointer __hold = __allocate_node(__na); __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x); __link_nodes_at_back(__hold.get()->__as_link(), __hold.get()->__as_link()); ++base::__sz(); @@ -1578,8 +1580,7 @@ void list<_Tp, _Alloc>::push_front(value_type&& __x) { __node_allocator& __na = base::__node_alloc(); -typedef __allocator_destructor<__node_allocator> _Dp; -unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1)); +__hold_pointer __hold = __allocate_node(__na); __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), _VSTD::move(__x)); __link_nodes_at_front(__hold.get()->__as_link(), __hold.get()->__as_link()); ++base::__sz(); @@ -1591,8 +1592,7 @@ void list<_Tp, _Alloc>::push_back(value_type&& __x) { __node_allocator& __na = base::__node_alloc(); -typedef __allocator_destructor<__node_allocator> _Dp; -unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1)); +__hold_pointer __hold = __allocate_node(__na); _
[libcxx] r337517 - cleanup test assertion inside library
Author: ericwf Date: Thu Jul 19 18:25:06 2018 New Revision: 337517 URL: http://llvm.org/viewvc/llvm-project?rev=337517&view=rev Log: cleanup test assertion inside library Modified: libcxx/trunk/src/experimental/filesystem/operations.cpp Modified: libcxx/trunk/src/experimental/filesystem/operations.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/experimental/filesystem/operations.cpp?rev=337517&r1=337516&r2=337517&view=diff == --- libcxx/trunk/src/experimental/filesystem/operations.cpp (original) +++ libcxx/trunk/src/experimental/filesystem/operations.cpp Thu Jul 19 18:25:06 2018 @@ -25,11 +25,6 @@ #include /* values for fchmodat */ #include -#ifdef NDEBUG -#undef NDEBUG -#endif -#include - _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL_FILESYSTEM filesystem_error::~filesystem_error() {} @@ -298,7 +293,6 @@ file_status create_file_status(std::erro struct ::stat& path_stat, std::error_code* ec) { if (ec) *ec = m_ec; - // assert(m_ec.value() != ENOTDIR); if (m_ec && (m_ec.value() == ENOENT || m_ec.value() == ENOTDIR)) { return file_status(file_type::not_found); } else if (m_ec) { ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r337519 - Use _LIBCPP_UNREACHABLE to convince GCC that non-void functions actually always return
Author: ericwf Date: Thu Jul 19 18:44:33 2018 New Revision: 337519 URL: http://llvm.org/viewvc/llvm-project?rev=337519&view=rev Log: Use _LIBCPP_UNREACHABLE to convince GCC that non-void functions actually always return Modified: libcxx/trunk/include/experimental/filesystem libcxx/trunk/src/experimental/filesystem/filesystem_common.h Modified: libcxx/trunk/include/experimental/filesystem URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/experimental/filesystem?rev=337519&r1=337518&r2=337519&view=diff == --- libcxx/trunk/include/experimental/filesystem (original) +++ libcxx/trunk/include/experimental/filesystem Thu Jul 19 18:44:33 2018 @@ -232,6 +232,7 @@ #include #include +#include #include #include #include @@ -2250,6 +2251,7 @@ private: __ec->clear(); return __data_.__type_; } + _LIBCPP_UNREACHABLE(); } _LIBCPP_INLINE_VISIBILITY @@ -2270,6 +2272,7 @@ private: return __data_.__type_; } } + _LIBCPP_UNREACHABLE(); } _LIBCPP_INLINE_VISIBILITY @@ -2284,6 +2287,7 @@ private: case _RefreshSymlink: return file_status(__get_ft(__ec), __data_.__non_sym_perms_); } + _LIBCPP_UNREACHABLE(); } _LIBCPP_INLINE_VISIBILITY @@ -2299,6 +2303,7 @@ private: case _RefreshSymlinkUnresolved: return file_status(__get_sym_ft(__ec), __data_.__sym_perms_); } + _LIBCPP_UNREACHABLE(); } @@ -2324,6 +2329,7 @@ private: return __data_.__size_; } } + _LIBCPP_UNREACHABLE(); } _LIBCPP_INLINE_VISIBILITY @@ -2342,6 +2348,7 @@ private: return __data_.__nlink_; } } + _LIBCPP_UNREACHABLE(); } _LIBCPP_INLINE_VISIBILITY @@ -2364,6 +2371,7 @@ private: return __data_.__write_time_; } } + _LIBCPP_UNREACHABLE(); } private: _Path __p_; Modified: libcxx/trunk/src/experimental/filesystem/filesystem_common.h URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/experimental/filesystem/filesystem_common.h?rev=337519&r1=337518&r2=337519&view=diff == --- libcxx/trunk/src/experimental/filesystem/filesystem_common.h (original) +++ libcxx/trunk/src/experimental/filesystem/filesystem_common.h Thu Jul 19 18:44:33 2018 @@ -228,8 +228,8 @@ public: } // namespace time_util -using TimeSpec = struct timespec; -using StatT = struct stat; +using TimeSpec = struct ::timespec; +using StatT = struct ::stat; using FSTime = time_util::fs_time_util; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r337520 - Fix two test failures in
Author: ericwf Date: Thu Jul 19 18:51:48 2018 New Revision: 337520 URL: http://llvm.org/viewvc/llvm-project?rev=337520&view=rev Log: Fix two test failures in First, didn't correctly guard against min/max macros. This adds the proper push/pop macro guards. Second, an internal time helper had been renamed but the test for it hadn't been updated. This patch updates those tests. Modified: libcxx/trunk/include/experimental/filesystem libcxx/trunk/test/libcxx/experimental/filesystem/convert_file_time.sh.cpp Modified: libcxx/trunk/include/experimental/filesystem URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/experimental/filesystem?rev=337520&r1=337519&r2=337520&view=diff == --- libcxx/trunk/include/experimental/filesystem (original) +++ libcxx/trunk/include/experimental/filesystem Thu Jul 19 18:51:48 2018 @@ -251,6 +251,9 @@ #pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + #define __cpp_lib_experimental_filesystem 201406 _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL_FILESYSTEM @@ -2647,4 +2650,6 @@ recursive_directory_iterator end(const r _LIBCPP_END_NAMESPACE_EXPERIMENTAL_FILESYSTEM +_LIBCPP_POP_MACROS + #endif // _LIBCPP_EXPERIMENTAL_FILESYSTEM Modified: libcxx/trunk/test/libcxx/experimental/filesystem/convert_file_time.sh.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/experimental/filesystem/convert_file_time.sh.cpp?rev=337520&r1=337519&r2=337520&view=diff == --- libcxx/trunk/test/libcxx/experimental/filesystem/convert_file_time.sh.cpp (original) +++ libcxx/trunk/test/libcxx/experimental/filesystem/convert_file_time.sh.cpp Thu Jul 19 18:51:48 2018 @@ -28,7 +28,7 @@ using namespace std::chrono; namespace fs = std::experimental::filesystem; using fs::file_time_type; -using fs::detail::fs_time_util; +using fs::detail::time_util::fs_time_util; enum TestKind { TK_64Bit, TK_32Bit, TK_FloatingPoint }; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r337532 - adjust incorrect comment
Author: ericwf Date: Fri Jul 20 01:36:45 2018 New Revision: 337532 URL: http://llvm.org/viewvc/llvm-project?rev=337532&view=rev Log: adjust incorrect comment Modified: libcxx/trunk/src/experimental/filesystem/operations.cpp Modified: libcxx/trunk/src/experimental/filesystem/operations.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/experimental/filesystem/operations.cpp?rev=337532&r1=337531&r2=337532&view=diff == --- libcxx/trunk/src/experimental/filesystem/operations.cpp (original) +++ libcxx/trunk/src/experimental/filesystem/operations.cpp Fri Jul 20 01:36:45 2018 @@ -1426,7 +1426,8 @@ error_code directory_entry::__do_refresh __data_.__cache_type_ = directory_entry::_RefreshSymlinkUnresolved; return error_code{}; } -// Otherwise, we resolved the link as not existing. That's OK. +// Otherwise, we either resolved the link, potentially as not existing. +// That's OK. __data_.__cache_type_ = directory_entry::_RefreshSymlink; } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r337649 - Implement a better copy_file.
Author: ericwf Date: Sat Jul 21 19:00:53 2018 New Revision: 337649 URL: http://llvm.org/viewvc/llvm-project?rev=337649&view=rev Log: Implement a better copy_file. This patch improves both the performance, and the safety of the copy_file implementation. The performance improvements are achieved by using sendfile on Linux and copyfile on OS X when available. The TOCTOU hardening is achieved by opening the source and destination files and then using fstat to check their attributes to see if we can copy them. Unfortunately for the destination file, there is no way to open it without accidentally creating it, so we first have to use stat to determine if it exists, and if we should copy to it. Then, once we're sure we should try to copy, we open the dest file and ensure it names the same entity we previously stat'ed. Added: libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_file/copy_file_large.pass.cpp Modified: libcxx/trunk/include/fstream libcxx/trunk/src/experimental/filesystem/operations.cpp libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_file/copy_file.pass.cpp libcxx/trunk/test/support/filesystem_test_helper.hpp libcxx/trunk/test/support/rapid-cxx-test.hpp Modified: libcxx/trunk/include/fstream URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/fstream?rev=337649&r1=337648&r2=337649&view=diff == --- libcxx/trunk/include/fstream (original) +++ libcxx/trunk/include/fstream Sat Jul 21 19:00:53 2018 @@ -170,6 +170,7 @@ typedef basic_fstream wfstream; #include #include <__locale> #include +#include #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header @@ -217,10 +218,17 @@ public: #endif _LIBCPP_INLINE_VISIBILITY basic_filebuf* open(const string& __s, ios_base::openmode __mode); + +_LIBCPP_INLINE_VISIBILITY +basic_filebuf* __open(int __fd, ios_base::openmode __mode); #endif basic_filebuf* close(); -protected: +_LIBCPP_INLINE_VISIBILITY +inline static const char* +__make_mdstring(ios_base::openmode __mode) _NOEXCEPT; + + protected: // 27.9.1.5 Overridden virtual functions: virtual int_type underflow(); virtual int_type pbackfail(int_type __c = traits_type::eof()); @@ -234,25 +242,25 @@ protected: virtual void imbue(const locale& __loc); private: -char* __extbuf_; -const char* __extbufnext_; -const char* __extbufend_; -char __extbuf_min_[8]; -size_t __ebs_; -char_type* __intbuf_; -size_t __ibs_; -FILE* __file_; -const codecvt* __cv_; -state_type __st_; -state_type __st_last_; -ios_base::openmode __om_; -ios_base::openmode __cm_; -bool __owns_eb_; -bool __owns_ib_; -bool __always_noconv_; + char* __extbuf_; + const char* __extbufnext_; + const char* __extbufend_; + char __extbuf_min_[8]; + size_t __ebs_; + char_type* __intbuf_; + size_t __ibs_; + FILE* __file_; + const codecvt* __cv_; + state_type __st_; + state_type __st_last_; + ios_base::openmode __om_; + ios_base::openmode __cm_; + bool __owns_eb_; + bool __owns_ib_; + bool __always_noconv_; -bool __read_mode(); -void __write_mode(); + bool __read_mode(); + void __write_mode(); }; template @@ -473,6 +481,46 @@ basic_filebuf<_CharT, _Traits>::is_open( return __file_ != 0; } +template +const char* basic_filebuf<_CharT, _Traits>::__make_mdstring( +ios_base::openmode __mode) _NOEXCEPT { + switch (__mode & ~ios_base::ate) { + case ios_base::out: + case ios_base::out | ios_base::trunc: +return "w"; + case ios_base::out | ios_base::app: + case ios_base::app: +return "a"; + case ios_base::in: +return "r"; + case ios_base::in | ios_base::out: +return "r+"; + case ios_base::in | ios_base::out | ios_base::trunc: +return "w+"; + case ios_base::in | ios_base::out | ios_base::app: + case ios_base::in | ios_base::app: +return "a+"; + case ios_base::out | ios_base::binary: + case ios_base::out | ios_base::trunc | ios_base::binary: +return "wb"; + case ios_base::out | ios_base::app | ios_base::binary: + case ios_base::app | ios_base::binary: +return "ab"; + case ios_base::in | ios_base::binary: +return "rb"; + case ios_base::in | ios_base::out | ios_base::binary: +return "r+b"; + case ios_base::in | ios_base::out | ios_base::trunc | ios_base::binary: +return "w+b"; + case ios_base::in | ios_base::out | ios_base::app | ios_base::binary: + case ios_base::in | ios_base::app | ios_base::binary: +return "a+b"; + default: +return nullptr; + } + _LIBCPP_UNREACHABLE(); +} + #ifndef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE template basic_filebuf<_CharT, _Traits>* @@ -481,79 +529,49 @@ basic_filebuf<_CharT, _Traits>::open(con basic_filebuf<_CharT, _Traits>* __rt = 0; if (__file_ == 0) { + if (const char* __mdstr = __make_md
[libcxx] r337658 - fix test failures with older clang versions
Author: ericwf Date: Sun Jul 22 13:50:16 2018 New Revision: 337658 URL: http://llvm.org/viewvc/llvm-project?rev=337658&view=rev Log: fix test failures with older clang versions Added: libcxx/trunk/test/std/experimental/filesystem/class.directory_entry/directory_entry.cons/default_const.pass.cpp Modified: libcxx/trunk/test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/file_size.pass.cpp libcxx/trunk/test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/file_type_obs.pass.cpp libcxx/trunk/test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/hard_link_count.pass.cpp libcxx/trunk/test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/last_write_time.pass.cpp Added: libcxx/trunk/test/std/experimental/filesystem/class.directory_entry/directory_entry.cons/default_const.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/filesystem/class.directory_entry/directory_entry.cons/default_const.pass.cpp?rev=337658&view=auto == --- libcxx/trunk/test/std/experimental/filesystem/class.directory_entry/directory_entry.cons/default_const.pass.cpp (added) +++ libcxx/trunk/test/std/experimental/filesystem/class.directory_entry/directory_entry.cons/default_const.pass.cpp Sun Jul 22 13:50:16 2018 @@ -0,0 +1,32 @@ +//===--===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===--===// + +// UNSUPPORTED: c++98, c++03 +// XFAIL: apple-clang-7, clang-3.7, clang-3.8 + +// + +// class directory_entry + +// directory_entry() noexcept = default; + +#include "filesystem_include.hpp" +#include +#include + +int main() { + using namespace fs; + // Default + { + static_assert(std::is_nothrow_default_constructible::value, + "directory_entry must have a nothrow default constructor"); +const directory_entry e; +assert(e.path() == path()); + } +} Modified: libcxx/trunk/test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/file_size.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/file_size.pass.cpp?rev=337658&r1=337657&r2=337658&view=diff == --- libcxx/trunk/test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/file_size.pass.cpp (original) +++ libcxx/trunk/test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/file_size.pass.cpp Sun Jul 22 13:50:16 2018 @@ -30,7 +30,7 @@ TEST_SUITE(directory_entry_obs_testsuite TEST_CASE(signatures) { using namespace fs; { -const fs::directory_entry e; +const fs::directory_entry e = {}; std::error_code ec; static_assert(std::is_same::value, ""); static_assert(std::is_same::value, Modified: libcxx/trunk/test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/file_type_obs.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/file_type_obs.pass.cpp?rev=337658&r1=337657&r2=337658&view=diff == --- libcxx/trunk/test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/file_type_obs.pass.cpp (original) +++ libcxx/trunk/test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/file_type_obs.pass.cpp Sun Jul 22 13:50:16 2018 @@ -32,7 +32,7 @@ TEST_CASE(file_dne) { TEST_CASE(signatures) { using namespace fs; - const directory_entry e; + const directory_entry e = {}; std::error_code ec; #define TEST_FUNC(name) \ static_assert(std::is_same::value, \ Modified: libcxx/trunk/test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/hard_link_count.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/hard_link_count.pass.cpp?rev=337658&r1=337657&r2=337658&view=diff == --- libcxx/trunk/test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/hard_link_count.pass.cpp (original) +++ libcxx/trunk/test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/hard_link_count.pass.cpp Sun Jul 22 13:50:16 2018 @@ -28,7 +28,7 @@ TEST_SUITE(directory_entry_obs_testsuite TEST_CASE(signatures) { using names
[libcxx] r337659 - Harden copy_file even more.
Author: ericwf Date: Sun Jul 22 14:15:15 2018 New Revision: 337659 URL: http://llvm.org/viewvc/llvm-project?rev=337659&view=rev Log: Harden copy_file even more. This patch removes the O_CREAT open flag when we first attempt to open the destination file but we expect it to already exist. This theoretically avoids the possibility that it was removed between when we first stat'ed it, and when we attempt to open it. Modified: libcxx/trunk/src/experimental/filesystem/operations.cpp Modified: libcxx/trunk/src/experimental/filesystem/operations.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/experimental/filesystem/operations.cpp?rev=337659&r1=337658&r2=337659&view=diff == --- libcxx/trunk/src/experimental/filesystem/operations.cpp (original) +++ libcxx/trunk/src/experimental/filesystem/operations.cpp Sun Jul 22 14:15:15 2018 @@ -716,7 +716,7 @@ bool __copy_file(const path& from, const if (to_exists && skip_existing) return false; - auto ShouldCopy = [&]() { + bool ShouldCopy = [&]() { if (to_exists && update_existing) { auto from_time = detail::extract_mtime(from_stat); auto to_time = detail::extract_mtime(to_stat_path); @@ -730,13 +730,15 @@ bool __copy_file(const path& from, const if (!to_exists || overwrite_existing) return true; return Error(make_error_code(errc::file_exists)); - }; - if (!ShouldCopy()) + }(); + if (!ShouldCopy) return false; // Don't truncate right away. We may not be opening the file we originally // looked at; we'll check this later. - int to_open_flags = O_WRONLY | O_CREAT; + int to_open_flags = O_WRONLY; + if (!to_exists) +to_open_flags |= O_CREAT; FileDescriptor to_fd = FileDescriptor::create_with_status( &to, m_ec, to_open_flags, from_stat.st_mode); if (m_ec) @@ -745,6 +747,7 @@ bool __copy_file(const path& from, const if (to_exists) { // Check that the file we initially stat'ed is equivalent to the one // we opened. +// FIXME: report this better. if (!detail::stat_equivalent(to_stat_path, to_fd.get_stat())) return Error(make_error_code(errc::bad_file_descriptor)); @@ -761,7 +764,6 @@ bool __copy_file(const path& from, const } return true; - } void __copy_symlink(const path& existing_symlink, const path& new_symlink, ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r337661 - Workaround bug in GCC trunk.
Author: ericwf Date: Sun Jul 22 14:56:40 2018 New Revision: 337661 URL: http://llvm.org/viewvc/llvm-project?rev=337661&view=rev Log: Workaround bug in GCC trunk. For some reason GCC ToT is failing to deduce the auto type for a static data member from its initializer in some cases. Though I'm sure the bug will be short lived, there is a trivial workaround for it. So we might as well get the bot passing again. Modified: libcxx/trunk/src/experimental/filesystem/filesystem_common.h Modified: libcxx/trunk/src/experimental/filesystem/filesystem_common.h URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/experimental/filesystem/filesystem_common.h?rev=337661&r1=337660&r2=337661&view=diff == --- libcxx/trunk/src/experimental/filesystem/filesystem_common.h (original) +++ libcxx/trunk/src/experimental/filesystem/filesystem_common.h Sun Jul 22 14:56:40 2018 @@ -94,18 +94,18 @@ using namespace chrono; template ::value> struct fs_time_util_base { - static constexpr auto max_seconds = + static constexpr seconds::rep max_seconds = duration_cast(FileTimeT::duration::max()).count(); - static constexpr auto max_nsec = + static constexpr nanoseconds::rep max_nsec = duration_cast(FileTimeT::duration::max() - seconds(max_seconds)) .count(); - static constexpr auto min_seconds = + static constexpr seconds::rep min_seconds = duration_cast(FileTimeT::duration::min()).count(); - static constexpr auto min_nsec_timespec = + static constexpr nanoseconds::rep min_nsec_timespec = duration_cast( (FileTimeT::duration::min() - seconds(min_seconds)) + seconds(1)) .count(); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxxabi] r337662 - Add GCC 9 to XFAILs list for test
Author: ericwf Date: Sun Jul 22 14:58:46 2018 New Revision: 337662 URL: http://llvm.org/viewvc/llvm-project?rev=337662&view=rev Log: Add GCC 9 to XFAILs list for test Modified: libcxxabi/trunk/test/catch_member_function_pointer_02.pass.cpp Modified: libcxxabi/trunk/test/catch_member_function_pointer_02.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/test/catch_member_function_pointer_02.pass.cpp?rev=337662&r1=337661&r2=337662&view=diff == --- libcxxabi/trunk/test/catch_member_function_pointer_02.pass.cpp (original) +++ libcxxabi/trunk/test/catch_member_function_pointer_02.pass.cpp Sun Jul 22 14:58:46 2018 @@ -13,7 +13,7 @@ // GCC 7 and 8 support noexcept function types but this test still fails. // This is likely a bug in their implementation. Investigation needed. -// XFAIL: gcc-7, gcc-8 +// XFAIL: gcc-7, gcc-8, gcc-9 #include ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r337664 - Implement filesystem_error::what() and improve reporting.
Author: ericwf Date: Sun Jul 22 19:00:52 2018 New Revision: 337664 URL: http://llvm.org/viewvc/llvm-project?rev=337664&view=rev Log: Implement filesystem_error::what() and improve reporting. This patch implements the `what()` for filesystem errors. The message includes the 'what_arg', any paths that were specified, and the error code message. Additionally this patch refactors how errors are created, making it easier to report them correctly. Added: libcxx/trunk/test/support/format_string.hpp Modified: libcxx/trunk/include/experimental/filesystem libcxx/trunk/src/experimental/filesystem/directory_iterator.cpp libcxx/trunk/src/experimental/filesystem/filesystem_common.h libcxx/trunk/src/experimental/filesystem/operations.cpp libcxx/trunk/test/libcxx/experimental/filesystem/class.directory_entry/directory_entry.mods/last_write_time.sh.cpp libcxx/trunk/test/std/experimental/filesystem/class.directory_entry/directory_entry.mods/refresh.pass.cpp libcxx/trunk/test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/file_size.pass.cpp libcxx/trunk/test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/hard_link_count.pass.cpp libcxx/trunk/test/std/experimental/filesystem/class.directory_entry/directory_entry.obs/last_write_time.pass.cpp libcxx/trunk/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.copy_file/copy_file.pass.cpp libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.file_size/file_size.pass.cpp libcxx/trunk/test/support/filesystem_test_helper.hpp libcxx/trunk/www/cxx2a_status.html Modified: libcxx/trunk/include/experimental/filesystem URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/experimental/filesystem?rev=337664&r1=337663&r2=337664&view=diff == --- libcxx/trunk/include/experimental/filesystem (original) +++ libcxx/trunk/include/experimental/filesystem Sun Jul 22 19:00:52 2018 @@ -1265,40 +1265,51 @@ public: _LIBCPP_INLINE_VISIBILITY filesystem_error(const string& __what, error_code __ec) : system_error(__ec, __what), - __paths_(make_shared<_Storage>(path(), path())) -{} + __storage_(make_shared<_Storage>(path(), path())) { + __create_what(0); +} _LIBCPP_INLINE_VISIBILITY filesystem_error(const string& __what, const path& __p1, error_code __ec) : system_error(__ec, __what), -__paths_(make_shared<_Storage>(__p1, path())) -{} + __storage_(make_shared<_Storage>(__p1, path())) { + __create_what(1); +} _LIBCPP_INLINE_VISIBILITY filesystem_error(const string& __what, const path& __p1, const path& __p2, error_code __ec) : system_error(__ec, __what), - __paths_(make_shared<_Storage>(__p1, __p2)) -{} + __storage_(make_shared<_Storage>(__p1, __p2)) { + __create_what(2); +} _LIBCPP_INLINE_VISIBILITY -const path& path1() const _NOEXCEPT { -return __paths_->first; -} +const path& path1() const _NOEXCEPT { return __storage_->__p1_; } _LIBCPP_INLINE_VISIBILITY -const path& path2() const _NOEXCEPT { -return __paths_->second; -} +const path& path2() const _NOEXCEPT { return __storage_->__p2_; } ~filesystem_error() override; // key function -// TODO(ericwf): Create a custom error message. -//const char* what() const _NOEXCEPT; +_LIBCPP_INLINE_VISIBILITY +const char* what() const _NOEXCEPT override { + return __storage_->__what_.c_str(); +} + +_LIBCPP_FUNC_VIS +void __create_what(int __num_paths); -private: -typedef pair _Storage; -shared_ptr<_Storage> __paths_; + private: +struct _Storage { + _LIBCPP_INLINE_VISIBILITY + _Storage(const path& __p1, const path& __p2) : __p1_(__p1), __p2_(__p2) {} + + path __p1_; + path __p2_; + string __what_; +}; +shared_ptr<_Storage> __storage_; }; template @@ -1315,7 +1326,6 @@ void __throw_filesystem_error(_Args&&... } #endif - // operational functions _LIBCPP_FUNC_VIS @@ -2226,12 +2236,13 @@ private: return; } if (__ec && (!__allow_dne || !__is_dne_error(__ec))) -__throw_filesystem_error(__msg, __p_, _Path{}, __ec); +__throw_filesystem_error(__msg, __p_, __ec); } _LIBCPP_INLINE_VISIBILITY void __refresh(error_code* __ec = nullptr) { - __handle_error("refresh", __ec, __do_refresh(), /*allow_dne*/ true); + __handle_error("in directory_entry::refresh", __ec, __do_refresh(), + /*allow_dne*/ true); } _LIBCPP_INLINE_VISIBILITY @@ -2322,11 +2333,11 @@ private: case _RefreshNonSymlink: { error_code __m_ec; file_status __st(__get_f
[libcxx] r337665 - Work around various GCC 4.9 build errors
Author: ericwf Date: Sun Jul 22 20:06:57 2018 New Revision: 337665 URL: http://llvm.org/viewvc/llvm-project?rev=337665&view=rev Log: Work around various GCC 4.9 build errors Modified: libcxx/trunk/src/experimental/filesystem/filesystem_common.h libcxx/trunk/src/experimental/filesystem/operations.cpp Modified: libcxx/trunk/src/experimental/filesystem/filesystem_common.h URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/experimental/filesystem/filesystem_common.h?rev=337665&r1=337664&r2=337665&view=diff == --- libcxx/trunk/src/experimental/filesystem/filesystem_common.h (original) +++ libcxx/trunk/src/experimental/filesystem/filesystem_common.h Sun Jul 22 20:06:57 2018 @@ -72,6 +72,7 @@ static std::string format_string_imp(con struct GuardVAList { va_list& target; bool active = true; +GuardVAList(va_list &target) : target(target), active(true) {} void clear() { if (active) va_end(target); @@ -84,11 +85,11 @@ static std::string format_string_imp(con }; va_list args; va_start(args, msg); - GuardVAList args_guard = {args}; + GuardVAList args_guard(args); va_list args_cp; va_copy(args_cp, args); - GuardVAList args_copy_guard = {args_cp}; + GuardVAList args_copy_guard(args_cp); std::array local_buff; std::size_t size = local_buff.size(); @@ -131,7 +132,7 @@ std::error_code capture_errno() { template T error_value(); template <> -constexpr void error_value() {} +_LIBCPP_CONSTEXPR_AFTER_CXX11 void error_value() {} template <> constexpr bool error_value() { return false; @@ -141,7 +142,7 @@ constexpr uintmax_t error_value -constexpr file_time_type error_value() { +_LIBCPP_CONSTEXPR_AFTER_CXX11 file_time_type error_value() { return file_time_type::min(); } template <> @@ -369,7 +370,7 @@ TimeSpec extract_atime(StatT const& st) using TimeStruct = struct ::timeval; using TimeStructArray = TimeStruct[2]; #else -using TimeStruct = struct ::timespec; +using TimeStruct = TimeSpec; using TimeStructArray = TimeStruct[2]; #endif @@ -413,8 +414,6 @@ bool SetTimeStructTo(TimeStruct& TS, fil _LIBCPP_END_NAMESPACE_EXPERIMENTAL_FILESYSTEM -#if defined(__GNUC__) -#pragma GCC diagnostic pop -#endif + #endif // FILESYSTEM_COMMON_H Modified: libcxx/trunk/src/experimental/filesystem/operations.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/experimental/filesystem/operations.cpp?rev=337665&r1=337664&r2=337665&view=diff == --- libcxx/trunk/src/experimental/filesystem/operations.cpp (original) +++ libcxx/trunk/src/experimental/filesystem/operations.cpp Sun Jul 22 20:06:57 2018 @@ -36,6 +36,12 @@ # define _LIBCPP_USE_COPYFILE #endif +#if defined(_LIBCPP_COMPILER_GCC) +#if _GNUC_VER < 500 +#pragma GCC diagnostic ignored "-Wmissing-field-initializers" +#endif +#endif + _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL_FILESYSTEM filesystem_error::~filesystem_error() {} @@ -446,7 +452,7 @@ bool stat_equivalent(const StatT& st1, c file_status FileDescriptor::refresh_status(std::error_code& ec) { // FD must be open and good. m_status = file_status{}; - m_stat = StatT{}; + m_stat = {}; std::error_code m_ec; if (::fstat(fd, &m_stat) == -1) m_ec = capture_errno(); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r337666 - Fix use of C++14 syntax in C++11 filesystem tests.
Author: ericwf Date: Sun Jul 22 20:41:46 2018 New Revision: 337666 URL: http://llvm.org/viewvc/llvm-project?rev=337666&view=rev Log: Fix use of C++14 syntax in C++11 filesystem tests. Modified: libcxx/trunk/test/support/format_string.hpp Modified: libcxx/trunk/test/support/format_string.hpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/format_string.hpp?rev=337666&r1=337665&r2=337666&view=diff == --- libcxx/trunk/test/support/format_string.hpp (original) +++ libcxx/trunk/test/support/format_string.hpp Sun Jul 22 20:41:46 2018 @@ -11,7 +11,9 @@ inline std::string format_string_imp(con // we might need a second shot at this, so pre-emptivly make a copy struct GuardVAList { va_list& target; -bool active = true; +bool active; +GuardVAList(va_list& target) : target(target), active(true) {} + void clear() { if (active) va_end(target); @@ -24,11 +26,11 @@ inline std::string format_string_imp(con }; va_list args; va_start(args, msg); - GuardVAList args_guard = {args}; + GuardVAList args_guard(args); va_list args_cp; va_copy(args_cp, args); - GuardVAList args_copy_guard = {args_cp}; + GuardVAList args_copy_guard(args_cp); std::array local_buff; std::size_t size = local_buff.size(); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r337669 - Use possibly cached directory entry values when performing recursive directory iteration.
Author: ericwf Date: Sun Jul 22 21:55:57 2018 New Revision: 337669 URL: http://llvm.org/viewvc/llvm-project?rev=337669&view=rev Log: Use possibly cached directory entry values when performing recursive directory iteration. Modified: libcxx/trunk/src/experimental/filesystem/directory_iterator.cpp Modified: libcxx/trunk/src/experimental/filesystem/directory_iterator.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/experimental/filesystem/directory_iterator.cpp?rev=337669&r1=337668&r2=337669&view=diff == --- libcxx/trunk/src/experimental/filesystem/directory_iterator.cpp (original) +++ libcxx/trunk/src/experimental/filesystem/directory_iterator.cpp Sun Jul 22 21:55:57 2018 @@ -359,13 +359,13 @@ bool recursive_directory_iterator::__try bool skip_rec = false; std::error_code m_ec; if (!rec_sym) { -file_status st = curr_it.__entry_.symlink_status(m_ec); +file_status st(curr_it.__entry_.__get_sym_ft(&m_ec)); if (m_ec && status_known(st)) m_ec.clear(); if (m_ec || is_symlink(st) || !is_directory(st)) skip_rec = true; } else { -file_status st = curr_it.__entry_.status(m_ec); +file_status st(curr_it.__entry_.__get_ft(&m_ec)); if (m_ec && status_known(st)) m_ec.clear(); if (m_ec || !is_directory(st)) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r337684 - Cleanup name qualification in the filesystem internals.
Author: ericwf Date: Mon Jul 23 04:46:47 2018 New Revision: 337684 URL: http://llvm.org/viewvc/llvm-project?rev=337684&view=rev Log: Cleanup name qualification in the filesystem internals. In most cases there is no reason why the filesystem internals use the qualifier std:: or _VSTD::. This patch removes the unneeded qualifiers, making the sources files more consistent Modified: libcxx/trunk/src/experimental/filesystem/directory_iterator.cpp libcxx/trunk/src/experimental/filesystem/filesystem_common.h libcxx/trunk/src/experimental/filesystem/operations.cpp Modified: libcxx/trunk/src/experimental/filesystem/directory_iterator.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/experimental/filesystem/directory_iterator.cpp?rev=337684&r1=337683&r2=337684&view=diff == --- libcxx/trunk/src/experimental/filesystem/directory_iterator.cpp (original) +++ libcxx/trunk/src/experimental/filesystem/directory_iterator.cpp Mon Jul 23 04:46:47 2018 @@ -98,8 +98,8 @@ public: __dir_stream& operator=(const __dir_stream&) = delete; __dir_stream(__dir_stream&& __ds) noexcept - : __stream_(__ds.__stream_), __root_(std::move(__ds.__root_)), -__entry_(std::move(__ds.__entry_)) { + : __stream_(__ds.__stream_), __root_(move(__ds.__root_)), +__entry_(move(__ds.__entry_)) { __ds.__stream_ = INVALID_HANDLE_VALUE; } @@ -107,7 +107,7 @@ public: : __stream_(INVALID_HANDLE_VALUE), __root_(root) { __stream_ = ::FindFirstFileEx(root.c_str(), &__data_); if (__stream_ == INVALID_HANDLE_VALUE) { - ec = error_code(::GetLastError(), std::generic_category()); + ec = error_code(::GetLastError(), generic_category()); const bool ignore_permission_denied = bool(opts & directory_options::skip_permission_denied); if (ignore_permission_denied && ec.value() == ERROR_ACCESS_DENIED) @@ -138,16 +138,16 @@ public: directory_entry::__create_iter_result(get_file_type(__data))); return true; } -ec = error_code(::GetLastError(), std::generic_category()); +ec = error_code(::GetLastError(), generic_category()); close(); return false; } private: - std::error_code close() noexcept { -std::error_code ec; + error_code close() noexcept { +error_code ec; if (!::FindClose(__stream_)) - ec = error_code(::GetLastError(), std::generic_category()); + ec = error_code(::GetLastError(), generic_category()); __stream_ = INVALID_HANDLE_VALUE; return ec; } @@ -166,8 +166,8 @@ public: __dir_stream& operator=(const __dir_stream&) = delete; __dir_stream(__dir_stream&& other) noexcept -: __stream_(other.__stream_), __root_(std::move(other.__root_)), - __entry_(std::move(other.__entry_)) +: __stream_(other.__stream_), __root_(move(other.__root_)), + __entry_(move(other.__entry_)) { other.__stream_ = nullptr; } @@ -211,8 +211,8 @@ public: } } private: -std::error_code close() noexcept { -std::error_code m_ec; +error_code close() noexcept { +error_code m_ec; if (::closedir(__stream_) == -1) m_ec = detail::capture_errno(); __stream_ = nullptr; @@ -233,7 +233,7 @@ directory_iterator::directory_iterator(c { ErrorHandler err("directory_iterator::directory_iterator(...)", ec, &p); - std::error_code m_ec; + error_code m_ec; __imp_ = make_shared<__dir_stream>(p, opts, m_ec); if (ec) *ec = m_ec; @@ -249,9 +249,9 @@ directory_iterator& directory_iterator:: _LIBCPP_ASSERT(__imp_, "Attempting to increment an invalid iterator"); ErrorHandler err("directory_iterator::operator++()", ec); -std::error_code m_ec; +error_code m_ec; if (!__imp_->advance(m_ec)) { - path root = std::move(__imp_->__root_); + path root = move(__imp_->__root_); __imp_.reset(); if (m_ec) err.report(m_ec, "at root \"%s\"", root); @@ -278,16 +278,16 @@ recursive_directory_iterator::recursive_ { ErrorHandler err("recursive_directory_iterator", ec, &p); - std::error_code m_ec; + error_code m_ec; __dir_stream new_s(p, opt, m_ec); if (m_ec) err.report(m_ec); if (m_ec || !new_s.good()) return; - __imp_ = _VSTD::make_shared<__shared_imp>(); + __imp_ = make_shared<__shared_imp>(); __imp_->__options_ = opt; - __imp_->__stack_.push(_VSTD::move(new_s)); + __imp_->__stack_.push(move(new_s)); } void recursive_directory_iterator::__pop(error_code* ec) @@ -331,7 +331,7 @@ void recursive_directory_iterator::__adv const directory_iterator end_it; auto& stack = __imp_->__stack_; - std::error_code m_ec; + error_code m_ec; while (stack.size() > 0) { if (stack.top().advance(m_ec)) return; @@ -341,7 +341,7 @@ void recursive_directory_iterator::__adv } if (m_ec) { - path root = std::m
[libcxx] r337685 - Cleanup unnecessary conversions in filesystem.
Author: ericwf Date: Mon Jul 23 04:55:13 2018 New Revision: 337685 URL: http://llvm.org/viewvc/llvm-project?rev=337685&view=rev Log: Cleanup unnecessary conversions in filesystem. Modified: libcxx/trunk/src/experimental/filesystem/operations.cpp Modified: libcxx/trunk/src/experimental/filesystem/operations.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/experimental/filesystem/operations.cpp?rev=337685&r1=337684&r2=337685&view=diff == --- libcxx/trunk/src/experimental/filesystem/operations.cpp (original) +++ libcxx/trunk/src/experimental/filesystem/operations.cpp Mon Jul 23 04:55:13 2018 @@ -727,10 +727,10 @@ bool __copy_file(const path& from, const const bool to_exists = exists(to_st); if (to_exists && !is_regular_file(to_st)) -return err.report(make_error_code(errc::not_supported)); +return err.report(errc::not_supported); if (to_exists && detail::stat_equivalent(from_stat, to_stat_path)) -return err.report(make_error_code(errc::file_exists)); +return err.report(errc::file_exists); if (to_exists && skip_existing) return false; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [libcxx] r337669 - Use possibly cached directory entry values when performing recursive directory iteration.
Thanks. I'm looking into this. /Eric On Mon, Jul 23, 2018 at 12:58 PM Jonas Hahnfeld wrote: > Hi Eric, > > this breaks > test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp > > for me: > In access_denied_on_recursion_test_case():176 Assertion TEST_CHECK(ec) > failed. > in file: > > <<>>/projects/libcxx/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp > > In access_denied_on_recursion_test_case():177 Assertion TEST_CHECK(it == > endIt) failed. > in file: > > <<>>/projects/libcxx/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp > > In access_denied_on_recursion_test_case():189 Assertion > TEST_REQUIRE_THROW(filesystem_error,++it) failed. > in file: > > <<>>/projects/libcxx/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp > > In test_PR35078():285 Assertion TEST_REQUIRE(it != endIt) failed. > in file: > > <<>>/projects/libcxx/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp > > In test_PR35078_with_symlink():384 Assertion TEST_CHECK(ec) failed. > in file: > > <<>>/projects/libcxx/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp > > In test_PR35078_with_symlink():385 Assertion TEST_CHECK(ec == eacess_ec) > failed. > in file: > > <<>>/projects/libcxx/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp > > In test_PR35078_with_symlink_file():461 Assertion TEST_CHECK(*it == > symFile) failed. > in file: > > <<>>/projects/libcxx/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp > > In test_PR35078_with_symlink_file():467 Assertion TEST_REQUIRE(it != > EndIt) failed. > in file: > > <<>>/projects/libcxx/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp > > Summary for testsuite recursive_directory_iterator_increment_tests: > 5 of 9 test cases passed. > 156 of 164 assertions passed. > 0 unsupported test cases. > > Do you have an idea? I'm on a local XFS mount, the sources are on NFS... > > Thanks, > Jonas > > On 2018-07-23 06:55, Eric Fiselier via cfe-commits wrote: > > Author: ericwf > > Date: Sun Jul 22 21:55:57 2018 > > New Revision: 337669 > > > > URL: http://llvm.org/viewvc/llvm-project?rev=337669&view=rev > > Log: > > Use possibly cached directory entry values when performing recursive > > directory iteration. > > > > Modified: > > libcxx/trunk/src/experimental/filesystem/directory_iterator.cpp > > > > Modified: > > libcxx/trunk/src/experimental/filesystem/directory_iterator.cpp > > URL: > > > http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/experimental/filesystem/directory_iterator.cpp?rev=337669&r1=337668&r2=337669&view=diff > > > == > > --- libcxx/trunk/src/experimental/filesystem/directory_iterator.cpp > > (original) > > +++ libcxx/trunk/src/experimental/filesystem/directory_iterator.cpp > > Sun Jul 22 21:55:57 2018 > > @@ -359,13 +359,13 @@ bool recursive_directory_iterator::__try > >bool skip_rec = false; > >std::error_code m_ec; > >if (!rec_sym) { > > -file_status st = curr_it.__entry_.symlink_status(m_ec); > > +file_status st(curr_it.__entry_.__get_sym_ft(&m_ec)); > > if (m_ec && status_known(st)) > >m_ec.clear(); > > if (m_ec || is_symlink(st) || !is_directory(st)) > >skip_rec = true; > >} else { > > -file_status st = curr_it.__entry_.status(m_ec); > > +file_status st(curr_it.__entry_.__get_ft(&m_ec)); > > if (m_ec && status_known(st)) > >m_ec.clear(); > > if (m_ec || !is_directory(st)) > > > > > > ___ > > cfe-commits mailing list > > cfe-commits@lists.llvm.org > > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits > ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r337749 - Revert "Use possibly cached directory entry values when performing recursive directory iteration."
Author: ericwf Date: Mon Jul 23 14:52:29 2018 New Revision: 337749 URL: http://llvm.org/viewvc/llvm-project?rev=337749&view=rev Log: Revert "Use possibly cached directory entry values when performing recursive directory iteration." This reverts commit 04ce4aef00d3ee508327f6cf7bf1b1d200ab6238. Modified: libcxx/trunk/src/experimental/filesystem/directory_iterator.cpp Modified: libcxx/trunk/src/experimental/filesystem/directory_iterator.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/experimental/filesystem/directory_iterator.cpp?rev=337749&r1=337748&r2=337749&view=diff == --- libcxx/trunk/src/experimental/filesystem/directory_iterator.cpp (original) +++ libcxx/trunk/src/experimental/filesystem/directory_iterator.cpp Mon Jul 23 14:52:29 2018 @@ -359,13 +359,13 @@ bool recursive_directory_iterator::__try bool skip_rec = false; error_code m_ec; if (!rec_sym) { -file_status st(curr_it.__entry_.__get_sym_ft(&m_ec)); +file_status st = curr_it.__entry_.symlink_status(m_ec); if (m_ec && status_known(st)) m_ec.clear(); if (m_ec || is_symlink(st) || !is_directory(st)) skip_rec = true; } else { -file_status st(curr_it.__entry_.__get_ft(&m_ec)); +file_status st = curr_it.__entry_.status(m_ec); if (m_ec && status_known(st)) m_ec.clear(); if (m_ec || !is_directory(st)) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [libcxx] r337669 - Use possibly cached directory entry values when performing recursive directory iteration.
I think I've found the bug, but I need to spend some more time on it. I've reverted in for now in r337749. /Eric On Mon, Jul 23, 2018 at 1:25 PM Eric Fiselier wrote: > Thanks. I'm looking into this. > > /Eric > > On Mon, Jul 23, 2018 at 12:58 PM Jonas Hahnfeld wrote: > >> Hi Eric, >> >> this breaks >> test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp >> >> for me: >> In access_denied_on_recursion_test_case():176 Assertion TEST_CHECK(ec) >> failed. >> in file: >> >> <<>>/projects/libcxx/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp >> >> In access_denied_on_recursion_test_case():177 Assertion TEST_CHECK(it == >> endIt) failed. >> in file: >> >> <<>>/projects/libcxx/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp >> >> In access_denied_on_recursion_test_case():189 Assertion >> TEST_REQUIRE_THROW(filesystem_error,++it) failed. >> in file: >> >> <<>>/projects/libcxx/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp >> >> In test_PR35078():285 Assertion TEST_REQUIRE(it != endIt) failed. >> in file: >> >> <<>>/projects/libcxx/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp >> >> In test_PR35078_with_symlink():384 Assertion TEST_CHECK(ec) failed. >> in file: >> >> <<>>/projects/libcxx/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp >> >> In test_PR35078_with_symlink():385 Assertion TEST_CHECK(ec == eacess_ec) >> failed. >> in file: >> >> <<>>/projects/libcxx/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp >> >> In test_PR35078_with_symlink_file():461 Assertion TEST_CHECK(*it == >> symFile) failed. >> in file: >> >> <<>>/projects/libcxx/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp >> >> In test_PR35078_with_symlink_file():467 Assertion TEST_REQUIRE(it != >> EndIt) failed. >> in file: >> >> <<>>/projects/libcxx/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp >> >> Summary for testsuite recursive_directory_iterator_increment_tests: >> 5 of 9 test cases passed. >> 156 of 164 assertions passed. >> 0 unsupported test cases. >> >> Do you have an idea? I'm on a local XFS mount, the sources are on NFS... >> >> Thanks, >> Jonas >> >> On 2018-07-23 06:55, Eric Fiselier via cfe-commits wrote: >> > Author: ericwf >> > Date: Sun Jul 22 21:55:57 2018 >> > New Revision: 337669 >> > >> > URL: http://llvm.org/viewvc/llvm-project?rev=337669&view=rev >> > Log: >> > Use possibly cached directory entry values when performing recursive >> > directory iteration. >> > >> > Modified: >> > libcxx/trunk/src/experimental/filesystem/directory_iterator.cpp >> > >> > Modified: >> > libcxx/trunk/src/experimental/filesystem/directory_iterator.cpp >> > URL: >> > >> http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/experimental/filesystem/directory_iterator.cpp?rev=337669&r1=337668&r2=337669&view=diff >> > >> == >> > --- libcxx/trunk/src/experimental/filesystem/directory_iterator.cpp >> > (original) >> > +++ libcxx/trunk/src/experimental/filesystem/directory_iterator.cpp >> > Sun Jul 22 21:55:57 2018 >> > @@ -359,13 +359,13 @@ bool recursive_directory_iterator::__try >> >bool skip_rec = false; >> >std::error_code m_ec; >> >if (!rec_sym) { >> > -file_status st = curr_it.__entry_.symlink_status(m_ec); >> > +file_status st(curr_it.__entry_.__get_sym_ft(&m_ec)); >> > if (m_ec && status_known(st)) >> >m_ec.clear(); >> > if (m_ec || is_symlink(st) || !is_directory(st)) >> >skip_rec = true; >> >} else { >> > -file_status st = curr_it.__entry_.status(m_ec); >> > +file_status st(curr_it.__entry_.__get_ft(&m_ec)); >> > if (m_ec && status_known(st)) >> >m_ec.clear(); >> > if (m_ec || !is_directory(st)) >> > >> > >> > ___ >> > cfe-commits mailing list >> > cfe-commits@lists.llvm.org >> > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits >> > ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r337764 - Fix accidentally removed test.
Author: ericwf Date: Mon Jul 23 15:39:56 2018 New Revision: 337764 URL: http://llvm.org/viewvc/llvm-project?rev=337764&view=rev Log: Fix accidentally removed test. When adding the new tests for the filesystem_error::what method, I incorrectly removed a test case and replaced it with something else. This patch restores that test case Modified: libcxx/trunk/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp Modified: libcxx/trunk/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp?rev=337764&r1=337763&r2=337764&view=diff == --- libcxx/trunk/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp (original) +++ libcxx/trunk/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp Mon Jul 23 15:39:56 2018 @@ -25,8 +25,6 @@ #include "rapid-cxx-test.hpp" #include "filesystem_test_helper.hpp" -#include - using namespace fs; TEST_SUITE(recursive_directory_iterator_increment_tests) @@ -292,6 +290,21 @@ TEST_CASE(test_PR35078) } { bool SeenNestedFile = false; + recursive_directory_iterator it = SetupState(true, SeenNestedFile); + TEST_REQUIRE(it != endIt); + TEST_REQUIRE(*it == nestedDir); + ec = GetTestEC(); + it.increment(ec); + TEST_CHECK(!ec); + if (SeenNestedFile) { +TEST_CHECK(it == endIt); + } else { +TEST_REQUIRE(it != endIt); +TEST_CHECK(*it == nestedFile); + } +} +{ + bool SeenNestedFile = false; recursive_directory_iterator it = SetupState(false, SeenNestedFile); TEST_REQUIRE(it != endIt); TEST_REQUIRE(*it == nestedDir); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r337765 - Recommit "Use possibly cached directory entry values when performing recursive directory iteration."
Author: ericwf Date: Mon Jul 23 15:40:41 2018 New Revision: 337765 URL: http://llvm.org/viewvc/llvm-project?rev=337765&view=rev Log: Recommit "Use possibly cached directory entry values when performing recursive directory iteration." The initial patch didn't correctly handle systems when the dirent struct didn't provide the d_type member. Specifically it set the cache to the incorrect state, and claimed it was partially populated. The updated version of this change correctly handles setting up the cache when the file type is not known (aka file_type::none). Modified: libcxx/trunk/include/experimental/filesystem libcxx/trunk/src/experimental/filesystem/directory_iterator.cpp Modified: libcxx/trunk/include/experimental/filesystem URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/experimental/filesystem?rev=337765&r1=337764&r2=337765&view=diff == --- libcxx/trunk/include/experimental/filesystem (original) +++ libcxx/trunk/include/experimental/filesystem Mon Jul 23 15:40:41 2018 @@ -2200,8 +2200,16 @@ private: static __cached_data __create_iter_result(file_type __ft) { __cached_data __data; __data.__type_ = __ft; - __data.__cache_type_ = - __ft == file_type::symlink ? _IterSymlink : _IterNonSymlink; + __data.__cache_type_ = [&]() { + switch (__ft) { + case file_type::none: +return _Empty; + case file_type::symlink: +return _IterSymlink; + default: +return _IterNonSymlink; + } + }(); return __data; } Modified: libcxx/trunk/src/experimental/filesystem/directory_iterator.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/experimental/filesystem/directory_iterator.cpp?rev=337765&r1=337764&r2=337765&view=diff == --- libcxx/trunk/src/experimental/filesystem/directory_iterator.cpp (original) +++ libcxx/trunk/src/experimental/filesystem/directory_iterator.cpp Mon Jul 23 15:40:41 2018 @@ -47,9 +47,10 @@ static file_type get_file_type(DirEntT * } return file_type::none; } + template static file_type get_file_type(DirEntT *ent, long) { - return file_type::unknown; + return file_type::none; } static pair @@ -359,13 +360,13 @@ bool recursive_directory_iterator::__try bool skip_rec = false; error_code m_ec; if (!rec_sym) { -file_status st = curr_it.__entry_.symlink_status(m_ec); +file_status st(curr_it.__entry_.__get_sym_ft(&m_ec)); if (m_ec && status_known(st)) m_ec.clear(); if (m_ec || is_symlink(st) || !is_directory(st)) skip_rec = true; } else { -file_status st = curr_it.__entry_.status(m_ec); +file_status st(curr_it.__entry_.__get_ft(&m_ec)); if (m_ec && status_known(st)) m_ec.clear(); if (m_ec || !is_directory(st)) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [libcxx] r337669 - Use possibly cached directory entry values when performing recursive directory iteration.
Hi Jonas, I believe I fixed the issue, and I've recommitted the change as r337765. Please let me know if you still see the failures. I think there might be a lingering issues with how we handle DT_UNKNOWN. /Eric On Mon, Jul 23, 2018 at 3:53 PM Eric Fiselier wrote: > I think I've found the bug, but I need to spend some more time on it. > > I've reverted in for now in r337749. > > /Eric > > On Mon, Jul 23, 2018 at 1:25 PM Eric Fiselier wrote: > >> Thanks. I'm looking into this. >> >> /Eric >> >> On Mon, Jul 23, 2018 at 12:58 PM Jonas Hahnfeld wrote: >> >>> Hi Eric, >>> >>> this breaks >>> test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp >>> >>> for me: >>> In access_denied_on_recursion_test_case():176 Assertion TEST_CHECK(ec) >>> failed. >>> in file: >>> >>> <<>>/projects/libcxx/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp >>> >>> In access_denied_on_recursion_test_case():177 Assertion TEST_CHECK(it == >>> endIt) failed. >>> in file: >>> >>> <<>>/projects/libcxx/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp >>> >>> In access_denied_on_recursion_test_case():189 Assertion >>> TEST_REQUIRE_THROW(filesystem_error,++it) failed. >>> in file: >>> >>> <<>>/projects/libcxx/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp >>> >>> In test_PR35078():285 Assertion TEST_REQUIRE(it != endIt) failed. >>> in file: >>> >>> <<>>/projects/libcxx/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp >>> >>> In test_PR35078_with_symlink():384 Assertion TEST_CHECK(ec) failed. >>> in file: >>> >>> <<>>/projects/libcxx/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp >>> >>> In test_PR35078_with_symlink():385 Assertion TEST_CHECK(ec == eacess_ec) >>> failed. >>> in file: >>> >>> <<>>/projects/libcxx/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp >>> >>> In test_PR35078_with_symlink_file():461 Assertion TEST_CHECK(*it == >>> symFile) failed. >>> in file: >>> >>> <<>>/projects/libcxx/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp >>> >>> In test_PR35078_with_symlink_file():467 Assertion TEST_REQUIRE(it != >>> EndIt) failed. >>> in file: >>> >>> <<>>/projects/libcxx/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp >>> >>> Summary for testsuite recursive_directory_iterator_increment_tests: >>> 5 of 9 test cases passed. >>> 156 of 164 assertions passed. >>> 0 unsupported test cases. >>> >>> Do you have an idea? I'm on a local XFS mount, the sources are on NFS... >>> >>> Thanks, >>> Jonas >>> >>> On 2018-07-23 06:55, Eric Fiselier via cfe-commits wrote: >>> > Author: ericwf >>> > Date: Sun Jul 22 21:55:57 2018 >>> > New Revision: 337669 >>> > >>> > URL: http://llvm.org/viewvc/llvm-project?rev=337669&view=rev >>> > Log: >>> > Use possibly cached directory entry values when performing recursive >>> > directory iteration. >>> > >>> > Modified: >>> > libcxx/trunk/src/experimental/filesystem/directory_iterator.cpp >>> > >>> > Modified: >>> > libcxx/trunk/src/experimental/filesystem/directory_iterator.cpp >>> > URL: >>> > >>> http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/experimental/filesystem/directory_iterator.cpp?rev=337669&r1=337668&r2=337669&view=diff >>> > >>> == >>> > --- libcxx/trunk/src/experimental/filesystem/directory_iterator.cpp >>> > (original) >>> > +++ libcxx/trunk/src/experimental/filesystem/directory_iterator.cpp >>> > Sun Jul 22 21:55:57 2018 >>> > @@ -359,13 +359,13 @@ bool recursive_directory_iterator::__try >>> >bool skip_rec = false; >>> >std::error_code m_ec; >>> >if (!rec_sym) { >>> > -file_status st = curr_it.__entry_.symlink_status(m_ec); >>> > +file_status st(curr_it.__entry_.__get_sym_ft(&m_ec)); >>> > if (m_ec && status_known(st)) >>> >m_ec.clear(); >>> > if (m_ec || is_symlink(st) || !is_directory(st)) >>> >skip_rec = true; >>> >} else { >>> > -file_status st = curr_it.__entry_.status(m_ec); >>> > +file_status st(curr_it.__entry_.__get_ft(&m_ec)); >>> > if (m_ec && status_known(st)) >>> >m_ec.clear(); >>> > if (m_ec || !is_directory(st)) >>> > >>> > >>> > ___ >>> > cfe-commits mailing list >>> > cfe-commits@lists.llvm.org >>> > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits >>> >> ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r337768 - Handle DT_UNKNOWN correctly during directory iteration.
Author: ericwf Date: Mon Jul 23 15:58:46 2018 New Revision: 337768 URL: http://llvm.org/viewvc/llvm-project?rev=337768&view=rev Log: Handle DT_UNKNOWN correctly during directory iteration. Unlike stat and lstat, where unknown really means we know it's something weird, during directory iteration DT_UNKNOWN simply means that the underlying FS doesn't support the dirent::dt_type field. This patch fixes libc++ to correctly set the cache to empty when DT_UNKNOWN is reported. Modified: libcxx/trunk/src/experimental/filesystem/directory_iterator.cpp Modified: libcxx/trunk/src/experimental/filesystem/directory_iterator.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/experimental/filesystem/directory_iterator.cpp?rev=337768&r1=337767&r2=337768&view=diff == --- libcxx/trunk/src/experimental/filesystem/directory_iterator.cpp (original) +++ libcxx/trunk/src/experimental/filesystem/directory_iterator.cpp Mon Jul 23 15:58:46 2018 @@ -42,8 +42,11 @@ static file_type get_file_type(DirEntT * return file_type::regular; case DT_SOCK: return file_type::socket; + // Unlike in lstat, hitting "unknown" here simply means that the underlying + // filesystem doesn't support d_type. Report is as 'none' so we correctly + // set the cache to empty. case DT_UNKNOWN: -return file_type::unknown; +break; } return file_type::none; } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [libcxx] r337669 - Use possibly cached directory entry values when performing recursive directory iteration.
Sorry for the repeated emails. I did more digging and we were indeed handling DT_UNKNOWN incorrectly. I've fixed that in r337768. /Eric On Mon, Jul 23, 2018 at 4:43 PM Eric Fiselier wrote: > Hi Jonas, > > I believe I fixed the issue, and I've recommitted the change as r337765. > Please let me know if you still see the failures. I think there might be a > lingering issues with how we handle DT_UNKNOWN. > > /Eric > > On Mon, Jul 23, 2018 at 3:53 PM Eric Fiselier wrote: > >> I think I've found the bug, but I need to spend some more time on it. >> >> I've reverted in for now in r337749. >> >> /Eric >> >> On Mon, Jul 23, 2018 at 1:25 PM Eric Fiselier wrote: >> >>> Thanks. I'm looking into this. >>> >>> /Eric >>> >>> On Mon, Jul 23, 2018 at 12:58 PM Jonas Hahnfeld >>> wrote: >>> >>>> Hi Eric, >>>> >>>> this breaks >>>> test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp >>>> >>>> for me: >>>> In access_denied_on_recursion_test_case():176 Assertion TEST_CHECK(ec) >>>> failed. >>>> in file: >>>> >>>> <<>>/projects/libcxx/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp >>>> >>>> In access_denied_on_recursion_test_case():177 Assertion TEST_CHECK(it >>>> == >>>> endIt) failed. >>>> in file: >>>> >>>> <<>>/projects/libcxx/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp >>>> >>>> In access_denied_on_recursion_test_case():189 Assertion >>>> TEST_REQUIRE_THROW(filesystem_error,++it) failed. >>>> in file: >>>> >>>> <<>>/projects/libcxx/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp >>>> >>>> In test_PR35078():285 Assertion TEST_REQUIRE(it != endIt) failed. >>>> in file: >>>> >>>> <<>>/projects/libcxx/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp >>>> >>>> In test_PR35078_with_symlink():384 Assertion TEST_CHECK(ec) failed. >>>> in file: >>>> >>>> <<>>/projects/libcxx/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp >>>> >>>> In test_PR35078_with_symlink():385 Assertion TEST_CHECK(ec == >>>> eacess_ec) >>>> failed. >>>> in file: >>>> >>>> <<>>/projects/libcxx/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp >>>> >>>> In test_PR35078_with_symlink_file():461 Assertion TEST_CHECK(*it == >>>> symFile) failed. >>>> in file: >>>> >>>> <<>>/projects/libcxx/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp >>>> >>>> In test_PR35078_with_symlink_file():467 Assertion TEST_REQUIRE(it != >>>> EndIt) failed. >>>> in file: >>>> >>>> <<>>/projects/libcxx/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp >>>> >>>> Summary for testsuite recursive_directory_iterator_increment_tests: >>>> 5 of 9 test cases passed. >>>> 156 of 164 assertions passed. >>>> 0 unsupported test cases. >>>> >>>> Do you have an idea? I'm on a local XFS mount, the sources are on NFS... >>>> >>>> Thanks, >>>> Jonas >>>> >>>> On 2018-07-23 06:55, Eric Fiselier via cfe-commits wrote: >>>> > Author: ericwf >>>> > Date: Sun Jul 22 21:55:57 2018 >>>> > New Revision: 337669 >>>> > >>>> > URL: http://llvm.org/viewvc/llvm-project?rev=337669&view=rev >>>> > Log: >>>> > Use possibly cached directory entry values when performing recursive >>>> > directory iteration. >>>> > >>>> > Modified: >>>> > libcxx/trunk/src/experimental/filesystem/directory_iterator.cpp >>>> > >>>> > Modified: >>>> > libcxx/trunk/src/experimental/filesystem/directory_iterator.cpp >>>> > URL: >>>> > >
Re: [libcxx] r337669 - Use possibly cached directory entry values when performing recursive directory iteration.
Great, thanks for letting me know. On Tue, Jul 24, 2018, 1:05 AM Jonas Hahnfeld, wrote: > Thanks for your work, the test is now passing on my system. > > Cheers, > Jonas > > On 2018-07-24 01:00, Eric Fiselier wrote: > > Sorry for the repeated emails. I did more digging and we were indeed > > handling DT_UNKNOWN incorrectly. > > I've fixed that in r337768. > > > > /Eric > > > > On Mon, Jul 23, 2018 at 4:43 PM Eric Fiselier wrote: > > > >> Hi Jonas, > >> > >> I believe I fixed the issue, and I've recommitted the change as > >> r337765. > >> Please let me know if you still see the failures. I think there > >> might be a lingering issues with how we handle DT_UNKNOWN. > >> > >> /Eric > >> > >> On Mon, Jul 23, 2018 at 3:53 PM Eric Fiselier wrote: > >> > >> I think I've found the bug, but I need to spend some more time on > >> it. > >> > >> I've reverted in for now in r337749. > >> > >> /Eric > >> > >> On Mon, Jul 23, 2018 at 1:25 PM Eric Fiselier wrote: > >> > >> Thanks. I'm looking into this. > >> > >> /Eric > >> > >> On Mon, Jul 23, 2018 at 12:58 PM Jonas Hahnfeld > >> wrote: > >> Hi Eric, > >> > >> this breaks > >> > > > test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp > >> > >> for me: > >> In access_denied_on_recursion_test_case():176 Assertion > >> TEST_CHECK(ec) > >> failed. > >> in file: > >> > > > <<>>/projects/libcxx/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp > >> > >> In access_denied_on_recursion_test_case():177 Assertion > >> TEST_CHECK(it == > >> endIt) failed. > >> in file: > >> > > > <<>>/projects/libcxx/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp > >> > >> In access_denied_on_recursion_test_case():189 Assertion > >> TEST_REQUIRE_THROW(filesystem_error,++it) failed. > >> in file: > >> > > > <<>>/projects/libcxx/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp > >> > >> In test_PR35078():285 Assertion TEST_REQUIRE(it != endIt) failed. > >> in file: > >> > > > <<>>/projects/libcxx/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp > >> > >> In test_PR35078_with_symlink():384 Assertion TEST_CHECK(ec) failed. > >> in file: > >> > > > <<>>/projects/libcxx/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp > >> > >> In test_PR35078_with_symlink():385 Assertion TEST_CHECK(ec == > >> eacess_ec) > >> failed. > >> in file: > >> > > > <<>>/projects/libcxx/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp > >> > >> In test_PR35078_with_symlink_file():461 Assertion TEST_CHECK(*it == > >> symFile) failed. > >> in file: > >> > > > <<>>/projects/libcxx/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp > >> > >> In test_PR35078_with_symlink_file():467 Assertion TEST_REQUIRE(it != > >> > >> EndIt) failed. > >> in file: > >> > > > <<>>/projects/libcxx/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/increment.pass.cpp > >> > >> Summary for testsuite recursive_directory_iterator_increment_tests: > >> 5 of 9 test cases passed. > >> 156 of 164 assertions passed. > >> 0 unsupported test cases. > >> > >> Do you have an idea? I'm on a local XFS mount, the sources are on > >> NFS... > >> > >> Thanks, > >> Jonas > >> > >> On 2018-07-23 06:55, Eric Fiselier via cfe-commits wrote: > >>> Author: ericwf > >>> Date: Sun Jul 22 21:55:57 2018 > >>> New Revision: 337669 > >>> > >>> URL: http://llvm.org/viewvc/llvm-project?rev=337669&view=rev > >>> Log: > >>> Use possibly cached directory entry values when performing > >> recursive > >>> directory iteration. > >>> > >>> Modified: > >>> > >> libcx
[libcxx] r337817 - Fix use of incorrect _LIBCXX macro (should be _LIBCPP).
Author: ericwf Date: Tue Jul 24 02:15:03 2018 New Revision: 337817 URL: http://llvm.org/viewvc/llvm-project?rev=337817&view=rev Log: Fix use of incorrect _LIBCXX macro (should be _LIBCPP). Modified: libcxx/trunk/include/future Modified: libcxx/trunk/include/future URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/future?rev=337817&r1=337816&r2=337817&view=diff == --- libcxx/trunk/include/future (original) +++ libcxx/trunk/include/future Tue Jul 24 02:15:03 2018 @@ -409,7 +409,7 @@ _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(launc #ifndef _LIBCPP_HAS_NO_STRONG_ENUMS -#ifdef _LIBCXX_UNDERLYING_TYPE +#ifdef _LIBCPP_UNDERLYING_TYPE typedef underlying_type::type __launch_underlying_type; #else typedef int __launch_underlying_type; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r337880 - Add design docs for upcoming file_time_type change.
Author: ericwf Date: Tue Jul 24 19:53:53 2018 New Revision: 337880 URL: http://llvm.org/viewvc/llvm-project?rev=337880&view=rev Log: Add design docs for upcoming file_time_type change. In upcoming changes to filesystem I plan to change file_time_type to use __int128_t as its underlying representation, in order to allow it to have a range and resolution at least that of the timespec struct. There was some pushback against this decision, so I drafted a document explaining the problems, potential solutions, and the rational for the decision. However, it's probably easier to let people read the generated HTML rather than the raw restructured text. For this reason I'm commiting the design documents before hand, so they can be available during any subsequent discussion or code review. Added: libcxx/trunk/docs/DesignDocs/FileTimeType.rst Modified: libcxx/trunk/docs/Makefile.sphinx libcxx/trunk/docs/index.rst Added: libcxx/trunk/docs/DesignDocs/FileTimeType.rst URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/docs/DesignDocs/FileTimeType.rst?rev=337880&view=auto == --- libcxx/trunk/docs/DesignDocs/FileTimeType.rst (added) +++ libcxx/trunk/docs/DesignDocs/FileTimeType.rst Tue Jul 24 19:53:53 2018 @@ -0,0 +1,493 @@ +== +File Time Type +== + +.. contents:: + :local: + +.. _file-time-type-motivation: + +Motivation +== + +The filesystem library provides interfaces for getting and setting the last +write time of a file or directory. The interfaces use the ``file_time_type`` +type, which is a specialization of ``chrono::time_point`` for the +"filesystem clock". According to [fs.filesystem.syn] + + trivial-clock is an implementation-defined type that satisfies the + Cpp17TrivialClock requirements ([time.clock.req]) and that is capable of + representing and measuring file time values. Implementations should ensure + that the resolution and range of file_Âtime_Âtype reflect the operating + system dependent resolution and range of file time values. + + +On POSIX systems, file times are represented using the ``timespec`` struct, +which is defined as follows: + +.. code-block:: cpp + + struct timespec { +time_t tv_sec; +long tv_nsec; + }; + +To represent the range and resolution of ``timespec``, we need to (A) have +nanosecond resolution, and (B) use more than 64 bits (assuming a 64 bit ``time_t``). + +As the standard requires us to use the ``chrono`` interface, we have to define +our own filesystem clock which specifies the period and representation of +the time points and duration it provides. It will look like this: + +.. code-block:: cpp + + struct _FilesystemClock { +using period = nano; +using rep = TBD; // What is this? + +using duration = chrono::duration; +using time_point = chrono::time_point<_FilesystemClock>; + +// ... // + }; + + using file_time_type = _FilesystemClock::time_point; + + +To get nanosecond resolution, we simply define ``period`` to be ``std::nano``. +But what type can we use as the arithmetic representation that is capable +of representing the range of the ``timespec`` struct? + +Problems To Consider + + +Before considering solutions, lets consider the problems they should solve, +and how important solving those problems are: + + +Having a Smaller Range than ``timespec`` + + +One solution to the range problem is to simply reduce the resolution of +``file_time_type`` to be less than that of nanoseconds. This is what libc++'s +initial implementation of ``file_time_type`` did; it's also what +``std::system_clock`` does. As a result, it can represent time points about +292 thousand years on either side of the epoch, as opposed to only 292 years +at nanosecond resolution. + +``timespec`` can represent time points +/- 292 billion years from the epoch +(just in case you needed a time point 200 billion years before the big bang, +and with nanosecond resolution). + +To get the same range, we would need to drop our resolution to that of seconds +to come close to having the same range. + +This begs the question, is the range problem "really a problem"? Sane usages +of file time stamps shouldn't exceed +/- 300, so should we care to support it? + +I believe the answer is yes. We're not designing the filesystem time API, we're +providing glorified C++ wrappers for it. If the underlying API supports +a value, then we should too. Our wrappers should not place artificial restrictions +on users that are not present in the underlying filesystem. + +Additionally, having a smaller range that the underlying filesystem forces the +implementation to report ``value_too_large`` errors when it encounters a time +point that it can't represent. This can cause the call to ``last_write_time`` +to throw in cases where the user was confident the call should succeed. (See below) + + +.. code-block:
[libcxx] r337883 - Ensure path::iterator and PathParser share the same enumeration values.
Author: ericwf Date: Tue Jul 24 20:31:48 2018 New Revision: 337883 URL: http://llvm.org/viewvc/llvm-project?rev=337883&view=rev Log: Ensure path::iterator and PathParser share the same enumeration values. To avoid exposing implementation details, path::iterator and PathParser both implicitly used the same set of values to represent the state, but they were defined twice. This could have lead to a mismatch occuring. This patch moves all of the parser state values into the filesystem header and changes PathParser to use those value to avoid this. Modified: libcxx/trunk/include/experimental/filesystem libcxx/trunk/src/experimental/filesystem/operations.cpp Modified: libcxx/trunk/include/experimental/filesystem URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/experimental/filesystem?rev=337883&r1=337882&r2=337883&view=diff == --- libcxx/trunk/include/experimental/filesystem (original) +++ libcxx/trunk/include/experimental/filesystem Tue Jul 24 20:31:48 2018 @@ -1037,7 +1037,7 @@ public: _LIBCPP_INLINE_VISIBILITY path extension() const { return string_type(__extension()); } // query -_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY +_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY bool empty() const _NOEXCEPT { return __pn_.empty(); } _LIBCPP_INLINE_VISIBILITY bool has_root_name() const { return !__root_name().empty(); } @@ -1170,6 +1170,17 @@ u8path(_InputIt __f, _InputIt __l) { class _LIBCPP_TYPE_VIS path::iterator { public: +enum _ParserState : unsigned char { + _Singular, + _BeforeBegin, + _InRootName, + _InRootDir, + _InFilenames, + _InTrailingSep, + _AtEnd +}; + +public: typedef bidirectional_iterator_tag iterator_category; typedef path value_type; @@ -1178,10 +1189,11 @@ public: typedef const path&reference; typedef void __stashing_iterator_tag; // See reverse_iterator and __is_stashing_iterator + public: _LIBCPP_INLINE_VISIBILITY iterator() : __stashed_elem_(), __path_ptr_(nullptr), - __entry_(), __state_(__singular) {} + __entry_(), __state_(_Singular) {} iterator(const iterator&) = default; ~iterator() = default; @@ -1200,9 +1212,9 @@ public: _LIBCPP_INLINE_VISIBILITY iterator& operator++() { -_LIBCPP_ASSERT(__state_ != __singular, +_LIBCPP_ASSERT(__state_ != _Singular, "attempting to increment a singular iterator"); -_LIBCPP_ASSERT(__state_ != __at_end, +_LIBCPP_ASSERT(__state_ != _AtEnd, "attempting to increment the end iterator"); return __increment(); } @@ -1216,7 +1228,7 @@ public: _LIBCPP_INLINE_VISIBILITY iterator& operator--() { -_LIBCPP_ASSERT(__state_ != __singular, +_LIBCPP_ASSERT(__state_ != _Singular, "attempting to decrement a singular iterator"); _LIBCPP_ASSERT(__entry_.data() != __path_ptr_->native().data(), "attempting to decrement the begin iterator"); @@ -1233,9 +1245,6 @@ public: private: friend class path; -static constexpr unsigned char __singular = 0; -static constexpr unsigned char __at_end = 6; - inline _LIBCPP_INLINE_VISIBILITY friend bool operator==(const iterator&, const iterator&); @@ -1245,7 +1254,7 @@ private: path __stashed_elem_; const path* __path_ptr_; path::__string_view __entry_; -unsigned char __state_; +_ParserState __state_; }; inline _LIBCPP_INLINE_VISIBILITY Modified: libcxx/trunk/src/experimental/filesystem/operations.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/experimental/filesystem/operations.cpp?rev=337883&r1=337882&r2=337883&view=diff == --- libcxx/trunk/src/experimental/filesystem/operations.cpp (original) +++ libcxx/trunk/src/experimental/filesystem/operations.cpp Tue Jul 24 20:31:48 2018 @@ -57,12 +57,12 @@ using PosPtr = path::value_type const*; struct PathParser { enum ParserState : unsigned char { // Zero is a special sentinel value used by default constructed iterators. -PS_BeforeBegin = 1, -PS_InRootName, -PS_InRootDir, -PS_InFilenames, -PS_InTrailingSep, -PS_AtEnd +PS_BeforeBegin = path::iterator::_BeforeBegin, +PS_InRootName = path::iterator::_InRootName, +PS_InRootDir = path::iterator::_InRootDir, +PS_InFilenames = path::iterator::_InFilenames, +PS_InTrailingSep = path::iterator::_InTrailingSep, +PS_AtEnd = path::iterator::_AtEnd }; const string_view_t Path; @@ -1548,7 +1548,7 @@ path::iterator path::begin() const auto PP = PathParser::CreateBegin(__pn_); iterator it; it.__path_ptr_ = this; -it.__state_ =
[libcxx] r337884 - Make explicitly require C++11.
Author: ericwf Date: Tue Jul 24 20:41:31 2018 New Revision: 337884 URL: http://llvm.org/viewvc/llvm-project?rev=337884&view=rev Log: Make explicitly require C++11. Previously the didn't guard its contents in any dialect. However, the implementation implicitly requires at least C++11, and the tests have always been marked unsupported in C++03. This patch puts a header guard around the contents to avoid exposing them before C++11. Additionally, it replaces all of the usages of _NOEXCEPT or _LIBCPP_CONSTEXPR with the keyword directly, since we can expect the compiler to implement those by now. Modified: libcxx/trunk/include/experimental/filesystem libcxx/trunk/src/experimental/filesystem/filesystem_common.h libcxx/trunk/test/std/experimental/filesystem/fs.req.macros/feature_macro.pass.cpp Modified: libcxx/trunk/include/experimental/filesystem URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/experimental/filesystem?rev=337884&r1=337883&r2=337884&view=diff == --- libcxx/trunk/include/experimental/filesystem (original) +++ libcxx/trunk/include/experimental/filesystem Tue Jul 24 20:41:31 2018 @@ -16,15 +16,15 @@ class path; -void swap(path& lhs, path& rhs) _NOEXCEPT; -size_t hash_value(const path& p) _NOEXCEPT; +void swap(path& lhs, path& rhs) noexcept; +size_t hash_value(const path& p) noexcept; -bool operator==(const path& lhs, const path& rhs) _NOEXCEPT; -bool operator!=(const path& lhs, const path& rhs) _NOEXCEPT; -bool operator< (const path& lhs, const path& rhs) _NOEXCEPT; -bool operator<=(const path& lhs, const path& rhs) _NOEXCEPT; -bool operator> (const path& lhs, const path& rhs) _NOEXCEPT; -bool operator>=(const path& lhs, const path& rhs) _NOEXCEPT; +bool operator==(const path& lhs, const path& rhs) noexcept; +bool operator!=(const path& lhs, const path& rhs) noexcept; +bool operator< (const path& lhs, const path& rhs) noexcept; +bool operator<=(const path& lhs, const path& rhs) noexcept; +bool operator> (const path& lhs, const path& rhs) noexcept; +bool operator>=(const path& lhs, const path& rhs) noexcept; path operator/ (const path& lhs, const path& rhs); @@ -96,88 +96,88 @@ void copy_symlink(const path& existing_symlink, const path& new_symlink); void copy_symlink(const path& existing_symlink, const path& new_symlink, - error_code& ec) _NOEXCEPT; + error_code& ec) noexcept; bool create_directories(const path& p); bool create_directories(const path& p, error_code& ec); bool create_directory(const path& p); -bool create_directory(const path& p, error_code& ec) _NOEXCEPT; +bool create_directory(const path& p, error_code& ec) noexcept; bool create_directory(const path& p, const path& attributes); bool create_directory(const path& p, const path& attributes, - error_code& ec) _NOEXCEPT; + error_code& ec) noexcept; void create_directory_symlink(const path& to, const path& new_symlink); void create_directory_symlink(const path& to, const path& new_symlink, - error_code& ec) _NOEXCEPT; + error_code& ec) noexcept; void create_hard_link(const path& to, const path& new_hard_link); void create_hard_link(const path& to, const path& new_hard_link, - error_code& ec) _NOEXCEPT; + error_code& ec) noexcept; void create_symlink(const path& to, const path& new_symlink); void create_symlink(const path& to, const path& new_symlink, -error_code& ec) _NOEXCEPT; +error_code& ec) noexcept; path current_path(); path current_path(error_code& ec); void current_path(const path& p); -void current_path(const path& p, error_code& ec) _NOEXCEPT; +void current_path(const path& p, error_code& ec) noexcept; -bool exists(file_status s) _NOEXCEPT; +bool exists(file_status s) noexcept; bool exists(const path& p); -bool exists(const path& p, error_code& ec) _NOEXCEPT; +bool exists(const path& p, error_code& ec) noexcept; bool equivalent(const path& p1, const path& p2); -bool equivalent(const path& p1, const path& p2, error_code& ec) _NOEXCEPT; +bool equivalent(const path& p1, const path& p2, error_code& ec) noexcept; uintmax_tfile_size(const path& p); -uintmax_tfile_size(const path& p, error_code& ec) _NOEXCEPT; +uintmax_tfile_size(const path& p, error_code& ec) noexcept; uintmax_thard_link_count(const path& p); -uintmax_thard_link_count(const path& p, error_code& ec) _NOEXCEPT; +uintmax_thard_link_count(const path& p,
[libcxx] r337886 - Fix missing includes in format_string.hpp helper
Author: ericwf Date: Tue Jul 24 21:21:59 2018 New Revision: 337886 URL: http://llvm.org/viewvc/llvm-project?rev=337886&view=rev Log: Fix missing includes in format_string.hpp helper Modified: libcxx/trunk/test/support/format_string.hpp Modified: libcxx/trunk/test/support/format_string.hpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/support/format_string.hpp?rev=337886&r1=337885&r2=337886&view=diff == --- libcxx/trunk/test/support/format_string.hpp (original) +++ libcxx/trunk/test/support/format_string.hpp Tue Jul 24 21:21:59 2018 @@ -5,23 +5,24 @@ #include #include #include +#include namespace format_string_detail { inline std::string format_string_imp(const char* msg, ...) { // we might need a second shot at this, so pre-emptivly make a copy struct GuardVAList { -va_list& target; +va_list& xtarget; bool active; -GuardVAList(va_list& target) : target(target), active(true) {} +GuardVAList(va_list& val) : xtarget(val), active(true) {} void clear() { if (active) -va_end(target); +va_end(xtarget); active = false; } ~GuardVAList() { if (active) -va_end(target); +va_end(xtarget); } }; va_list args; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r337888 - Fix bugs in create_directory implementation.
Author: ericwf Date: Tue Jul 24 21:46:32 2018 New Revision: 337888 URL: http://llvm.org/viewvc/llvm-project?rev=337888&view=rev Log: Fix bugs in create_directory implementation. Libc++ was incorrectly reporting an error when the target of create_directory already exists, but was not a directory. This behavior is not specified in the most recent standard, which says no error should be reported. Additionally, libc++ failed to report an error when the attribute directory path didn't exist or didn't name a directory. This has been fixed as well. Although it's not clear if we should call status or symlink_status on the attribute directory. This patch chooses to still call status. Modified: libcxx/trunk/src/experimental/filesystem/operations.cpp libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directories/create_directories.pass.cpp libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directory/create_directory.pass.cpp libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directory/create_directory_with_attributes.pass.cpp Modified: libcxx/trunk/src/experimental/filesystem/operations.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/experimental/filesystem/operations.cpp?rev=337888&r1=337887&r2=337888&view=diff == --- libcxx/trunk/src/experimental/filesystem/operations.cpp (original) +++ libcxx/trunk/src/experimental/filesystem/operations.cpp Tue Jul 24 21:46:32 2018 @@ -830,7 +830,7 @@ bool __create_directory(const path& p, e if (::mkdir(p.c_str(), static_cast(perms::all)) == 0) return true; - if (errno != EEXIST || !is_directory(p)) + if (errno != EEXIST) err.report(capture_errno()); return false; } @@ -845,10 +845,12 @@ bool __create_directory(path const & p, auto st = detail::posix_stat(attributes, attr_stat, &mec); if (!status_known(st)) return err.report(mec); + if (!is_directory(st)) +return err.report(errc::not_a_directory, "the specified attribute path is invalid"); if (::mkdir(p.c_str(), attr_stat.st_mode) == 0) return true; - if (errno != EEXIST || !is_directory(p)) + if (errno != EEXIST) err.report(capture_errno()); return false; } Modified: libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directories/create_directories.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directories/create_directories.pass.cpp?rev=337888&r1=337887&r2=337888&view=diff == --- libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directories/create_directories.pass.cpp (original) +++ libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directories/create_directories.pass.cpp Tue Jul 24 21:46:32 2018 @@ -66,4 +66,36 @@ TEST_CASE(create_directories_multi_level TEST_CHECK(is_directory(dir)); } +TEST_CASE(create_directory_symlinks) { + scoped_test_env env; + const path root = env.create_dir("dir"); + const path sym_dest_dead = env.make_env_path("dead"); + const path dead_sym = env.create_symlink(sym_dest_dead, "dir/sym_dir"); + const path target = env.make_env_path("dir/sym_dir/foo"); + { +std::error_code ec = GetTestEC(); +TEST_CHECK(create_directories(target, ec) == false); +TEST_CHECK(ec); +TEST_CHECK(!exists(sym_dest_dead)); +TEST_CHECK(!exists(dead_sym)); + } +} + + +TEST_CASE(create_directory_through_symlinks) { + scoped_test_env env; + const path root = env.create_dir("dir"); + const path sym_dir = env.create_symlink(root, "sym_dir"); + const path target = env.make_env_path("sym_dir/foo"); + const path resolved_target = env.make_env_path("dir/foo"); + TEST_REQUIRE(is_directory(sym_dir)); + { +std::error_code ec = GetTestEC(); +TEST_CHECK(create_directories(target, ec) == true); +TEST_CHECK(!ec); +TEST_CHECK(is_directory(target)); +TEST_CHECK(is_directory(resolved_target)); + } +} + TEST_SUITE_END() Modified: libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directory/create_directory.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directory/create_directory.pass.cpp?rev=337888&r1=337887&r2=337888&view=diff == --- libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directory/create_directory.pass.cpp (original) +++ libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.create_directory/create_directory.pass.cpp Tue Jul 24 21:46:32 2018 @@ -94,9 +94,9 @@ TEST_CASE(dest_is_file) { scoped_test_env env; const path file = env.create_file("file", 42); -std::error_code ec; +std::error_code ec = GetTestEC();
[libcxx] r337897 - Fix typos, spelling, and grammar in the FileTimeType design docs.
Author: ericwf Date: Wed Jul 25 03:17:04 2018 New Revision: 337897 URL: http://llvm.org/viewvc/llvm-project?rev=337897&view=rev Log: Fix typos, spelling, and grammar in the FileTimeType design docs. I'm sure I'll discover more mistakes as I go on... Modified: libcxx/trunk/docs/DesignDocs/FileTimeType.rst Modified: libcxx/trunk/docs/DesignDocs/FileTimeType.rst URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/docs/DesignDocs/FileTimeType.rst?rev=337897&r1=337896&r2=337897&view=diff == --- libcxx/trunk/docs/DesignDocs/FileTimeType.rst (original) +++ libcxx/trunk/docs/DesignDocs/FileTimeType.rst Wed Jul 25 03:17:04 2018 @@ -83,14 +83,14 @@ To get the same range, we would need to to come close to having the same range. This begs the question, is the range problem "really a problem"? Sane usages -of file time stamps shouldn't exceed +/- 300, so should we care to support it? +of file time stamps shouldn't exceed +/- 300 years, so should we care to support it? I believe the answer is yes. We're not designing the filesystem time API, we're providing glorified C++ wrappers for it. If the underlying API supports a value, then we should too. Our wrappers should not place artificial restrictions on users that are not present in the underlying filesystem. -Additionally, having a smaller range that the underlying filesystem forces the +Having a smaller range that the underlying filesystem forces the implementation to report ``value_too_large`` errors when it encounters a time point that it can't represent. This can cause the call to ``last_write_time`` to throw in cases where the user was confident the call should succeed. (See below) @@ -135,7 +135,7 @@ Having a Smaller Resolution than ``times - As mentioned in the previous section, one way to solve the range problem -is by reducing the resolution, and matching the range of ``timespec`` using a +is by reducing the resolution. But matching the range of ``timespec`` using a 64 bit representation requires limiting the resolution to seconds. So we might ask: Do users "need" nanosecond precision? Is seconds not good enough? @@ -148,16 +148,16 @@ representation, not design it. Having a Larger Range than ``timespec`` -We also should consider the opposite problem of having ``file_time_type`` -be able to represent a larger range than that of ``timespec``. At least in +We should also consider the opposite problem of having a ``file_time_type`` +that is able to represent a larger range than ``timespec``. At least in this case ``last_write_time`` can be used to get and set all possible values supported by the underlying filesystem; meaning ``last_write_time(p)`` will -never throw a overflow error. +never throw a overflow error when retrieving a value. -However, this introduces a new problem, where users are allowed to create time -points beyond what the filesystem can represent. Two particular values are -``file_time_type::min()`` and ``file_time_type::max()``. As such the following -code would throw: +However, this introduces a new problem, where users are allowed to attempt to +create a time point beyond what the filesystem can represent. Two particular +values which cause this are ``file_time_type::min()`` and +``file_time_type::max()``. As a result, the following code would throw: .. code-block:: cpp @@ -167,8 +167,8 @@ code would throw: } Apart from cases explicitly using ``min`` and ``max``, I don't see users taking -a valid time point, adding a couple hundred billions of years to it in error, -and then trying to update a files write time with that value very often. +a valid time point, adding a couple hundred billions of years in error, +and then trying to update a file's write time to that value very often. Compared to having a smaller range, this problem seems preferable. At least now we can represent any time point the filesystem can, so users won't be forced @@ -190,10 +190,10 @@ than 64 bits. The possible solutions inc arithmetic type. All three will solve allow us to, at minimum, match the range and resolution, and the last one might even allow us to match them exactly. -But when considering these potential solutions, we need to consider more than -just the values they can represent. We need to consider the effect they will have -on users and their code. For example, each of them breaks the following code -in some way: +But when considering these potential solutions we need to consider more than +just the values they can represent. We need to consider the effects they will +have on users and their code. For example, each of them breaks the following +code in some way: .. code-block:: cpp @@ -234,12 +234,12 @@ in some way: Each of the above examples would require a user to adjust their filesystem code -to the particular eccentricitie
[libcxx] r337900 - Fix another typo in the FileTimeType docs
Author: ericwf Date: Wed Jul 25 03:22:07 2018 New Revision: 337900 URL: http://llvm.org/viewvc/llvm-project?rev=337900&view=rev Log: Fix another typo in the FileTimeType docs Modified: libcxx/trunk/docs/DesignDocs/FileTimeType.rst Modified: libcxx/trunk/docs/DesignDocs/FileTimeType.rst URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/docs/DesignDocs/FileTimeType.rst?rev=337900&r1=337899&r2=337900&view=diff == --- libcxx/trunk/docs/DesignDocs/FileTimeType.rst (original) +++ libcxx/trunk/docs/DesignDocs/FileTimeType.rst Wed Jul 25 03:22:07 2018 @@ -224,7 +224,7 @@ code in some way: // Implicit truncation during conversion bug. intmax_t get_time_in_seconds(path p) { -using fs_seconds = duration; +using fs_seconds = duration >; auto tp = last_write_time(p); // This works with truncation for __int128_t, but what does it do for ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r337905 - Fix diagnostic test to tolerate Clang diagnosing it as well.
Author: ericwf Date: Wed Jul 25 04:16:39 2018 New Revision: 337905 URL: http://llvm.org/viewvc/llvm-project?rev=337905&view=rev Log: Fix diagnostic test to tolerate Clang diagnosing it as well. Tuple has tests that ensure we diagnose non-lifetime extended reference bindings inside tuples constructors. As of yesterday, Clang now does this for us. Adjust the test to tolerate the new diagnostics, while still testing that we emit diagnostics of our own. Maybe after this version of Clang has been adopted by most users we should remove our diagnostics; but for now more error detection is better! Modified: libcxx/trunk/test/libcxx/utilities/tuple/tuple.tuple/tuple.cnstr/PR20855_tuple_ref_binding_diagnostics.fail.cpp Modified: libcxx/trunk/test/libcxx/utilities/tuple/tuple.tuple/tuple.cnstr/PR20855_tuple_ref_binding_diagnostics.fail.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/utilities/tuple/tuple.tuple/tuple.cnstr/PR20855_tuple_ref_binding_diagnostics.fail.cpp?rev=337905&r1=337904&r2=337905&view=diff == --- libcxx/trunk/test/libcxx/utilities/tuple/tuple.tuple/tuple.cnstr/PR20855_tuple_ref_binding_diagnostics.fail.cpp (original) +++ libcxx/trunk/test/libcxx/utilities/tuple/tuple.tuple/tuple.cnstr/PR20855_tuple_ref_binding_diagnostics.fail.cpp Wed Jul 25 04:16:39 2018 @@ -46,7 +46,12 @@ void F(typename CannotDeduce(std::make_tuple(1, "abc")); // expected-note 1 {{requested here}} } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxxabi] r337906 - Fix dangling reference in test
Author: ericwf Date: Wed Jul 25 04:19:13 2018 New Revision: 337906 URL: http://llvm.org/viewvc/llvm-project?rev=337906&view=rev Log: Fix dangling reference in test Modified: libcxxabi/trunk/test/cxa_bad_cast.pass.cpp Modified: libcxxabi/trunk/test/cxa_bad_cast.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/test/cxa_bad_cast.pass.cpp?rev=337906&r1=337905&r2=337906&view=diff == --- libcxxabi/trunk/test/cxa_bad_cast.pass.cpp (original) +++ libcxxabi/trunk/test/cxa_bad_cast.pass.cpp Wed Jul 25 04:19:13 2018 @@ -21,7 +21,7 @@ class Base { class Derived : public Base {}; -Derived &test_bad_cast(Base b) { +Derived &test_bad_cast(Base& b) { return dynamic_cast(b); } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: r337790 - Warn if a local variable's initializer retains a pointer/reference to a
Nice! This found one bug in the libc++abi tests (r337906), and started diagnosing the dangling tuple reference case that libc++ worked hard to diagnose manually (r337905). /Eric On Mon, Jul 23, 2018 at 6:55 PM Richard Smith via cfe-commits < cfe-commits@lists.llvm.org> wrote: > Author: rsmith > Date: Mon Jul 23 17:55:08 2018 > New Revision: 337790 > > URL: http://llvm.org/viewvc/llvm-project?rev=337790&view=rev > Log: > Warn if a local variable's initializer retains a pointer/reference to a > non-lifetime-extended temporary object. > > Added: > cfe/trunk/test/SemaCXX/warn-dangling-local.cpp > Modified: > cfe/trunk/include/clang/Basic/DiagnosticGroups.td > cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td > cfe/trunk/lib/Sema/SemaInit.cpp > cfe/trunk/test/CXX/drs/dr16xx.cpp > cfe/trunk/test/SemaCXX/address-of-temporary.cpp > > Modified: cfe/trunk/include/clang/Basic/DiagnosticGroups.td > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticGroups.td?rev=337790&r1=337789&r2=337790&view=diff > > == > --- cfe/trunk/include/clang/Basic/DiagnosticGroups.td (original) > +++ cfe/trunk/include/clang/Basic/DiagnosticGroups.td Mon Jul 23 17:55:08 > 2018 > @@ -273,6 +273,10 @@ def OverloadedShiftOpParentheses: DiagGr > def DanglingElse: DiagGroup<"dangling-else">; > def DanglingField : DiagGroup<"dangling-field">; > def DanglingInitializerList : DiagGroup<"dangling-initializer-list">; > +def ReturnStackAddress : DiagGroup<"return-stack-address">; > +def Dangling : DiagGroup<"dangling", [DanglingField, > + DanglingInitializerList, > + ReturnStackAddress]>; > def DistributedObjectModifiers : > DiagGroup<"distributed-object-modifiers">; > def ExpansionToDefined : DiagGroup<"expansion-to-defined">; > def FlagEnum : DiagGroup<"flag-enum">; > @@ -407,7 +411,6 @@ def RedeclaredClassMember : DiagGroup<"r > def GNURedeclaredEnum : DiagGroup<"gnu-redeclared-enum">; > def RedundantMove : DiagGroup<"redundant-move">; > def Register : DiagGroup<"register", [DeprecatedRegister]>; > -def ReturnStackAddress : DiagGroup<"return-stack-address">; > def ReturnTypeCLinkage : DiagGroup<"return-type-c-linkage">; > def ReturnType : DiagGroup<"return-type", [ReturnTypeCLinkage]>; > def BindToTemporaryCopy : DiagGroup<"bind-to-temporary-copy", > > Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=337790&r1=337789&r2=337790&view=diff > > == > --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original) > +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Mon Jul 23 > 17:55:08 2018 > @@ -1845,10 +1845,6 @@ def err_reference_bind_failed : Error< >"type $|could not bind to %select{rvalue|lvalue}1 of incompatible > type}0,2">; > def err_reference_bind_init_list : Error< >"reference to type %0 cannot bind to an initializer list">; > -def warn_temporary_array_to_pointer_decay : Warning< > - "pointer is initialized by a temporary array, which will be destroyed > at the " > - "end of the full-expression">, > - InGroup>; > def err_init_list_bad_dest_type : Error< >"%select{|non-aggregate }0type %1 cannot be initialized with an > initializer " >"list">; > @@ -7876,15 +7872,31 @@ def warn_init_ptr_member_to_parameter_ad > def note_ref_or_ptr_member_declared_here : Note< >"%select{reference|pointer}0 member declared here">; > > -def err_bind_ref_member_to_temporary : Error< > +def err_dangling_member : Error< >"%select{reference|backing array for 'std::initializer_list'}2 " >"%select{|subobject of }1member %0 " >"%select{binds to|is}2 a temporary object " > - "whose lifetime would be shorter than the constructed object">; > + "whose lifetime would be shorter than the lifetime of " > + "the constructed object">; > +def warn_dangling_member : Warning< > + "%select{reference|backing array for 'std::initializer_list'}2 " > + "%select{|subobject of }1member %0 " > + "%select{binds to|is}2 a temporary object " > + "whose lifetime is shorter than the lifetime of the constructed > object">, > + InGroup; > def note_lifetime_extending_member_declared_here : Note< >"%select{%select{reference|'std::initializer_list'}0 member|" >"member with %select{reference|'std::initializer_list'}0 subobject}1 " >"declared here">; > +def warn_dangling_variable : Warning< > + "%select{temporary %select{whose address is used as value of|bound to}3 > " > + "%select{%select{|reference }3member of local variable|" > + "local %select{variable|reference}3}1|" > + "array backing " > + "%select{initializer list subobject of local variable|" > + "local initializer list}1}0 " > + "%2 will be destroyed at the e
[libcxx] r337960 - [libc++] Use __int128_t to represent file_time_type.
Author: ericwf Date: Wed Jul 25 13:51:49 2018 New Revision: 337960 URL: http://llvm.org/viewvc/llvm-project?rev=337960&view=rev Log: [libc++] Use __int128_t to represent file_time_type. Summary: The ``file_time_type`` time point is used to represent the write times for files. Its job is to act as part of a C++ wrapper for less ideal system interfaces. The underlying filesystem uses the ``timespec`` struct for the same purpose. However, the initial implementation of ``file_time_type`` could not represent either the range or resolution of ``timespec``, making it unsuitable. Fixing this requires an implementation which uses more than 64 bits to store the time point. I primarily considered two solutions: Using ``__int128_t`` and using a arithmetic emulation of ``timespec``. Each has its pros and cons, and both come with more than one complication. However, after a lot of consideration, I decided on using `__int128_t`. This patch implements that change. Please see the [FileTimeType Design Document](http://libcxx.llvm.org/docs/DesignDocs/FileTimeType.html) for more information. Reviewers: mclow.lists, ldionne, joerg, arthur.j.odwyer, EricWF Reviewed By: EricWF Subscribers: christof, K-ballo, cfe-commits, BillyONeal Differential Revision: https://reviews.llvm.org/D49774 Added: libcxx/trunk/src/include/apple_availability.h Modified: libcxx/trunk/include/experimental/filesystem libcxx/trunk/src/chrono.cpp libcxx/trunk/src/experimental/filesystem/filesystem_common.h libcxx/trunk/src/experimental/filesystem/operations.cpp libcxx/trunk/test/libcxx/experimental/filesystem/class.directory_entry/directory_entry.mods/last_write_time.sh.cpp libcxx/trunk/test/libcxx/experimental/filesystem/convert_file_time.sh.cpp libcxx/trunk/test/std/experimental/filesystem/fs.filesystem.synopsis/file_time_type.pass.cpp libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp Modified: libcxx/trunk/include/experimental/filesystem URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/experimental/filesystem?rev=337960&r1=337959&r2=337960&view=diff == --- libcxx/trunk/include/experimental/filesystem (original) +++ libcxx/trunk/include/experimental/filesystem Wed Jul 25 13:51:49 2018 @@ -260,7 +260,37 @@ _LIBCPP_PUSH_MACROS _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL_FILESYSTEM -typedef chrono::time_point file_time_type; +struct _FilesystemClock { +#if !defined(_LIBCPP_HAS_NO_INT128) + typedef __int128_t rep; + typedef nano period; +#else + typedef long long rep; + typedef nano period; +#endif + + typedef chrono::duration duration; + typedef chrono::time_point<_FilesystemClock> time_point; + + static _LIBCPP_CONSTEXPR_AFTER_CXX11 const bool is_steady = false; + + _LIBCPP_FUNC_VIS static time_point now() noexcept; + + _LIBCPP_INLINE_VISIBILITY + static time_t to_time_t(const time_point& __t) noexcept { +typedef chrono::duration __secs; +return time_t( +chrono::duration_cast<__secs>(__t.time_since_epoch()).count()); + } + + _LIBCPP_INLINE_VISIBILITY + static time_point from_time_t(time_t __t) noexcept { +typedef chrono::duration __secs; +return time_point(__secs(__t)); + } +}; + +typedef chrono::time_point<_FilesystemClock> file_time_type; struct _LIBCPP_TYPE_VIS space_info { Modified: libcxx/trunk/src/chrono.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/chrono.cpp?rev=337960&r1=337959&r2=337960&view=diff == --- libcxx/trunk/src/chrono.cpp (original) +++ libcxx/trunk/src/chrono.cpp Wed Jul 25 13:51:49 2018 @@ -11,27 +11,10 @@ #include "cerrno"// errno #include "system_error" // __throw_system_error #include // clock_gettime, CLOCK_MONOTONIC and CLOCK_REALTIME +#include "include/apple_availability.h" -#if (__APPLE__) -#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) -#if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 101200 -#define _LIBCXX_USE_CLOCK_GETTIME -#endif -#elif defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) -#if __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 10 -#define _LIBCXX_USE_CLOCK_GETTIME -#endif -#elif defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) -#if __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ >= 10 -#define _LIBCXX_USE_CLOCK_GETTIME -#endif -#elif defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) -#if __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ >= 3 -#define _LIBCXX_USE_CLOCK_GETTIME -#endif -#endif // __ENVIRONMENT_.*_VERSION_MIN_REQUIRED__ -#else -#define _LIBCXX_USE_CLOCK_GETTIME +#if !defined(__APPLE__) +#define _LIBCPP_USE_CLOCK_GETTIME #endif // __APPLE__ #if defined(_LIBCPP_WIN32API) @@ -42,7 +25,7 @@ #include #endif #else -#if !defined(CLOCK_REALTIME) || !defined(_LIBCXX_USE_CLOCK_GETTIME) +#if !defined(CLOCK_REALTIME) |
[libcxx] r337962 - Make compile with gcc 4.8.5
Author: ericwf Date: Wed Jul 25 14:01:45 2018 New Revision: 337962 URL: http://llvm.org/viewvc/llvm-project?rev=337962&view=rev Log: Make compile with gcc 4.8.5 Patch by Victor Zverovich. This fixes an error when compiling `` with gcc 4.8.5: ``` .../libcxx/src/experimental/filesystem/filesystem_common.h:137:34: error: redeclaration ‘T std::experimental::filesystem::v1::detail::{anonymous}::error_value() [with T = bool]’ d iffers in ‘constexpr’ constexpr bool error_value() { ^ .../libcxx/src/experimental/filesystem/filesystem_common.h:133:3: error: from previous declaration ‘T std::experimental::filesystem::v1::detail::{anonymous}::error_value() [with T = bool]’ T error_value(); ^ ``` Reviewed as https://reviews.llvm.org/D49813 Modified: libcxx/trunk/src/experimental/filesystem/filesystem_common.h Modified: libcxx/trunk/src/experimental/filesystem/filesystem_common.h URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/experimental/filesystem/filesystem_common.h?rev=337962&r1=337961&r2=337962&view=diff == --- libcxx/trunk/src/experimental/filesystem/filesystem_common.h (original) +++ libcxx/trunk/src/experimental/filesystem/filesystem_common.h Wed Jul 25 14:01:45 2018 @@ -118,11 +118,11 @@ T error_value(); template <> _LIBCPP_CONSTEXPR_AFTER_CXX11 void error_value() {} template <> -constexpr bool error_value() { +bool error_value() { return false; } template <> -constexpr uintmax_t error_value() { +uintmax_t error_value() { return uintmax_t(-1); } template <> ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r337970 - Fix failing test under C++14
Author: ericwf Date: Wed Jul 25 14:53:43 2018 New Revision: 337970 URL: http://llvm.org/viewvc/llvm-project?rev=337970&view=rev Log: Fix failing test under C++14 Modified: libcxx/trunk/src/experimental/filesystem/filesystem_common.h Modified: libcxx/trunk/src/experimental/filesystem/filesystem_common.h URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/experimental/filesystem/filesystem_common.h?rev=337970&r1=337969&r2=337970&view=diff == --- libcxx/trunk/src/experimental/filesystem/filesystem_common.h (original) +++ libcxx/trunk/src/experimental/filesystem/filesystem_common.h Wed Jul 25 14:53:43 2018 @@ -362,8 +362,8 @@ public: // The tv_nsec and tv_usec fields must not be negative so adjust accordingly if (subsec_dur.count() < 0) { if (sec_dur.count() > min_seconds) { -sec_dur -= fs_seconds(1); -subsec_dur += fs_seconds(1); +sec_dur = sec_dur - fs_seconds(1); +subsec_dur = subsec_dur + fs_seconds(1); } else { subsec_dur = fs_nanoseconds::zero(); } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r337971 - Remove test which shouldn't have been committed
Author: ericwf Date: Wed Jul 25 14:58:37 2018 New Revision: 337971 URL: http://llvm.org/viewvc/llvm-project?rev=337971&view=rev Log: Remove test which shouldn't have been committed Modified: libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp Modified: libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp?rev=337971&r1=337970&r2=337971&view=diff == --- libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp (original) +++ libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp Wed Jul 25 14:58:37 2018 @@ -567,23 +567,4 @@ TEST_CASE(test_exists_fails) TEST_CHECK_THROW_RESULT(filesystem_error, Checker, last_write_time(file)); } -TEST_CASE(my_test) { - scoped_test_env env; - const path p = env.create_file("file", 42); - using namespace std::chrono; - using TimeSpec = struct ::timespec; - TimeSpec ts[2]; - ts[0].tv_sec = 0; - ts[0].tv_nsec = UTIME_OMIT; - ts[1].tv_sec = -1; - ts[1].tv_nsec = - duration_cast(seconds(1) - nanoseconds(13)).count(); - if (::utimensat(AT_FDCWD, p.c_str(), ts, 0) == -1) { -TEST_CHECK(false); - } - TimeSpec new_ts = LastWriteTime(p); - TEST_CHECK(ts[1].tv_sec == new_ts.tv_sec); - TEST_CHECK(ts[1].tv_nsec == new_ts.tv_nsec); -} - TEST_SUITE_END() ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r337974 - Fix GCC build in C++14 w/o c++14 constexpr
Author: ericwf Date: Wed Jul 25 15:07:36 2018 New Revision: 337974 URL: http://llvm.org/viewvc/llvm-project?rev=337974&view=rev Log: Fix GCC build in C++14 w/o c++14 constexpr Modified: libcxx/trunk/src/experimental/filesystem/filesystem_common.h Modified: libcxx/trunk/src/experimental/filesystem/filesystem_common.h URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/experimental/filesystem/filesystem_common.h?rev=337974&r1=337973&r2=337974&view=diff == --- libcxx/trunk/src/experimental/filesystem/filesystem_common.h (original) +++ libcxx/trunk/src/experimental/filesystem/filesystem_common.h Wed Jul 25 15:07:36 2018 @@ -229,7 +229,7 @@ struct time_util_base { .count(); private: -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER > 11 && !defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR) static constexpr fs_duration get_min_nsecs() { return duration_cast( fs_nanoseconds(min_nsec_timespec) - ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r337976 - Work around GCC bug in constexpr function
Author: ericwf Date: Wed Jul 25 15:21:47 2018 New Revision: 337976 URL: http://llvm.org/viewvc/llvm-project?rev=337976&view=rev Log: Work around GCC bug in constexpr function Modified: libcxx/trunk/test/libcxx/experimental/filesystem/convert_file_time.sh.cpp Modified: libcxx/trunk/test/libcxx/experimental/filesystem/convert_file_time.sh.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/libcxx/experimental/filesystem/convert_file_time.sh.cpp?rev=337976&r1=337975&r2=337976&view=diff == --- libcxx/trunk/test/libcxx/experimental/filesystem/convert_file_time.sh.cpp (original) +++ libcxx/trunk/test/libcxx/experimental/filesystem/convert_file_time.sh.cpp Wed Jul 25 15:21:47 2018 @@ -56,11 +56,12 @@ constexpr TestKind getFileTimeTestKind() using Rep = typename FileTimeT::rep; if (std::is_floating_point::value) return TK_FloatingPoint; - if (sizeof(Rep) == 16) + else if (sizeof(Rep) == 16) return TK_128Bit; - if (sizeof(Rep) == 8) + else if (sizeof(Rep) == 8) return TK_64Bit; - assert(false && "test kind not supported"); + else +assert(false && "test kind not supported"); } template http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r337990 - [libc++] Add hack to allow ubsan to work w/o compiler-rt (__muloti4 is undefined)
Author: ericwf Date: Wed Jul 25 17:34:50 2018 New Revision: 337990 URL: http://llvm.org/viewvc/llvm-project?rev=337990&view=rev Log: [libc++] Add hack to allow ubsan to work w/o compiler-rt (__muloti4 is undefined) Summary: Using int128_t with UBSAN causes link errors unless compiler-rt is providing the runtime library. Specifically ubsan generates calls to __muloti4 but libgcc doesn't provide a definition. In order to avoid this, and allow users to continue using sanitized versions of libc++, this patch introduces a hack. It adds a cribbed version of the compiler-rt builtin to the libc++ filesystem sources. I don't think this approach will work in the long run, but it seems OK for now. Also see: https://bugs.llvm.org/show_bug.cgi?id=30643 https://bugs.llvm.org/show_bug.cgi?id=16404 Reviewers: mclow.lists, ldionne, rsmith, jyknight, echristo Reviewed By: echristo Subscribers: dberris, cfe-commits Differential Revision: https://reviews.llvm.org/D49828 Added: libcxx/trunk/src/experimental/filesystem/int128_builtins.cpp Added: libcxx/trunk/src/experimental/filesystem/int128_builtins.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/experimental/filesystem/int128_builtins.cpp?rev=337990&view=auto == --- libcxx/trunk/src/experimental/filesystem/int128_builtins.cpp (added) +++ libcxx/trunk/src/experimental/filesystem/int128_builtins.cpp Wed Jul 25 17:34:50 2018 @@ -0,0 +1,55 @@ +/*===-- int128_builtins.cpp - Implement __muloti4 --=== + * + * The LLVM Compiler Infrastructure + * + * This file is dual licensed under the MIT and the University of Illinois Open + * Source Licenses. See LICENSE.TXT for details. + * + * ===--=== + * + * This file implements __muloti4, and is stolen from the compiler_rt library. + * + * FIXME: we steal and re-compile it into filesystem, which uses __int128_t, + * and requires this builtin when sanitized. See llvm.org/PR30643 + * + * ===--=== + */ +#include "__config" +#include "climits" + +#ifndef _LIBCPP_HAS_NO_INT128 + +__attribute__((no_sanitize("undefined"))) extern "C" __int128_t +__muloti4(__int128_t a, __int128_t b, int* overflow) { + const int N = (int)(sizeof(__int128_t) * CHAR_BIT); + const __int128_t MIN = (__int128_t)1 << (N - 1); + const __int128_t MAX = ~MIN; + *overflow = 0; + __int128_t result = a * b; + if (a == MIN) { +if (b != 0 && b != 1) + *overflow = 1; +return result; + } + if (b == MIN) { +if (a != 0 && a != 1) + *overflow = 1; +return result; + } + __int128_t sa = a >> (N - 1); + __int128_t abs_a = (a ^ sa) - sa; + __int128_t sb = b >> (N - 1); + __int128_t abs_b = (b ^ sb) - sb; + if (abs_a < 2 || abs_b < 2) +return result; + if (sa == sb) { +if (abs_a > MAX / abs_b) + *overflow = 1; + } else { +if (abs_a > MIN / -abs_b) + *overflow = 1; + } + return result; +} + +#endif ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r337991 - Add print statements to help debugging
Author: ericwf Date: Wed Jul 25 18:10:50 2018 New Revision: 337991 URL: http://llvm.org/viewvc/llvm-project?rev=337991&view=rev Log: Add print statements to help debugging Modified: libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp Modified: libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp?rev=337991&r1=337990&r2=337991&view=diff == --- libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp (original) +++ libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp Wed Jul 25 18:10:50 2018 @@ -421,21 +421,23 @@ TEST_CASE(set_last_write_time_dynamic_en #endif struct TestCase { + const char * case_name; path p; file_time_type new_time; } cases[] = { -{file, epoch_time}, -{dir, epoch_time}, -{file, future_time}, -{dir, future_time}, -{file, past_time}, -{dir, past_time}, -{file, before_epoch_time}, -{dir, before_epoch_time}, -{file, just_before_epoch_time}, -{dir, just_before_epoch_time} +{"file, epoch_time", file, epoch_time}, +{"dir, epoch_time", dir, epoch_time}, +{"file, future_time", file, future_time}, +{"dir, future_time", dir, future_time}, +{"file, past_time", file, past_time}, +{"dir, past_time", dir, past_time}, +{"file, before_epoch_time", file, before_epoch_time}, +{"dir, before_epoch_time", dir, before_epoch_time}, +{"file, just_before_epoch_time", file, just_before_epoch_time}, +{"dir, just_before_epoch_time", dir, just_before_epoch_time} }; for (const auto& TC : cases) { +std::cerr << "Test Case = " << TC.case_name << "\n"; const auto old_times = GetTimes(TC.p); file_time_type old_time; TEST_REQUIRE(ConvertFromTimeSpec(old_time, old_times.write)); @@ -444,11 +446,19 @@ TEST_CASE(set_last_write_time_dynamic_en last_write_time(TC.p, TC.new_time, ec); TEST_CHECK(!ec); -file_time_type got_time = last_write_time(TC.p); +ec = GetTestEC(); +file_time_type got_time = last_write_time(TC.p, ec); +TEST_REQUIRE(!ec); if (TimeIsRepresentableByFilesystem(TC.new_time)) { TEST_CHECK(got_time != old_time); TEST_CHECK(CompareTime(got_time, TC.new_time)); + +// FIXME(EricWF): Remove these after getting information from +// some failing bots. +std::cerr << (long long)got_time.time_since_epoch().count() << std::endl; +std::cerr << (long long)TC.new_time.time_since_epoch().count() << std::endl; + TEST_CHECK(CompareTime(LastAccessTime(TC.p), old_times.access)); } } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r337998 - Workaround OS X 10.11 behavior where stat truncates st_mtimespec to seconds.
Author: ericwf Date: Wed Jul 25 20:28:48 2018 New Revision: 337998 URL: http://llvm.org/viewvc/llvm-project?rev=337998&view=rev Log: Workaround OS X 10.11 behavior where stat truncates st_mtimespec to seconds. Modified: libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp Modified: libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp?rev=337998&r1=337997&r2=337998&view=diff == --- libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp (original) +++ libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp Wed Jul 25 20:28:48 2018 @@ -225,6 +225,24 @@ static const bool SupportsNanosecondRoun } }(); + +static const bool WorkaroundStatTruncatesToSeconds = [] { + MicroSec micros(3); + static_assert(std::is_same::value, ""); + + // Test for the behavior of OS X 10.11 and older, which truncates the result + // of st_mtimespec to seconds. + file_time_type ft(micros); + { +scoped_test_env env; +const path p = env.create_file("file", 42); +if (LastWriteTime(p).tv_nsec != 0) + return false; +last_write_time(p, ft); +return last_write_time(p) != ft && LastWriteTime(p).tv_nsec == 0; + } +}(); + static const bool SupportsMinRoundTrip = [] { TimeSpec ts = {}; if (!ConvertToTimeSpec(ts, file_time_type::min())) @@ -244,7 +262,8 @@ static bool CompareTime(TimeSpec t1, Tim return false; auto diff = std::abs(t1.tv_nsec - t2.tv_nsec); - + if (WorkaroundStatTruncatesToSeconds) + return diff < duration_cast(Sec(1)).count(); return diff < duration_cast(MicroSec(1)).count(); } @@ -275,8 +294,9 @@ static bool CompareTime(file_time_type t dur = t1 - t2; else dur = t2 - t1; - - return duration_cast(dur).count() < 1; + if (WorkaroundStatTruncatesToSeconds) +return duration_cast(dur).count() == 0; + return duration_cast(dur).count() == 0; } // Check if a time point is representable on a given filesystem. Check that: @@ -399,7 +419,6 @@ TEST_CASE(get_last_write_time_dynamic_en TEST_CASE(set_last_write_time_dynamic_env_test) { using Clock = file_time_type::clock; -using SubSecT = file_time_type::duration; scoped_test_env env; const path file = env.create_file("file", 42); @@ -453,12 +472,6 @@ TEST_CASE(set_last_write_time_dynamic_en if (TimeIsRepresentableByFilesystem(TC.new_time)) { TEST_CHECK(got_time != old_time); TEST_CHECK(CompareTime(got_time, TC.new_time)); - -// FIXME(EricWF): Remove these after getting information from -// some failing bots. -std::cerr << (long long)got_time.time_since_epoch().count() << std::endl; -std::cerr << (long long)TC.new_time.time_since_epoch().count() << std::endl; - TEST_CHECK(CompareTime(LastAccessTime(TC.p), old_times.access)); } } @@ -484,7 +497,11 @@ TEST_CASE(last_write_time_symlink_test) file_time_type got_time = last_write_time(sym); TEST_CHECK(!CompareTime(got_time, old_times.write)); -TEST_CHECK(got_time == new_time); +if (!WorkaroundStatTruncatesToSeconds) { + TEST_CHECK(got_time == new_time); +} else { + TEST_CHECK(CompareTime(got_time, new_time)); +} TEST_CHECK(CompareTime(LastWriteTime(file), new_time)); TEST_CHECK(CompareTime(LastAccessTime(sym), old_times.access)); @@ -577,4 +594,14 @@ TEST_CASE(test_exists_fails) TEST_CHECK_THROW_RESULT(filesystem_error, Checker, last_write_time(file)); } +// Just for sanity ensure that WorkaroundStatTruncatesToSeconds is only +// ever true on Apple platforms. +TEST_CASE(apple_truncates_to_seconds_check) { +#ifndef __APPLE__ + TEST_CHECK(!WorkaroundStatTruncatesToSeconds); +#else + TEST_CHECK(SupportsNanosecondRoundTrip != WorkaroundStatTruncatesToSeconds); +#endif +} + TEST_SUITE_END() ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [libcxx] r337960 - [libc++] Use __int128_t to represent file_time_type.
Thank you for the clarification. On Wed, Jul 25, 2018 at 9:16 PM James Y Knight wrote: > As is the case on most modern platforms, the ability to store a high-res > file timestamp is dependent on the filesystem the file is stored on. > > The HFS+ filesystem (used by default before macOS 10.13) stores timestamps > at a 1-second granularity, and APFS (now the default) at a 1 nanosecond > granularity. > > 1-second granularity is also the norm on many of the supported filesystems > on Linux as well. > > On Wed, Jul 25, 2018 at 10:43 PM Eric Fiselier via cfe-commits < > cfe-commits@lists.llvm.org> wrote: > >> Looks like macOS 10.11 only supports a resolution of seconds, but I can't >> find documentation confirming that. >> >> I'll adjust the test. >> >> /Eric >> >> On Wed, Jul 25, 2018 at 8:33 PM Alex L wrote: >> >>> Looks like 'SupportsNanosecondRoundTrip' is set to 0. >>> >>> On 25 July 2018 at 19:30, Alex L wrote: >>> >>>> Sure, >>>> >>>> Standard Error: >>>> >>>> -- >>>> >>>> PRIOR:3 >>>> >>>> AFTER:0 >>>> >>>> >>>> Diff: >>>> >>>> >>>> -return last_write_time(p) == ft; >>>> >>>> +std::cerr << "PRIOR:" << (long long)ft.time_since_epoch().count() >>>> << std::endl; >>>> >>>> +auto ft2 = last_write_time(p); >>>> >>>> +std::cerr << "AFTER:" << (long long)ft2.time_since_epoch().count() >>>> << std::endl; >>>> >>>> +return ft2 == ft; >>>> >>>> On 25 July 2018 at 19:20, Eric Fiselier wrote: >>>> >>>>> Could you tell me what the value of the initial time point, and the >>>>> resulting one are on this line? >>>>> >>>>> >>>>> https://github.com/llvm-mirror/libcxx/blob/master/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp#L224 >>>>> >>>>> On Wed, Jul 25, 2018 at 8:17 PM Alex L wrote: >>>>> >>>>>> Please let me know if this information is helpful. If not, I'll mark >>>>>> the test as UNSUPPORTED for darwin for the time being and will create an >>>>>> internal issue to track the investigation into the OS-specific failure. >>>>>> Cheers, >>>>>> Alex >>>>>> >>>>>> On 25 July 2018 at 19:12, Alex L wrote: >>>>>> >>>>>>> I got the following output on an macOS10.11 machine: >>>>>>> >>>>>>> Exit Code: 1 >>>>>>> >>>>>>> Standard Error: >>>>>>> >>>>>>> -- >>>>>>> >>>>>>> Test Case = file, epoch_time >>>>>>> >>>>>>> 0 >>>>>>> >>>>>>> 0 >>>>>>> >>>>>>> Test Case = dir, epoch_time >>>>>>> >>>>>>> 0 >>>>>>> >>>>>>> 0 >>>>>>> >>>>>>> Test Case = file, future_time >>>>>>> >>>>>>> In set_last_write_time_dynamic_env_test():455 Assertion >>>>>>> TEST_CHECK(CompareTime(got_time, TC.new_time)) failed. >>>>>>> >>>>>>> in file: >>>>>>> /Users/local/llvm/projects/libcxx/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp >>>>>>> >>>>>>> >>>>>>> >>>>>>> 15325819240 >>>>>>> >>>>>>> 1532581924695307000 >>>>>>> >>>>>>> Test Case = dir, future_time >>>>>>> >>>>>>> In set_last_write_time_dynamic_env_test():455 Assertion >>>>>>> TEST_CHECK(CompareTime(got_time, TC.new_time)) failed. >>>>>>> >>>>>>> in file: >>>>>>> /Users/local/llvm/projects/libcxx/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp >>>>>>> >>>>>>> >>>>>>> >>>>>>> 1532
[libcxx] r337999 - Fix attribute placement WRT extern C
Author: ericwf Date: Wed Jul 25 20:36:37 2018 New Revision: 337999 URL: http://llvm.org/viewvc/llvm-project?rev=337999&view=rev Log: Fix attribute placement WRT extern C Modified: libcxx/trunk/src/experimental/filesystem/int128_builtins.cpp Modified: libcxx/trunk/src/experimental/filesystem/int128_builtins.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/experimental/filesystem/int128_builtins.cpp?rev=337999&r1=337998&r2=337999&view=diff == --- libcxx/trunk/src/experimental/filesystem/int128_builtins.cpp (original) +++ libcxx/trunk/src/experimental/filesystem/int128_builtins.cpp Wed Jul 25 20:36:37 2018 @@ -19,8 +19,8 @@ #ifndef _LIBCPP_HAS_NO_INT128 -__attribute__((no_sanitize("undefined"))) extern "C" __int128_t -__muloti4(__int128_t a, __int128_t b, int* overflow) { +extern "C" __attribute__((no_sanitize("undefined"))) +__int128_t __muloti4(__int128_t a, __int128_t b, int* overflow) { const int N = (int)(sizeof(__int128_t) * CHAR_BIT); const __int128_t MIN = (__int128_t)1 << (N - 1); const __int128_t MAX = ~MIN; ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r338000 - Correct comment about stat truncating st_mtimespec to seconds
Author: ericwf Date: Wed Jul 25 20:42:25 2018 New Revision: 338000 URL: http://llvm.org/viewvc/llvm-project?rev=338000&view=rev Log: Correct comment about stat truncating st_mtimespec to seconds Modified: libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp Modified: libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp?rev=338000&r1=337999&r2=338000&view=diff == --- libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp (original) +++ libcxx/trunk/test/std/experimental/filesystem/fs.op.funcs/fs.op.last_write_time/last_write_time.pass.cpp Wed Jul 25 20:42:25 2018 @@ -208,15 +208,11 @@ static const bool SupportsMinTime = [] { static const bool SupportsNanosecondRoundTrip = [] { NanoSec ns(3); - - // Test if the file_time_type period is less than that of nanoseconds. - auto ft_dur = duration_cast(ns); - if (duration_cast(ft_dur) != ns) -return false; + static_assert(std::is_same::value, ""); // Test that the system call we use to set the times also supports nanosecond // resolution. (utimes does not) - file_time_type ft(ft_dur); + file_time_type ft(ns); { scoped_test_env env; const path p = env.create_file("file", 42); @@ -225,13 +221,14 @@ static const bool SupportsNanosecondRoun } }(); - +// The HFS+ filesystem (used by default before macOS 10.13) stores timestamps at +// a 1-second granularity, and APFS (now the default) at a 1 nanosecond granularity. +// 1-second granularity is also the norm on many of the supported filesystems +// on Linux as well. static const bool WorkaroundStatTruncatesToSeconds = [] { MicroSec micros(3); static_assert(std::is_same::value, ""); - // Test for the behavior of OS X 10.11 and older, which truncates the result - // of st_mtimespec to seconds. file_time_type ft(micros); { scoped_test_env env; @@ -594,14 +591,4 @@ TEST_CASE(test_exists_fails) TEST_CHECK_THROW_RESULT(filesystem_error, Checker, last_write_time(file)); } -// Just for sanity ensure that WorkaroundStatTruncatesToSeconds is only -// ever true on Apple platforms. -TEST_CASE(apple_truncates_to_seconds_check) { -#ifndef __APPLE__ - TEST_CHECK(!WorkaroundStatTruncatesToSeconds); -#else - TEST_CHECK(SupportsNanosecondRoundTrip != WorkaroundStatTruncatesToSeconds); -#endif -} - TEST_SUITE_END() ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r338001 - Cleanup the last_write_time internals
Author: ericwf Date: Wed Jul 25 20:57:26 2018 New Revision: 338001 URL: http://llvm.org/viewvc/llvm-project?rev=338001&view=rev Log: Cleanup the last_write_time internals Modified: libcxx/trunk/src/experimental/filesystem/filesystem_common.h libcxx/trunk/src/experimental/filesystem/operations.cpp Modified: libcxx/trunk/src/experimental/filesystem/filesystem_common.h URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/experimental/filesystem/filesystem_common.h?rev=338001&r1=338000&r2=338001&view=diff == --- libcxx/trunk/src/experimental/filesystem/filesystem_common.h (original) +++ libcxx/trunk/src/experimental/filesystem/filesystem_common.h Wed Jul 25 20:57:26 2018 @@ -19,6 +19,7 @@ #include #include #include +#include // for ::utimes as used in __last_write_time #include /* values for fchmodat */ #include @@ -33,14 +34,6 @@ #endif #endif -#if !defined(_LIBCPP_USE_UTIMENSAT) -#include // for ::utimes as used in __last_write_time -#endif - -#if !defined(UTIME_OMIT) -#include // for ::utimes as used in __last_write_time -#endif - #if defined(__GNUC__) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunused-function" @@ -389,9 +382,11 @@ TimeSpec extract_mtime(StatT const& st) TimeSpec extract_atime(StatT const& st) { return st.st_atim; } #endif -bool set_file_times(const path& p, std::array const& TS, +// allow the utimes implementation to compile even it we're not going +// to use it. + +bool posix_utimes(const path& p, std::array const& TS, error_code& ec) { -#if !defined(_LIBCPP_USE_UTIMENSAT) using namespace chrono; auto Convert = [](long nsec) { using int_type = decltype(std::declval<::timeval>().tv_usec); @@ -400,22 +395,35 @@ bool set_file_times(const path& p, std:: }; struct ::timeval ConvertedTS[2] = {{TS[0].tv_sec, Convert(TS[0].tv_nsec)}, {TS[1].tv_sec, Convert(TS[1].tv_nsec)}}; - if (::utimes(p.c_str(), ConvertedTS) == -1) -#else + if (::utimes(p.c_str(), ConvertedTS) == -1) { +ec = capture_errno(); +return true; + } + return false; +} + +#if defined(_LIBCPP_USE_UTIMENSAT) +bool posix_utimensat(const path& p, std::array const& TS, +error_code& ec) { if (::utimensat(AT_FDCWD, p.c_str(), TS.data(), 0) == -1) -#endif { ec = capture_errno(); return true; } return false; } +#endif -bool set_time_spec_to(TimeSpec& TS, file_time_type NewTime) { - return !fs_time::set_times_checked( - &TS.tv_sec, &TS.tv_nsec, NewTime); +bool set_file_times(const path& p, std::array const& TS, +error_code& ec) { +#if !defined(_LIBCPP_USE_UTIMENSAT) + return posix_utimes(p, TS, ec); +#else + return posix_utimensat(p, TS, ec); +#endif } + } // namespace } // end namespace detail Modified: libcxx/trunk/src/experimental/filesystem/operations.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/experimental/filesystem/operations.cpp?rev=338001&r1=338000&r2=338001&view=diff == --- libcxx/trunk/src/experimental/filesystem/operations.cpp (original) +++ libcxx/trunk/src/experimental/filesystem/operations.cpp Wed Jul 25 20:57:26 2018 @@ -1017,6 +1017,7 @@ file_time_type __last_write_time(const p void __last_write_time(const path& p, file_time_type new_time, error_code *ec) { +using detail::fs_time; ErrorHandler err("last_write_time", ec, &p); error_code m_ec; @@ -1034,7 +1035,7 @@ void __last_write_time(const path& p, fi tbuf[0].tv_sec = 0; tbuf[0].tv_nsec = UTIME_OMIT; #endif -if (detail::set_time_spec_to(tbuf[1], new_time)) +if (!fs_time::convert_to_timespec(tbuf[1], new_time)) return err.report(errc::value_too_large); detail::set_file_times(p, tbuf, m_ec); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r338002 - Be more consistent about which bool value means an error occurred
Author: ericwf Date: Wed Jul 25 21:02:06 2018 New Revision: 338002 URL: http://llvm.org/viewvc/llvm-project?rev=338002&view=rev Log: Be more consistent about which bool value means an error occurred Modified: libcxx/trunk/src/experimental/filesystem/operations.cpp Modified: libcxx/trunk/src/experimental/filesystem/operations.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/experimental/filesystem/operations.cpp?rev=338002&r1=338001&r2=338002&view=diff == --- libcxx/trunk/src/experimental/filesystem/operations.cpp (original) +++ libcxx/trunk/src/experimental/filesystem/operations.cpp Wed Jul 25 21:02:06 2018 @@ -433,19 +433,19 @@ bool posix_ftruncate(const FileDescripto error_code& ec) { if (::ftruncate(fd.fd, to_size) == -1) { ec = capture_errno(); -return false; +return true; } ec.clear(); - return true; + return false; } bool posix_fchmod(const FileDescriptor& fd, const StatT& st, error_code& ec) { if (::fchmod(fd.fd, st.st_mode) == -1) { ec = capture_errno(); -return false; +return true; } ec.clear(); - return true; + return false; } bool stat_equivalent(const StatT& st1, const StatT& st2) { @@ -796,9 +796,9 @@ bool __copy_file(const path& from, const return err.report(errc::bad_file_descriptor); // Set the permissions and truncate the file we opened. -if (!detail::posix_fchmod(to_fd, from_stat, m_ec)) +if (detail::posix_fchmod(to_fd, from_stat, m_ec)) return err.report(m_ec); -if (!detail::posix_ftruncate(to_fd, 0, m_ec)) +if (detail::posix_ftruncate(to_fd, 0, m_ec)) return err.report(m_ec); } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r338005 - Copy LLVM CMake configuration for CMake Policy CMP0068
Author: ericwf Date: Wed Jul 25 22:08:30 2018 New Revision: 338005 URL: http://llvm.org/viewvc/llvm-project?rev=338005&view=rev Log: Copy LLVM CMake configuration for CMake Policy CMP0068 Modified: libcxx/trunk/CMakeLists.txt Modified: libcxx/trunk/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/CMakeLists.txt?rev=338005&r1=338004&r2=338005&view=diff == --- libcxx/trunk/CMakeLists.txt (original) +++ libcxx/trunk/CMakeLists.txt Wed Jul 25 22:08:30 2018 @@ -11,6 +11,10 @@ endif() if(POLICY CMP0022) cmake_policy(SET CMP0022 NEW) # Required when interacting with LLVM and Clang endif() +if(POLICY CMP0068) + cmake_policy(SET CMP0068 NEW) + set(CMAKE_BUILD_WITH_INSTALL_NAME_DIR ON) +endif() # Add path for custom modules set(CMAKE_MODULE_PATH ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r338093 - Implement
Copied: libcxx/trunk/test/std/input.output/filesystems/class.path/path.nonmember/path.factory.pass.cpp (from r338006, libcxx/trunk/test/std/experimental/filesystem/class.path/path.nonmember/path.factory.pass.cpp) URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/filesystems/class.path/path.nonmember/path.factory.pass.cpp?p2=libcxx/trunk/test/std/input.output/filesystems/class.path/path.nonmember/path.factory.pass.cpp&p1=libcxx/trunk/test/std/experimental/filesystem/class.path/path.nonmember/path.factory.pass.cpp&r1=338006&r2=338093&rev=338093&view=diff == --- libcxx/trunk/test/std/experimental/filesystem/class.path/path.nonmember/path.factory.pass.cpp (original) +++ libcxx/trunk/test/std/input.output/filesystems/class.path/path.nonmember/path.factory.pass.cpp Thu Jul 26 20:07:09 2018 @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // template //path u8path(Source const&); Copied: libcxx/trunk/test/std/input.output/filesystems/class.path/path.nonmember/path.io.pass.cpp (from r338006, libcxx/trunk/test/std/experimental/filesystem/class.path/path.nonmember/path.io.pass.cpp) URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/filesystems/class.path/path.nonmember/path.io.pass.cpp?p2=libcxx/trunk/test/std/input.output/filesystems/class.path/path.nonmember/path.io.pass.cpp&p1=libcxx/trunk/test/std/experimental/filesystem/class.path/path.nonmember/path.io.pass.cpp&r1=338006&r2=338093&rev=338093&view=diff == --- libcxx/trunk/test/std/experimental/filesystem/class.path/path.nonmember/path.io.pass.cpp (original) +++ libcxx/trunk/test/std/input.output/filesystems/class.path/path.nonmember/path.io.pass.cpp Thu Jul 26 20:07:09 2018 @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // class path Copied: libcxx/trunk/test/std/input.output/filesystems/class.path/path.nonmember/path.io.unicode_bug.pass.cpp (from r338006, libcxx/trunk/test/std/experimental/filesystem/class.path/path.nonmember/path.io.unicode_bug.pass.cpp) URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/filesystems/class.path/path.nonmember/path.io.unicode_bug.pass.cpp?p2=libcxx/trunk/test/std/input.output/filesystems/class.path/path.nonmember/path.io.unicode_bug.pass.cpp&p1=libcxx/trunk/test/std/experimental/filesystem/class.path/path.nonmember/path.io.unicode_bug.pass.cpp&r1=338006&r2=338093&rev=338093&view=diff == --- libcxx/trunk/test/std/experimental/filesystem/class.path/path.nonmember/path.io.unicode_bug.pass.cpp (original) +++ libcxx/trunk/test/std/input.output/filesystems/class.path/path.nonmember/path.io.unicode_bug.pass.cpp Thu Jul 26 20:07:09 2018 @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // class path Copied: libcxx/trunk/test/std/input.output/filesystems/class.path/path.nonmember/swap.pass.cpp (from r338006, libcxx/trunk/test/std/experimental/filesystem/class.path/path.nonmember/swap.pass.cpp) URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/filesystems/class.path/path.nonmember/swap.pass.cpp?p2=libcxx/trunk/test/std/input.output/filesystems/class.path/path.nonmember/swap.pass.cpp&p1=libcxx/trunk/test/std/experimental/filesystem/class.path/path.nonmember/swap.pass.cpp&r1=338006&r2=338093&rev=338093&view=diff == --- libcxx/trunk/test/std/experimental/filesystem/class.path/path.nonmember/swap.pass.cpp (original) +++ libcxx/trunk/test/std/input.output/filesystems/class.path/path.nonmember/swap.pass.cpp Thu Jul 26 20:07:09 2018 @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // void swap(path& lhs, path& rhs) noexcept; Copied: libcxx/trunk/test/std/input.output/filesystems/class.path/synop.pass.cpp (from r338006, libcxx/trunk/test/std/experimental/filesystem/class.path/synop.pass.cpp) URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/input.output/filesystems/class.path/synop.pass.cpp?p2=libcxx/trunk/test/std/input.output/filesystems/class.path/synop.pass.cpp&p1=libcxx/trunk/test/std/experimental/filesystem/class.path/synop.pass.cpp&r1=338006&r2=338093&rev=338093&view=diff == --- libcxx/trunk/test/std/experimental/filesystem/class.path/synop.pass.cpp (original) +++ libcxx/trunk/test/std/input.output/filesystems/class.path/synop.pass.cpp Thu Jul 26 20:07:09 2018 @@ -9,7 +9,7 @@ // UNSUPPORTED: c++98, c++03 -// +// // class path Copied: libcxx/trunk/test/std/input.output/filesystems/class.rec.dir.itr/rec.dir.itr.members/copy.pass.cpp (from r338006, libcxx/trunk/test/std/experimental/filesystem/class.rec.dir.itr/rec.dir.itr.members/
[libcxx] r338094 - Correctly mark the Filesystem status as complete.
Author: ericwf Date: Thu Jul 26 20:16:02 2018 New Revision: 338094 URL: http://llvm.org/viewvc/llvm-project?rev=338094&view=rev Log: Correctly mark the Filesystem status as complete. Modified: libcxx/trunk/www/cxx1z_status.html Modified: libcxx/trunk/www/cxx1z_status.html URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/cxx1z_status.html?rev=338094&r1=338093&r2=338094&view=diff == --- libcxx/trunk/www/cxx1z_status.html (original) +++ libcxx/trunk/www/cxx1z_status.html Thu Jul 26 20:16:02 2018 @@ -83,8 +83,8 @@ https://wg21.link/P0024R2";>P0024R2LWGThe Parallelism TS Should be StandardizedJacksonville https://wg21.link/P0226R1";>P0226R1LWGMathematical Special Functions for C++17Jacksonville - https://wg21.link/P0220R1";>P0220R1LWGAdopt Library Fundamentals V1 TS Components for C++17JacksonvilleComplete7.0 - https://wg21.link/P0218R1";>P0218R1LWGAdopt the File System TS for C++17JacksonvilleIn Progress + https://wg21.link/P0220R1";>P0220R1LWGAdopt Library Fundamentals V1 TS Components for C++17JacksonvilleIn Progress + https://wg21.link/P0218R1";>P0218R1LWGAdopt the File System TS for C++17JacksonvilleComplete7.0 https://wg21.link/P0033R1";>P0033R1LWGRe-enabling shared_from_thisJacksonvilleComplete3.9 https://wg21.link/P0005R4";>P0005R4LWGAdopt not_fn from Library Fundamentals 2 for C++17JacksonvilleComplete3.9 https://wg21.link/P0152R1";>P0152R1LWGconstexpr atomic::is_always_lock_freeJacksonvilleComplete3.9 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r338095 - Attempt to unbreak *all the bots*
Author: ericwf Date: Thu Jul 26 20:42:58 2018 New Revision: 338095 URL: http://llvm.org/viewvc/llvm-project?rev=338095&view=rev Log: Attempt to unbreak *all the bots* The bots were failing to build the cxx_filesystem target, so the tests were failing. Though this does lead me to wonder how it was ever working with c++experimental. Modified: libcxx/trunk/CMakeLists.txt libcxx/trunk/include/CMakeLists.txt libcxx/trunk/lib/CMakeLists.txt libcxx/trunk/test/CMakeLists.txt Modified: libcxx/trunk/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/CMakeLists.txt?rev=338095&r1=338094&r2=338095&view=diff == --- libcxx/trunk/CMakeLists.txt (original) +++ libcxx/trunk/CMakeLists.txt Thu Jul 26 20:42:58 2018 @@ -72,7 +72,7 @@ set(ENABLE_FILESYSTEM_DEFAULT ${LIBCXX_E if (WIN32) set(ENABLE_FILESYSTEM_DEFAULT OFF) endif() -option(LIBCXX_ENABLE_FILESYSTEM "Build filesystem as part of libc++experimental.a" +option(LIBCXX_ENABLE_FILESYSTEM "Build filesystem as part of libc++fs.a" ${ENABLE_FILESYSTEM_DEFAULT}) option(LIBCXX_INCLUDE_TESTS "Build the libc++ tests." ${LLVM_INCLUDE_TESTS}) @@ -109,7 +109,7 @@ cmake_dependent_option(LIBCXX_INSTALL_EX "LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY;LIBCXX_INSTALL_LIBRARY" OFF) cmake_dependent_option(LIBCXX_INSTALL_FILESYSTEM_LIBRARY "Install libc++fs.a" ON -"LIBCXX_ENABLE_FILESYSTEM_LIBRARY;LIBCXX_INSTALL_LIBRARY" OFF) +"LIBCXX_ENABLE_FILESYSTEM;LIBCXX_INSTALL_LIBRARY" OFF) if (FUCHSIA) set(DEFAULT_ABI_VERSION 2) Modified: libcxx/trunk/include/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/CMakeLists.txt?rev=338095&r1=338094&r2=338095&view=diff == --- libcxx/trunk/include/CMakeLists.txt (original) +++ libcxx/trunk/include/CMakeLists.txt Thu Jul 26 20:42:58 2018 @@ -93,6 +93,7 @@ set(files ext/__hash ext/hash_map ext/hash_set + filesystem float.h forward_list fstream Modified: libcxx/trunk/lib/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/lib/CMakeLists.txt?rev=338095&r1=338094&r2=338095&view=diff == --- libcxx/trunk/lib/CMakeLists.txt (original) +++ libcxx/trunk/lib/CMakeLists.txt Thu Jul 26 20:42:58 2018 @@ -288,10 +288,6 @@ if (LIBCXX_ENABLE_STATIC) endif() endif() -# Add a meta-target for both libraries. -add_custom_target(cxx DEPENDS cxx-headers ${LIBCXX_BUILD_TARGETS}) - - if (LIBCXX_ENABLE_FILESYSTEM) set(LIBCXX_FILESYSTEM_SOURCES ../src/filesystem/operations.cpp @@ -322,6 +318,7 @@ if (LIBCXX_ENABLE_FILESYSTEM) COMPILE_FLAGS "${filesystem_flags}" OUTPUT_NAME "c++fs" ) + list(APPEND LIBCXX_BUILD_TARGETS cxx_filesystem) endif() @@ -344,9 +341,14 @@ if (LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY) COMPILE_FLAGS "${experimental_flags}" OUTPUT_NAME "c++experimental" ) + list(APPEND LIBCXX_BUILD_TARGETS cxx_experimental) endif() +# Add a meta-target for both libraries. +add_custom_target(cxx DEPENDS cxx-headers ${LIBCXX_BUILD_TARGETS}) + + if (LIBCXX_BUILD_EXTERNAL_THREAD_LIBRARY) file(GLOB LIBCXX_EXTERNAL_THREADING_SUPPORT_SOURCES ../test/support/external_threads.cpp) Modified: libcxx/trunk/test/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/CMakeLists.txt?rev=338095&r1=338094&r2=338095&view=diff == --- libcxx/trunk/test/CMakeLists.txt (original) +++ libcxx/trunk/test/CMakeLists.txt Thu Jul 26 20:42:58 2018 @@ -105,7 +105,7 @@ if (LIBCXX_CONFIGURE_IDE) ${LIBCXX_TESTS} ${LIBCXX_TEST_HEADERS} ${LIBCXX_HEADERS}) add_dependencies(libcxx_test_objects cxx) - set(STATIC_ROOT ${LIBCXX_SOURCE_DIR}/test/std/experimental/filesystem/Inputs/static_test_env) + set(STATIC_ROOT ${LIBCXX_SOURCE_DIR}/test/std/input.output/filesystems/Inputs/static_test_env) add_definitions(-DLIBCXX_FILESYSTEM_STATIC_TEST_ROOT="${STATIC_ROOT}") set(DYNAMIC_ROOT ${LIBCXX_BINARY_DIR}/test/filesystem/Output/dynamic_env) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r338096 - Add libc++fs to the test deps, and not to the target 'cxx'.
Author: ericwf Date: Thu Jul 26 20:47:46 2018 New Revision: 338096 URL: http://llvm.org/viewvc/llvm-project?rev=338096&view=rev Log: Add libc++fs to the test deps, and not to the target 'cxx'. Modified: libcxx/trunk/lib/CMakeLists.txt libcxx/trunk/test/CMakeLists.txt Modified: libcxx/trunk/lib/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/lib/CMakeLists.txt?rev=338096&r1=338095&r2=338096&view=diff == --- libcxx/trunk/lib/CMakeLists.txt (original) +++ libcxx/trunk/lib/CMakeLists.txt Thu Jul 26 20:47:46 2018 @@ -288,6 +288,9 @@ if (LIBCXX_ENABLE_STATIC) endif() endif() +# Add a meta-target for both libraries. +add_custom_target(cxx DEPENDS cxx-headers ${LIBCXX_BUILD_TARGETS}) + if (LIBCXX_ENABLE_FILESYSTEM) set(LIBCXX_FILESYSTEM_SOURCES ../src/filesystem/operations.cpp @@ -318,7 +321,6 @@ if (LIBCXX_ENABLE_FILESYSTEM) COMPILE_FLAGS "${filesystem_flags}" OUTPUT_NAME "c++fs" ) - list(APPEND LIBCXX_BUILD_TARGETS cxx_filesystem) endif() @@ -341,14 +343,8 @@ if (LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY) COMPILE_FLAGS "${experimental_flags}" OUTPUT_NAME "c++experimental" ) - list(APPEND LIBCXX_BUILD_TARGETS cxx_experimental) endif() - -# Add a meta-target for both libraries. -add_custom_target(cxx DEPENDS cxx-headers ${LIBCXX_BUILD_TARGETS}) - - if (LIBCXX_BUILD_EXTERNAL_THREAD_LIBRARY) file(GLOB LIBCXX_EXTERNAL_THREADING_SUPPORT_SOURCES ../test/support/external_threads.cpp) Modified: libcxx/trunk/test/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/CMakeLists.txt?rev=338096&r1=338095&r2=338096&view=diff == --- libcxx/trunk/test/CMakeLists.txt (original) +++ libcxx/trunk/test/CMakeLists.txt Thu Jul 26 20:47:46 2018 @@ -58,7 +58,10 @@ set(AUTO_GEN_COMMENT "## Autogenerated b set(LIBCXX_TEST_DEPS "") if (LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY) - set(LIBCXX_TEST_DEPS cxx_experimental) + list(APPEND LIBCXX_TEST_DEPS cxx_experimental) +endif() +if (LIBCXX_ENABLE_FILESYSTEM) + list(APPEND LIBCXX_TEST_DEPS cxx_filesystem) endif() if (LIBCXX_BUILD_EXTERNAL_THREAD_LIBRARY) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r338103 - Move Filesystem namespace definition out of a clang specific ifdef block.
Author: ericwf Date: Thu Jul 26 23:12:46 2018 New Revision: 338103 URL: http://llvm.org/viewvc/llvm-project?rev=338103&view=rev Log: Move Filesystem namespace definition out of a clang specific ifdef block. Modified: libcxx/trunk/include/__config Modified: libcxx/trunk/include/__config URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config?rev=338103&r1=338102&r2=338103&view=diff == --- libcxx/trunk/include/__config (original) +++ libcxx/trunk/include/__config Thu Jul 26 23:12:46 2018 @@ -474,19 +474,6 @@ namespace std { } } -#if _LIBCPP_STD_VER >= 17 -#define _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM \ - _LIBCPP_BEGIN_NAMESPACE_STD inline namespace __fs { namespace filesystem { -#else -#define _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM \ - _LIBCPP_BEGIN_NAMESPACE_STD namespace __fs { namespace filesystem { -#endif - -#define _LIBCPP_END_NAMESPACE_FILESYSTEM \ - _LIBCPP_END_NAMESPACE_STD } } - -#define _VSTD_FS _VSTD::__fs::filesystem - #if !defined(_LIBCPP_HAS_NO_ASAN) && !__has_feature(address_sanitizer) #define _LIBCPP_HAS_NO_ASAN #endif @@ -659,6 +646,20 @@ namespace std { #endif // _LIBCPP_COMPILER_[CLANG|GCC|MSVC|IBM] +#if _LIBCPP_STD_VER >= 17 +#define _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM \ + _LIBCPP_BEGIN_NAMESPACE_STD inline namespace __fs { namespace filesystem { +#else +#define _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM \ + _LIBCPP_BEGIN_NAMESPACE_STD namespace __fs { namespace filesystem { +#endif + +#define _LIBCPP_END_NAMESPACE_FILESYSTEM \ + _LIBCPP_END_NAMESPACE_STD } } + +#define _VSTD_FS _VSTD::__fs::filesystem + + #if defined(_LIBCPP_OBJECT_FORMAT_COFF) #ifdef _DLL ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [libcxx] r324182 - [libc++] Fix PR35491 - std::array of zero-size doesn't work with non-default constructible types.
Sorry about that guys, I was AFK most of the day today. Thanks for cleaning up my mess. On Feb 5, 2018 7:08 PM, "Nirav Davé" wrote: > I reverted r324182, r324185, and r324192 in r324309. Things should be > unstuck now. > > -Nirav > > On Mon, Feb 5, 2018 at 9:06 PM, Nirav Davé wrote: > >> It looks like we need to revert 324182 and 324194. I'll revert on I >> reverify on trunk. >> >> > ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r324498 - [Driver] Add option to manually control discarding value names in LLVM IR.
Author: ericwf Date: Wed Feb 7 10:36:51 2018 New Revision: 324498 URL: http://llvm.org/viewvc/llvm-project?rev=324498&view=rev Log: [Driver] Add option to manually control discarding value names in LLVM IR. Summary: Currently, assertion-disabled Clang builds emit value names when generating LLVM IR. This is controlled by the `NDEBUG` macro, and is not easily overridable. In order to get IR output containing names from a release build of Clang, the user must manually construct the CC1 invocation w/o the `-discard-value-names` option. This is less than ideal. For example, Godbolt uses a release build of Clang, and so when asked to emit LLVM IR the result lacks names, making it harder to read. Manually invoking CC1 on Compiler Explorer is not feasible. This patch adds the driver options `-fdiscard-value-names` and `-fno-discard-value-names` which allow the user to override the default behavior. If neither is specified, the old behavior remains. Reviewers: erichkeane, aaron.ballman, lebedev.ri Reviewed By: aaron.ballman Subscribers: bogner, cfe-commits Differential Revision: https://reviews.llvm.org/D42887 Modified: cfe/trunk/docs/UsersManual.rst cfe/trunk/include/clang/Driver/Options.td cfe/trunk/lib/Driver/ToolChains/Clang.cpp cfe/trunk/test/Driver/clang_f_opts.c Modified: cfe/trunk/docs/UsersManual.rst URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/UsersManual.rst?rev=324498&r1=324497&r2=324498&view=diff == --- cfe/trunk/docs/UsersManual.rst (original) +++ cfe/trunk/docs/UsersManual.rst Wed Feb 7 10:36:51 2018 @@ -1855,6 +1855,27 @@ features. You can "tune" the debug info must come first.) +Controlling LLVM IR Output +-- + +Controlling Value Names in LLVM IR +^^ + +Emitting value names in LLVM IR increases the size and verbosity of the IR. +By default, value names are only emitted in assertion-enabled builds of Clang. +However, when reading IR it can be useful to re-enable the emission of value +names to improve readability. + +.. option:: -fdiscard-value-names + + Discard value names when generating LLVM IR. + +.. option:: -fno-discard-value-names + + Do not discard value names when generating LLVM IR. This option can be used + to re-enable names for release builds of Clang. + + Comment Parsing Options --- Modified: cfe/trunk/include/clang/Driver/Options.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=324498&r1=324497&r2=324498&view=diff == --- cfe/trunk/include/clang/Driver/Options.td (original) +++ cfe/trunk/include/clang/Driver/Options.td Wed Feb 7 10:36:51 2018 @@ -790,6 +790,10 @@ def fdiagnostics_show_template_tree : Fl HelpText<"Print a template comparison tree for differing templates">; def fdeclspec : Flag<["-"], "fdeclspec">, Group, HelpText<"Allow __declspec as a keyword">, Flags<[CC1Option]>; +def fdiscard_value_names : Flag<["-"], "fdiscard-value-names">, Group, + HelpText<"Discard value names in LLVM IR">, Flags<[DriverOption]>; +def fno_discard_value_names : Flag<["-"], "fno-discard-value-names">, Group, + HelpText<"Do not discard value names in LLVM IR">, Flags<[DriverOption]>; def fdollars_in_identifiers : Flag<["-"], "fdollars-in-identifiers">, Group, HelpText<"Allow '$' in identifiers">, Flags<[CC1Option]>; def fdwarf2_cfi_asm : Flag<["-"], "fdwarf2-cfi-asm">, Group; Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Clang.cpp?rev=324498&r1=324497&r2=324498&view=diff == --- cfe/trunk/lib/Driver/ToolChains/Clang.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp Wed Feb 7 10:36:51 2018 @@ -3266,13 +3266,24 @@ void Clang::ConstructJob(Compilation &C, if (!C.isForDiagnostics()) CmdArgs.push_back("-disable-free"); -// Disable the verification pass in -asserts builds. #ifdef NDEBUG - CmdArgs.push_back("-disable-llvm-verifier"); - // Discard LLVM value names in -asserts builds. - CmdArgs.push_back("-discard-value-names"); + const bool IsAssertBuild = false; +#else + const bool IsAssertBuild = true; #endif + // Disable the verification pass in -asserts builds. + if (!IsAssertBuild) +CmdArgs.push_back("disable-llvm-verifier"); + + // Discard value names in assert builds unless otherwise specified. + if (const Arg *A = Args.getLastArg(options::OPT_fdiscard_value_names, + options::OPT_fno_discard_value_names)) { +if (A->getOption().matches(options::OPT_fdiscard_value_names)) + CmdArgs.push_back("-discard-value-names"); + } else if (!IsAssertBuild) +CmdArgs.push_back("-discard-value-names"); + // Set the main file
r324501 - Fix r324498: the commit removed the '-' before the disable-llvm-verifier flag
Author: ericwf Date: Wed Feb 7 11:17:03 2018 New Revision: 324501 URL: http://llvm.org/viewvc/llvm-project?rev=324501&view=rev Log: Fix r324498: the commit removed the '-' before the disable-llvm-verifier flag Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Clang.cpp?rev=324501&r1=324500&r2=324501&view=diff == --- cfe/trunk/lib/Driver/ToolChains/Clang.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp Wed Feb 7 11:17:03 2018 @@ -3274,7 +3274,7 @@ void Clang::ConstructJob(Compilation &C, // Disable the verification pass in -asserts builds. if (!IsAssertBuild) -CmdArgs.push_back("disable-llvm-verifier"); +CmdArgs.push_back("-disable-llvm-verifier"); // Discard value names in assert builds unless otherwise specified. if (const Arg *A = Args.getLastArg(options::OPT_fdiscard_value_names, ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r324526 - [libc++] Fix PR35491 - std::array of zero-size doesn't work with non-default constructible types.
Author: ericwf Date: Wed Feb 7 13:06:13 2018 New Revision: 324526 URL: http://llvm.org/viewvc/llvm-project?rev=324526&view=rev Log: [libc++] Fix PR35491 - std::array of zero-size doesn't work with non-default constructible types. Summary: This patch fixes llvm.org/PR35491 and LWG2157 (https://cplusplus.github.io/LWG/issue2157) The fix attempts to maintain ABI compatibility by replacing the array with a instance of `aligned_storage`. Reviewers: mclow.lists, EricWF Reviewed By: EricWF Subscribers: lichray, cfe-commits Differential Revision: https://reviews.llvm.org/D41223 Added: libcxx/trunk/test/libcxx/containers/sequences/array/array.zero/ libcxx/trunk/test/libcxx/containers/sequences/array/array.zero/db_back.pass.cpp libcxx/trunk/test/libcxx/containers/sequences/array/array.zero/db_front.pass.cpp libcxx/trunk/test/libcxx/containers/sequences/array/array.zero/db_indexing.pass.cpp libcxx/trunk/test/std/containers/sequences/array/array.cons/implicit_copy.pass.cpp libcxx/trunk/test/std/containers/sequences/array/array.fill/fill.fail.cpp libcxx/trunk/test/std/containers/sequences/array/array.swap/swap.fail.cpp libcxx/trunk/test/std/containers/sequences/array/compare.fail.cpp libcxx/trunk/test/std/containers/sequences/array/compare.pass.cpp libcxx/trunk/test/std/containers/sequences/array/size_and_alignment.pass.cpp Modified: libcxx/trunk/include/__config libcxx/trunk/include/array libcxx/trunk/test/std/containers/sequences/array/array.cons/default.pass.cpp libcxx/trunk/test/std/containers/sequences/array/array.data/data.pass.cpp libcxx/trunk/test/std/containers/sequences/array/array.data/data_const.pass.cpp libcxx/trunk/test/std/containers/sequences/array/at.pass.cpp libcxx/trunk/test/std/containers/sequences/array/begin.pass.cpp libcxx/trunk/test/std/containers/sequences/array/empty.fail.cpp libcxx/trunk/test/std/containers/sequences/array/front_back.pass.cpp libcxx/trunk/test/std/containers/sequences/array/indexing.pass.cpp Modified: libcxx/trunk/include/__config URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config?rev=324526&r1=324525&r2=324526&view=diff == --- libcxx/trunk/include/__config (original) +++ libcxx/trunk/include/__config Wed Feb 7 13:06:13 2018 @@ -793,8 +793,13 @@ namespace std { # if !defined(_LIBCPP_DEBUG) # error cannot use _LIBCPP_DEBUG_USE_EXCEPTIONS unless _LIBCPP_DEBUG is defined # endif -# define _NOEXCEPT_DEBUG noexcept(false) -# define _NOEXCEPT_DEBUG_(x) noexcept(false) +# ifdef _LIBCPP_HAS_NO_NOEXCEPT +# define _NOEXCEPT_DEBUG +# define _NOEXCEPT_DEBUG_(x) +# else +# define _NOEXCEPT_DEBUG noexcept(false) +# define _NOEXCEPT_DEBUG_(x) noexcept(false) +#endif #else # define _NOEXCEPT_DEBUG _NOEXCEPT # define _NOEXCEPT_DEBUG_(x) _NOEXCEPT_(x) Modified: libcxx/trunk/include/array URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/array?rev=324526&r1=324525&r2=324526&view=diff == --- libcxx/trunk/include/array (original) +++ libcxx/trunk/include/array Wed Feb 7 13:06:13 2018 @@ -108,6 +108,8 @@ template c #include #include #include +#include // for _LIBCPP_UNREACHABLE +#include <__debug> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header @@ -117,6 +119,7 @@ template c _LIBCPP_BEGIN_NAMESPACE_STD + template struct _LIBCPP_TEMPLATE_VIS array { @@ -134,31 +137,27 @@ struct _LIBCPP_TEMPLATE_VIS array typedef std::reverse_iterator reverse_iterator; typedef std::reverse_iterator const_reverse_iterator; -value_type __elems_[_Size > 0 ? _Size : 1]; +_Tp __elems_[_Size]; // No explicit construct/copy/destroy for aggregate type -_LIBCPP_INLINE_VISIBILITY void fill(const value_type& __u) -{_VSTD::fill_n(__elems_, _Size, __u);} -_LIBCPP_INLINE_VISIBILITY -void swap(array& __a) _NOEXCEPT_(_Size == 0 || __is_nothrow_swappable<_Tp>::value) -{ __swap_dispatch((std::integral_constant()), __a); } +_LIBCPP_INLINE_VISIBILITY void fill(const value_type& __u) { + _VSTD::fill_n(__elems_, _Size, __u); +} _LIBCPP_INLINE_VISIBILITY -void __swap_dispatch(std::true_type, array&) {} - -_LIBCPP_INLINE_VISIBILITY -void __swap_dispatch(std::false_type, array& __a) -{ _VSTD::swap_ranges(__elems_, __elems_ + _Size, __a.__elems_);} +void swap(array& __a) _NOEXCEPT_(__is_nothrow_swappable<_Tp>::value) { + std::swap_ranges(__elems_, __elems_ + _Size, __a.__elems_); +} // iterators: _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 -iterator begin() _NOEXCEPT {return iterator(__elems_);} +iterator begin() _NOEXCEPT {return iterator(data());} _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 -const_iterator begin() const _NOEXC
[libcxx] r324529 - Fix -verify static assert messages for older Clang versions
Author: ericwf Date: Wed Feb 7 13:25:25 2018 New Revision: 324529 URL: http://llvm.org/viewvc/llvm-project?rev=324529&view=rev Log: Fix -verify static assert messages for older Clang versions Modified: libcxx/trunk/test/std/containers/sequences/array/array.fill/fill.fail.cpp libcxx/trunk/test/std/containers/sequences/array/array.swap/swap.fail.cpp Modified: libcxx/trunk/test/std/containers/sequences/array/array.fill/fill.fail.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/array/array.fill/fill.fail.cpp?rev=324529&r1=324528&r2=324529&view=diff == --- libcxx/trunk/test/std/containers/sequences/array/array.fill/fill.fail.cpp (original) +++ libcxx/trunk/test/std/containers/sequences/array/array.fill/fill.fail.cpp Wed Feb 7 13:25:25 2018 @@ -23,7 +23,7 @@ int main() { typedef double T; typedef std::array C; C c = {}; -// expected-error-re@array:* {{static_assert failed {{.*}} "cannot fill zero-sized array of type 'const T'"}} +// expected-error-re@array:* {{static_assert failed {{.*}}"cannot fill zero-sized array of type 'const T'"}} c.fill(5.5); // expected-note {{requested here}} } } Modified: libcxx/trunk/test/std/containers/sequences/array/array.swap/swap.fail.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/array/array.swap/swap.fail.cpp?rev=324529&r1=324528&r2=324529&view=diff == --- libcxx/trunk/test/std/containers/sequences/array/array.swap/swap.fail.cpp (original) +++ libcxx/trunk/test/std/containers/sequences/array/array.swap/swap.fail.cpp Wed Feb 7 13:25:25 2018 @@ -24,7 +24,7 @@ int main() { typedef std::array C; C c = {}; C c2 = {}; -// expected-error-re@array:* {{static_assert failed {{.*}} "cannot swap zero-sized array of type 'const T'"}} +// expected-error-re@array:* {{static_assert failed {{.*}}"cannot swap zero-sized array of type 'const T'"}} c.swap(c2); // expected-note {{requested here}} } } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r324545 - Fix size and alignment of array.
Author: ericwf Date: Wed Feb 7 15:50:25 2018 New Revision: 324545 URL: http://llvm.org/viewvc/llvm-project?rev=324545&view=rev Log: Fix size and alignment of array. An array T[1] isn't necessarily the same say when it's a member of a struct. This patch addresses that problem and corrects the tests to deal with it. Modified: libcxx/trunk/include/__config libcxx/trunk/include/array libcxx/trunk/test/std/containers/sequences/array/size_and_alignment.pass.cpp Modified: libcxx/trunk/include/__config URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config?rev=324545&r1=324544&r2=324545&view=diff == --- libcxx/trunk/include/__config (original) +++ libcxx/trunk/include/__config Wed Feb 7 15:50:25 2018 @@ -582,6 +582,7 @@ namespace std { #define __alignof__ __alignof #define _LIBCPP_NORETURN __declspec(noreturn) #define _ALIGNAS(x) __declspec(align(x)) +#define _ALIGNAS_TYPE(x) alignas(x) #define _LIBCPP_HAS_NO_VARIADICS #define _LIBCPP_BEGIN_NAMESPACE_STD namespace std { Modified: libcxx/trunk/include/array URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/array?rev=324545&r1=324544&r2=324545&view=diff == --- libcxx/trunk/include/array (original) +++ libcxx/trunk/include/array Wed Feb 7 15:50:25 2018 @@ -244,10 +244,11 @@ struct _LIBCPP_TEMPLATE_VIS array<_Tp, 0 typedef std::reverse_iterator reverse_iterator; typedef std::reverse_iterator const_reverse_iterator; - typedef typename conditional::value, const char, char>::type _CharType; -_ALIGNAS(alignment_of<_Tp[1]>::value) _CharType __elems_[sizeof(_Tp[1])]; + +struct _ArrayInStructT { _Tp __data_[1]; }; +_ALIGNAS_TYPE(_ArrayInStructT) _CharType __elems_[sizeof(_ArrayInStructT)]; // No explicit construct/copy/destroy for aggregate type _LIBCPP_INLINE_VISIBILITY void fill(const value_type&) { Modified: libcxx/trunk/test/std/containers/sequences/array/size_and_alignment.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/sequences/array/size_and_alignment.pass.cpp?rev=324545&r1=324544&r2=324545&view=diff == --- libcxx/trunk/test/std/containers/sequences/array/size_and_alignment.pass.cpp (original) +++ libcxx/trunk/test/std/containers/sequences/array/size_and_alignment.pass.cpp Wed Feb 7 15:50:25 2018 @@ -21,12 +21,26 @@ #include "test_macros.h" + +template +struct MyArray { + T elems[Size]; +}; + template void test() { typedef T CArrayT[Size == 0 ? 1 : Size]; typedef std::array ArrayT; - static_assert(sizeof(CArrayT) == sizeof(ArrayT), ""); - static_assert(TEST_ALIGNOF(CArrayT) == TEST_ALIGNOF(ArrayT), ""); + typedef MyArray MyArrayT; + static_assert(sizeof(ArrayT) == sizeof(CArrayT), ""); + static_assert(sizeof(ArrayT) == sizeof(MyArrayT), ""); + static_assert(TEST_ALIGNOF(ArrayT) == TEST_ALIGNOF(MyArrayT), ""); +#if defined(_LIBCPP_VERSION) + ArrayT a; + ((void)a); + static_assert(sizeof(ArrayT) == sizeof(a.__elems_), ""); + static_assert(TEST_ALIGNOF(ArrayT) == __alignof__(a.__elems_), ""); +#endif } template @@ -44,6 +58,8 @@ struct TEST_ALIGNAS(TEST_ALIGNOF(std::ma char data[1000]; }; +//static_assert(sizeof(void*) == 4, ""); + int main() { test_type(); test_type(); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r324799 - Use multi-key tree search for {map, set}::{count, equal_range}
Author: ericwf Date: Fri Feb 9 18:53:47 2018 New Revision: 324799 URL: http://llvm.org/viewvc/llvm-project?rev=324799&view=rev Log: Use multi-key tree search for {map, set}::{count, equal_range} Patch from ngolovl...@gmail.com Reviewed as: https://reviews.llvm.org/D42344 As described in llvm.org/PR30959, the current implementation of std::{map, key}::{count, equal_range} in libcxx is non-conforming. Quoting the C++14 standard [associative.reqmts]p3 > The phrase “equivalence of keys” means the equivalence relation imposed by > the comparison and not the operator== on keys. That is, two keys k1 and k2 are > considered to be equivalent if for the comparison object comp, > comp(k1, k2) == false && comp(k2, k1) == false. In the same section, the requirements table states the following: > a.equal_range(k) equivalent to make_pair(a.lower_bound(k), a.upper_bound(k)) > a.count(k) returns the number of elements with key equivalent to k The behaviour of libstdc++ seems to conform to the standard here. Added: libcxx/trunk/test/std/containers/associative/map/map.ops/count_transparent.pass.cpp libcxx/trunk/test/std/containers/associative/map/map.ops/equal_range_transparent.pass.cpp libcxx/trunk/test/std/containers/associative/multimap/multimap.ops/count_transparent.pass.cpp libcxx/trunk/test/std/containers/associative/multimap/multimap.ops/equal_range_transparent.pass.cpp libcxx/trunk/test/std/containers/associative/multiset/count_transparent.pass.cpp libcxx/trunk/test/std/containers/associative/multiset/equal_range_transparent.pass.cpp libcxx/trunk/test/std/containers/associative/set/count_transparent.pass.cpp libcxx/trunk/test/std/containers/associative/set/equal_range_transparent.pass.cpp Modified: libcxx/trunk/include/map libcxx/trunk/include/set Modified: libcxx/trunk/include/map URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/map?rev=324799&r1=324798&r2=324799&view=diff == --- libcxx/trunk/include/map (original) +++ libcxx/trunk/include/map Fri Feb 9 18:53:47 2018 @@ -1228,7 +1228,7 @@ public: template _LIBCPP_INLINE_VISIBILITY typename enable_if<__is_transparent<_Compare, _K2>::value,size_type>::type -count(const _K2& __k) const {return __tree_.__count_unique(__k);} +count(const _K2& __k) const {return __tree_.__count_multi(__k);} #endif _LIBCPP_INLINE_VISIBILITY iterator lower_bound(const key_type& __k) @@ -1275,11 +1275,11 @@ public: template _LIBCPP_INLINE_VISIBILITY typename enable_if<__is_transparent<_Compare, _K2>::value,pair>::type -equal_range(const _K2& __k) {return __tree_.__equal_range_unique(__k);} +equal_range(const _K2& __k) {return __tree_.__equal_range_multi(__k);} template _LIBCPP_INLINE_VISIBILITY typename enable_if<__is_transparent<_Compare, _K2>::value,pair>::type -equal_range(const _K2& __k) const {return __tree_.__equal_range_unique(__k);} +equal_range(const _K2& __k) const {return __tree_.__equal_range_multi(__k);} #endif private: Modified: libcxx/trunk/include/set URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/set?rev=324799&r1=324798&r2=324799&view=diff == --- libcxx/trunk/include/set (original) +++ libcxx/trunk/include/set Fri Feb 9 18:53:47 2018 @@ -668,7 +668,7 @@ public: template _LIBCPP_INLINE_VISIBILITY typename enable_if<__is_transparent<_Compare, _K2>::value,size_type>::type -count(const _K2& __k) const{return __tree_.__count_unique(__k);} +count(const _K2& __k) const{return __tree_.__count_multi(__k);} #endif _LIBCPP_INLINE_VISIBILITY iterator lower_bound(const key_type& __k) @@ -715,11 +715,11 @@ public: template _LIBCPP_INLINE_VISIBILITY typename enable_if<__is_transparent<_Compare, _K2>::value,pair>::type -equal_range(const _K2& __k) {return __tree_.__equal_range_unique(__k);} +equal_range(const _K2& __k) {return __tree_.__equal_range_multi(__k);} template _LIBCPP_INLINE_VISIBILITY typename enable_if<__is_transparent<_Compare, _K2>::value,pair>::type -equal_range(const _K2& __k) const {return __tree_.__equal_range_unique(__k);} +equal_range(const _K2& __k) const {return __tree_.__equal_range_multi(__k);} #endif }; Added: libcxx/trunk/test/std/containers/associative/map/map.ops/count_transparent.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/map/map.ops/count_transparent.pass.cpp?rev=324799&view=auto == --- libcxx/trunk/test/std/containers/associative/map/map.ops/count_transparent.pass.cpp (added) +++ libcxx/trunk/test/std/containers/associative/map/map.ops/count_t
[libcxx] r324852 - Mark two issues as complete
Author: ericwf Date: Sun Feb 11 13:57:25 2018 New Revision: 324852 URL: http://llvm.org/viewvc/llvm-project?rev=324852&view=rev Log: Mark two issues as complete Modified: libcxx/trunk/www/upcoming_meeting.html Modified: libcxx/trunk/www/upcoming_meeting.html URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/upcoming_meeting.html?rev=324852&r1=324851&r2=324852&view=diff == --- libcxx/trunk/www/upcoming_meeting.html (original) +++ libcxx/trunk/www/upcoming_meeting.html Sun Feb 11 13:57:25 2018 @@ -98,9 +98,9 @@ Issue #Issue NameMeetingStatus https://wg21.link/LWG2412";>2412promise::set_value() and promise::get_future() should not raceJacksonvilleComplete -https://wg21.link/LWG2682";>2682filesystem::copy() won't create a symlink to a directoryJacksonville +https://wg21.link/LWG2682";>2682filesystem::copy() won't create a symlink to a directoryJacksonvilleComplete https://wg21.link/LWG2697";>2697[concurr.ts] Behavior of future/shared_future unwrapping constructor when given an invalid futureJacksonville -https://wg21.link/LWG2708";>2708recursive_directory_iterator::recursion_pending() is incorrectly specifiedJacksonville +https://wg21.link/LWG2708";>2708recursive_directory_iterator::recursion_pending() is incorrectly specifiedJacksonvilleComplete https://wg21.link/LWG2936";>2936Path comparison is defined in terms of the generic formatJacksonville @@ -144,9 +144,9 @@ Comments about the "Review" issues 2412 - I think we do this already - 2682 - Eric - don't we do this already? + 2682 - We already to this 2697 - No concurrency TS implementation yet - 2708 - Eric? + 2708 - We already do this 2936 - Eric - don't we do this already? ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r324853 - Fix libcxx MSVC C++17 redefinition of 'align_val_t'
Author: ericwf Date: Sun Feb 11 14:00:19 2018 New Revision: 324853 URL: http://llvm.org/viewvc/llvm-project?rev=324853&view=rev Log: Fix libcxx MSVC C++17 redefinition of 'align_val_t' Patch from charli...@outlook.com Reviewed as https://reviews.llvm.org/D42354 When the following command is used: > clang-cl -std:c++17 -Iinclude\c++\v1 hello.cc c++.lib An error occurred: In file included from hello.cc:1: In file included from include\c++\v1\iostream:38: In file included from include\c++\v1\ios:216: In file included from include\c++\v1\__locale:15: In file included from include\c++\v1\string:477: In file included from include\c++\v1\string_view:176: In file included from include\c++\v1\__string:56: In file included from include\c++\v1\algorithm:643: In file included from include\c++\v1\memory:656: include\c++\v1\new(165,29): error: redefinition of 'align_val_t' enum class _LIBCPP_ENUM_VIS align_val_t : size_t { }; ^ C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\include\vcruntime_new.h(43,16): note: previous definition is here enum class align_val_t : size_t {}; ^ 1 error generated. vcruntime_new.h has defined align_val_t, libcxx need hide align_val_t. This patch fixes that error. Modified: libcxx/trunk/include/new Modified: libcxx/trunk/include/new URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/new?rev=324853&r1=324852&r2=324853&view=diff == --- libcxx/trunk/include/new (original) +++ libcxx/trunk/include/new Sun Feb 11 14:00:19 2018 @@ -160,6 +160,7 @@ public: #endif // defined(_LIBCPP_BUILDING_NEW) || (_LIBCPP_STD_VER > 11) +#if !defined(_LIBCPP_ABI_MICROSOFT) || defined(_LIBCPP_NO_VCRUNTIME) #if !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION) || _LIBCPP_STD_VER > 14 #ifndef _LIBCPP_CXX03_LANG enum class _LIBCPP_ENUM_VIS align_val_t : size_t { }; @@ -167,6 +168,7 @@ enum class _LIBCPP_ENUM_VIS align_val_t enum align_val_t { __zero = 0, __max = (size_t)-1 }; #endif #endif +#endif } // std ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: r324498 - [Driver] Add option to manually control discarding value names in LLVM IR.
On Mon, Feb 12, 2018 at 9:15 AM, David Blaikie wrote: > > > On Wed, Feb 7, 2018 at 10:38 AM Eric Fiselier via cfe-commits < > cfe-commits@lists.llvm.org> wrote: > >> Author: ericwf >> Date: Wed Feb 7 10:36:51 2018 >> New Revision: 324498 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=324498&view=rev >> Log: >> [Driver] Add option to manually control discarding value names in LLVM IR. >> >> Summary: >> Currently, assertion-disabled Clang builds emit value names when >> generating LLVM IR. This is controlled by the `NDEBUG` macro, and is not >> easily overridable. In order to get IR output containing names from a >> release build of Clang, the user must manually construct the CC1 invocation >> w/o the `-discard-value-names` option. This is less than ideal. >> >> For example, Godbolt uses a release build of Clang, and so when asked to >> emit LLVM IR the result lacks names, making it harder to read. Manually >> invoking CC1 on Compiler Explorer is not feasible. >> > > It wouldn't necessarily have to invoke CC1, it could use "-Xclang > -discard-value-names". > If you were using an assertion build, and wanted to disable value names, then yes -- that would work. However it's the opposite case that is of interest: When you're using a non-assertion build and want to keep value names. In that case invoking CC1 directly is required; otherwise the driver would pass "-discard-value-names". > > >> >> This patch adds the driver options `-fdiscard-value-names` and >> `-fno-discard-value-names` which allow the user to override the default >> behavior. If neither is specified, the old behavior remains. >> >> Reviewers: erichkeane, aaron.ballman, lebedev.ri >> >> Reviewed By: aaron.ballman >> >> Subscribers: bogner, cfe-commits >> >> Differential Revision: https://reviews.llvm.org/D42887 >> >> Modified: >> cfe/trunk/docs/UsersManual.rst >> cfe/trunk/include/clang/Driver/Options.td >> cfe/trunk/lib/Driver/ToolChains/Clang.cpp >> cfe/trunk/test/Driver/clang_f_opts.c >> >> Modified: cfe/trunk/docs/UsersManual.rst >> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ >> UsersManual.rst?rev=324498&r1=324497&r2=324498&view=diff >> >> == >> --- cfe/trunk/docs/UsersManual.rst (original) >> +++ cfe/trunk/docs/UsersManual.rst Wed Feb 7 10:36:51 2018 >> @@ -1855,6 +1855,27 @@ features. You can "tune" the debug info >>must come first.) >> >> >> +Controlling LLVM IR Output >> +-- >> + >> +Controlling Value Names in LLVM IR >> +^^ >> + >> +Emitting value names in LLVM IR increases the size and verbosity of the >> IR. >> +By default, value names are only emitted in assertion-enabled builds of >> Clang. >> +However, when reading IR it can be useful to re-enable the emission of >> value >> +names to improve readability. >> + >> +.. option:: -fdiscard-value-names >> + >> + Discard value names when generating LLVM IR. >> + >> +.. option:: -fno-discard-value-names >> + >> + Do not discard value names when generating LLVM IR. This option can be >> used >> + to re-enable names for release builds of Clang. >> + >> + >> Comment Parsing Options >> --- >> >> >> Modified: cfe/trunk/include/clang/Driver/Options.td >> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/ >> clang/Driver/Options.td?rev=324498&r1=324497&r2=324498&view=diff >> >> == >> --- cfe/trunk/include/clang/Driver/Options.td (original) >> +++ cfe/trunk/include/clang/Driver/Options.td Wed Feb 7 10:36:51 2018 >> @@ -790,6 +790,10 @@ def fdiagnostics_show_template_tree : Fl >> HelpText<"Print a template comparison tree for differing templates">; >> def fdeclspec : Flag<["-"], "fdeclspec">, Group, >>HelpText<"Allow __declspec as a keyword">, Flags<[CC1Option]>; >> +def fdiscard_value_names : Flag<["-"], "fdiscard-value-names">, >> Group, >> + HelpText<"Discard value names in LLVM IR">, Flags<[DriverOption]>; >> +def fno_discard_value_names : Flag<["-"], "fno-discard-value-names">, >>
Re: r324498 - [Driver] Add option to manually control discarding value names in LLVM IR.
On Mon, Feb 12, 2018 at 3:35 PM, David Blaikie wrote: > > > On Mon, Feb 12, 2018 at 2:25 PM Eric Fiselier wrote: > >> On Mon, Feb 12, 2018 at 9:15 AM, David Blaikie >> wrote: >> >>> >>> >>> On Wed, Feb 7, 2018 at 10:38 AM Eric Fiselier via cfe-commits < >>> cfe-commits@lists.llvm.org> wrote: >>> >>>> Author: ericwf >>>> Date: Wed Feb 7 10:36:51 2018 >>>> New Revision: 324498 >>>> >>>> URL: http://llvm.org/viewvc/llvm-project?rev=324498&view=rev >>>> Log: >>>> [Driver] Add option to manually control discarding value names in LLVM >>>> IR. >>>> >>>> Summary: >>>> Currently, assertion-disabled Clang builds emit value names when >>>> generating LLVM IR. This is controlled by the `NDEBUG` macro, and is not >>>> easily overridable. In order to get IR output containing names from a >>>> release build of Clang, the user must manually construct the CC1 invocation >>>> w/o the `-discard-value-names` option. This is less than ideal. >>>> >>>> For example, Godbolt uses a release build of Clang, and so when asked >>>> to emit LLVM IR the result lacks names, making it harder to read. Manually >>>> invoking CC1 on Compiler Explorer is not feasible. >>>> >>> >>> It wouldn't necessarily have to invoke CC1, it could use "-Xclang >>> -discard-value-names". >>> >> >> If you were using an assertion build, and wanted to disable value names, >> then yes -- that would work. However it's the opposite case that is of >> interest: >> When you're using a non-assertion build and want to keep value names. In >> that case invoking CC1 directly is required; otherwise the driver would pass >> "-discard-value-names". >> > > Ah, thanks for explaining! > > >> >> >>> >>> >>>> >>>> This patch adds the driver options `-fdiscard-value-names` and >>>> `-fno-discard-value-names` which allow the user to override the default >>>> behavior. If neither is specified, the old behavior remains. >>>> >>>> Reviewers: erichkeane, aaron.ballman, lebedev.ri >>>> >>>> Reviewed By: aaron.ballman >>>> >>>> Subscribers: bogner, cfe-commits >>>> >>>> Differential Revision: https://reviews.llvm.org/D42887 >>>> >>>> Modified: >>>> cfe/trunk/docs/UsersManual.rst >>>> cfe/trunk/include/clang/Driver/Options.td >>>> cfe/trunk/lib/Driver/ToolChains/Clang.cpp >>>> cfe/trunk/test/Driver/clang_f_opts.c >>>> >>>> Modified: cfe/trunk/docs/UsersManual.rst >>>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ >>>> UsersManual.rst?rev=324498&r1=324497&r2=324498&view=diff >>>> >>>> == >>>> --- cfe/trunk/docs/UsersManual.rst (original) >>>> +++ cfe/trunk/docs/UsersManual.rst Wed Feb 7 10:36:51 2018 >>>> @@ -1855,6 +1855,27 @@ features. You can "tune" the debug info >>>>must come first.) >>>> >>>> >>>> +Controlling LLVM IR Output >>>> +-- >>>> + >>>> +Controlling Value Names in LLVM IR >>>> +^^ >>>> + >>>> +Emitting value names in LLVM IR increases the size and verbosity of >>>> the IR. >>>> +By default, value names are only emitted in assertion-enabled builds >>>> of Clang. >>>> +However, when reading IR it can be useful to re-enable the emission of >>>> value >>>> +names to improve readability. >>>> + >>>> +.. option:: -fdiscard-value-names >>>> + >>>> + Discard value names when generating LLVM IR. >>>> + >>>> +.. option:: -fno-discard-value-names >>>> + >>>> + Do not discard value names when generating LLVM IR. This option can >>>> be used >>>> + to re-enable names for release builds of Clang. >>>> + >>>> + >>>> Comment Parsing Options >>>> --- >>>> >>>> >>>> Modified: cfe/trunk/include/clang/Driver/Options.td >>>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/in
Re: r324498 - [Driver] Add option to manually control discarding value names in LLVM IR.
On Mon, Feb 12, 2018 at 4:01 PM, David Blaikie wrote: > ah, sweet :) > > On Mon, Feb 12, 2018 at 2:59 PM Eric Fiselier wrote: > >> On Mon, Feb 12, 2018 at 3:35 PM, David Blaikie >> wrote: >> >>> >>> >>> On Mon, Feb 12, 2018 at 2:25 PM Eric Fiselier wrote: >>> >>>> On Mon, Feb 12, 2018 at 9:15 AM, David Blaikie >>>> wrote: >>>> >>>>> >>>>> >>>>> On Wed, Feb 7, 2018 at 10:38 AM Eric Fiselier via cfe-commits < >>>>> cfe-commits@lists.llvm.org> wrote: >>>>> >>>>>> Author: ericwf >>>>>> Date: Wed Feb 7 10:36:51 2018 >>>>>> New Revision: 324498 >>>>>> >>>>>> URL: http://llvm.org/viewvc/llvm-project?rev=324498&view=rev >>>>>> Log: >>>>>> [Driver] Add option to manually control discarding value names in >>>>>> LLVM IR. >>>>>> >>>>>> Summary: >>>>>> Currently, assertion-disabled Clang builds emit value names when >>>>>> generating LLVM IR. This is controlled by the `NDEBUG` macro, and is not >>>>>> easily overridable. In order to get IR output containing names from a >>>>>> release build of Clang, the user must manually construct the CC1 >>>>>> invocation >>>>>> w/o the `-discard-value-names` option. This is less than ideal. >>>>>> >>>>>> For example, Godbolt uses a release build of Clang, and so when asked >>>>>> to emit LLVM IR the result lacks names, making it harder to read. >>>>>> Manually >>>>>> invoking CC1 on Compiler Explorer is not feasible. >>>>>> >>>>> >>>>> It wouldn't necessarily have to invoke CC1, it could use "-Xclang >>>>> -discard-value-names". >>>>> >>>> >>>> If you were using an assertion build, and wanted to disable value >>>> names, then yes -- that would work. However it's the opposite case that is >>>> of interest: >>>> When you're using a non-assertion build and want to keep value names. >>>> In that case invoking CC1 directly is required; otherwise the driver would >>>> pass >>>> "-discard-value-names". >>>> >>> >>> Ah, thanks for explaining! >>> >>> >>>> >>>> >>>>> >>>>> >>>>>> >>>>>> This patch adds the driver options `-fdiscard-value-names` and >>>>>> `-fno-discard-value-names` which allow the user to override the default >>>>>> behavior. If neither is specified, the old behavior remains. >>>>>> >>>>>> Reviewers: erichkeane, aaron.ballman, lebedev.ri >>>>>> >>>>>> Reviewed By: aaron.ballman >>>>>> >>>>>> Subscribers: bogner, cfe-commits >>>>>> >>>>>> Differential Revision: https://reviews.llvm.org/D42887 >>>>>> >>>>>> Modified: >>>>>> cfe/trunk/docs/UsersManual.rst >>>>>> cfe/trunk/include/clang/Driver/Options.td >>>>>> cfe/trunk/lib/Driver/ToolChains/Clang.cpp >>>>>> cfe/trunk/test/Driver/clang_f_opts.c >>>>>> >>>>>> Modified: cfe/trunk/docs/UsersManual.rst >>>>>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ >>>>>> UsersManual.rst?rev=324498&r1=324497&r2=324498&view=diff >>>>>> >>>>>> == >>>>>> --- cfe/trunk/docs/UsersManual.rst (original) >>>>>> +++ cfe/trunk/docs/UsersManual.rst Wed Feb 7 10:36:51 2018 >>>>>> @@ -1855,6 +1855,27 @@ features. You can "tune" the debug info >>>>>>must come first.) >>>>>> >>>>>> >>>>>> +Controlling LLVM IR Output >>>>>> +-- >>>>>> + >>>>>> +Controlling Value Names in LLVM IR >>>>>> +^^ >>>>>> + >>>>>> +Emitting value names in LLVM IR increases the size and verbosity of >>>>>> the IR. >>>>>> +By default, va
r325171 - Clean up -fdiscard-value-name handling
Author: ericwf Date: Wed Feb 14 12:56:52 2018 New Revision: 325171 URL: http://llvm.org/viewvc/llvm-project?rev=325171&view=rev Log: Clean up -fdiscard-value-name handling Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Clang.cpp?rev=325171&r1=325170&r2=325171&view=diff == --- cfe/trunk/lib/Driver/ToolChains/Clang.cpp (original) +++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp Wed Feb 14 12:56:52 2018 @@ -3281,11 +3281,8 @@ void Clang::ConstructJob(Compilation &C, CmdArgs.push_back("-disable-llvm-verifier"); // Discard value names in assert builds unless otherwise specified. - if (const Arg *A = Args.getLastArg(options::OPT_fdiscard_value_names, - options::OPT_fno_discard_value_names)) { -if (A->getOption().matches(options::OPT_fdiscard_value_names)) - CmdArgs.push_back("-discard-value-names"); - } else if (!IsAssertBuild) + if (Args.hasFlag(options::OPT_fdiscard_value_names, + options::OPT_fno_discard_value_names, !IsAssertBuild)) CmdArgs.push_back("-discard-value-names"); // Set the main file name, so that debug info works even with ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r325205 - Fix test failure on compilers w/o deduction guides
Author: ericwf Date: Wed Feb 14 18:41:19 2018 New Revision: 325205 URL: http://llvm.org/viewvc/llvm-project?rev=325205&view=rev Log: Fix test failure on compilers w/o deduction guides Modified: libcxx/trunk/test/std/strings/basic.string/string.cons/iter_alloc_deduction.pass.cpp libcxx/trunk/utils/libcxx/test/config.py Modified: libcxx/trunk/test/std/strings/basic.string/string.cons/iter_alloc_deduction.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/strings/basic.string/string.cons/iter_alloc_deduction.pass.cpp?rev=325205&r1=325204&r2=325205&view=diff == --- libcxx/trunk/test/std/strings/basic.string/string.cons/iter_alloc_deduction.pass.cpp (original) +++ libcxx/trunk/test/std/strings/basic.string/string.cons/iter_alloc_deduction.pass.cpp Wed Feb 14 18:41:19 2018 @@ -9,8 +9,7 @@ // // UNSUPPORTED: c++98, c++03, c++11, c++14 -// UNSUPPORTED: clang-3.3, clang-3.4, clang-3.5, clang-3.6, clang-3.7, clang-3.8, clang-3.9, clang-4.0 -// UNSUPPORTED: apple-clang-6, apple-clang-7, apple-clang-8.0 +// XFAIL: libcpp-no-deduction-guides // template // basic_string(InputIterator begin, InputIterator end, Modified: libcxx/trunk/utils/libcxx/test/config.py URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/utils/libcxx/test/config.py?rev=325205&r1=325204&r2=325205&view=diff == --- libcxx/trunk/utils/libcxx/test/config.py (original) +++ libcxx/trunk/utils/libcxx/test/config.py Wed Feb 14 18:41:19 2018 @@ -463,7 +463,8 @@ class Configuration(object): if '__cpp_structured_bindings' not in macros: self.config.available_features.add('libcpp-no-structured-bindings') -if '__cpp_deduction_guides' not in macros: +if '__cpp_deduction_guides' not in macros or \ +int(macros['__cpp_deduction_guides']) < 201611: self.config.available_features.add('libcpp-no-deduction-guides') if self.is_windows: ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r303831 - [coroutines] Fix fallthrough diagnostics for coroutines
Author: ericwf Date: Wed May 24 21:16:53 2017 New Revision: 303831 URL: http://llvm.org/viewvc/llvm-project?rev=303831&view=rev Log: [coroutines] Fix fallthrough diagnostics for coroutines Summary: This patch fixes a number of issues with the analysis warnings emitted when a coroutine may reach the end of the function w/o returning. * Fix bug where coroutines with `return_value` are incorrectly diagnosed as missing `co_return`'s. * Rework diagnostic message to no longer say "non-void coroutine", because that implies the coroutine doesn't have a void return type, which it might. In this case a non-void coroutine is one who's promise type does not contain `return_void()` As a side-effect of this patch, coroutine bodies that contain an invalid coroutine promise objects are marked as invalid. Reviewers: GorNishanov, rsmith, aaron.ballman, majnemer Reviewed By: GorNishanov Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D33532 Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td cfe/trunk/include/clang/Sema/ScopeInfo.h cfe/trunk/lib/Analysis/AnalysisDeclContext.cpp cfe/trunk/lib/Sema/AnalysisBasedWarnings.cpp cfe/trunk/lib/Sema/SemaCoroutine.cpp cfe/trunk/lib/Sema/SemaDecl.cpp cfe/trunk/test/SemaCXX/coreturn.cpp cfe/trunk/test/SemaCXX/coroutines.cpp Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=303831&r1=303830&r2=303831&view=diff == --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original) +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Wed May 24 21:16:53 2017 @@ -537,10 +537,10 @@ def err_maybe_falloff_nonvoid_block : Er def err_falloff_nonvoid_block : Error< "control reaches end of non-void block">; def warn_maybe_falloff_nonvoid_coroutine : Warning< - "control may reach end of non-void coroutine">, + "control may reach end of coroutine; which is undefined behavior because the promise type %0 does not declare 'return_void()'">, InGroup; def warn_falloff_nonvoid_coroutine : Warning< - "control reaches end of non-void coroutine">, + "control reaches end of coroutine; which is undefined behavior because the promise type %0 does not declare 'return_void()'">, InGroup; def warn_suggest_noreturn_function : Warning< "%select{function|method}0 %1 could be declared with attribute 'noreturn'">, Modified: cfe/trunk/include/clang/Sema/ScopeInfo.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/ScopeInfo.h?rev=303831&r1=303830&r2=303831&view=diff == --- cfe/trunk/include/clang/Sema/ScopeInfo.h (original) +++ cfe/trunk/include/clang/Sema/ScopeInfo.h Wed May 24 21:16:53 2017 @@ -388,6 +388,8 @@ public: (HasBranchProtectedScope && HasBranchIntoScope)); } + bool isCoroutine() const { return !FirstCoroutineStmtLoc.isInvalid(); } + void setFirstCoroutineStmt(SourceLocation Loc, StringRef Keyword) { assert(FirstCoroutineStmtLoc.isInvalid() && "first coroutine statement location already set"); Modified: cfe/trunk/lib/Analysis/AnalysisDeclContext.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/AnalysisDeclContext.cpp?rev=303831&r1=303830&r2=303831&view=diff == --- cfe/trunk/lib/Analysis/AnalysisDeclContext.cpp (original) +++ cfe/trunk/lib/Analysis/AnalysisDeclContext.cpp Wed May 24 21:16:53 2017 @@ -92,6 +92,8 @@ Stmt *AnalysisDeclContext::getBody(bool IsAutosynthesized = false; if (const FunctionDecl *FD = dyn_cast(D)) { Stmt *Body = FD->getBody(); +if (auto *CoroBody = dyn_cast_or_null(Body)) + Body = CoroBody->getBody(); if (Manager && Manager->synthesizeBodies()) { Stmt *SynthesizedBody = getBodyFarm(getASTContext(), Manager->Injector.get()).getBody(FD); Modified: cfe/trunk/lib/Sema/AnalysisBasedWarnings.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/AnalysisBasedWarnings.cpp?rev=303831&r1=303830&r2=303831&view=diff == --- cfe/trunk/lib/Sema/AnalysisBasedWarnings.cpp (original) +++ cfe/trunk/lib/Sema/AnalysisBasedWarnings.cpp Wed May 24 21:16:53 2017 @@ -334,10 +334,6 @@ static ControlFlowKind CheckFallThrough( bool HasPlainEdge = false; bool HasAbnormalEdge = false; - // In a coroutine, only co_return statements count as normal returns. Remember - // if we are processing a coroutine or not. - const bool IsCoroutine = isa(AC.getBody()); - // Ignore default cases that aren't likely to be reachable because all // enums in a switch(X) have explicit case statements. CFGBlock::FilterOptions FO; @@ -379,7 +375,7 @@ static Con
[libcxx] r303835 - Fix broken links on C++1z status page
Author: ericwf Date: Wed May 24 23:09:07 2017 New Revision: 303835 URL: http://llvm.org/viewvc/llvm-project?rev=303835&view=rev Log: Fix broken links on C++1z status page Modified: libcxx/trunk/www/cxx1z_status.html Modified: libcxx/trunk/www/cxx1z_status.html URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/www/cxx1z_status.html?rev=303835&r1=303834&r2=303835&view=diff == --- libcxx/trunk/www/cxx1z_status.html (original) +++ libcxx/trunk/www/cxx1z_status.html Wed May 24 23:09:07 2017 @@ -71,13 +71,13 @@ http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4366";>N4366LWGLWG 2228 missing SFINAE ruleLenexaComplete3.1 http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4510";>N4510LWGMinimal incomplete type support for standard containers, revision 4LenexaComplete3.6 - http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/P0004R1.html";>P0004R1LWGRemove Deprecated iostreams aliases.KonaComplete3.8 + http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/p0004r1.html";>P0004R1LWGRemove Deprecated iostreams aliases.KonaComplete3.8 http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/p0006r0.html";>P0006R0LWGAdopt Type Traits Variable Templates for C++17.KonaComplete3.8 - http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/P0092R1.html";>P0092R1LWGPolishingKonaComplete3.8 - http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/P0007R1.html";>P0007R1LWGConstant View: A proposal for a std::as_const helper function template.KonaComplete3.8 + http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/p0092r1.html";>P0092R1LWGPolishing KonaComplete3.8 + http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/p0007r1.html";>P0007R1LWGConstant View: A proposal for a std::as_const helper function template.KonaComplete3.8 http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/p0156r0.html"; >P0156R0LWGVariadic lock_guard(rev 3).KonaReverted in Kona3.9 - http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/P0074R0.html";>P0074R0LWGMaking std::owner_less more flexibleKonaComplete3.8 - http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/P0013R1.html";>P0013R1LWGLogical type traits rev 2KonaComplete3.8 + http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/p0074r0.html";>P0074R0LWGMaking std::owner_less more flexibleKonaComplete3.8 + http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/p0013r1.html";>P0013R1LWGLogical type traits rev 2KonaComplete3.8 http://wg21.link/P0024R2";>P0024R2LWGThe Parallelism TS Should be StandardizedJacksonville http://wg21.link/P0226R1";>P0226R1LWGMathematical Special Functions for C++17Jacksonville ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits