cmListFileContext: Simplify explicit rule-of-five members

This commit is contained in:
Brad King 2021-12-07 17:35:44 -05:00
parent d0ceb409ff
commit 61c46c95ae

View File

@ -80,6 +80,18 @@ public:
cm::optional<std::string> DeferId;
cmListFileContext() = default;
cmListFileContext(cmListFileContext&& /*other*/) = default;
cmListFileContext(const cmListFileContext& /*other*/) = default;
cmListFileContext& operator=(const cmListFileContext& /*other*/) = default;
#if __cplusplus >= 201703L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L)
cmListFileContext& operator=(cmListFileContext&& /*other*/) = default;
#else
// The move assignment operators for several STL classes did not become
// noexcept until C++17, which causes some tools to warn about this move
// assignment operator throwing an exception when it shouldn't.
cmListFileContext& operator=(cmListFileContext&& /*other*/) = delete;
#endif
cmListFileContext(std::string name, std::string filePath, long line)
: Name(std::move(name))
, FilePath(std::move(filePath))
@ -87,14 +99,6 @@ public:
{
}
#if __cplusplus < 201703L && (!defined(_MSVC_LANG) || _MSVC_LANG < 201703L)
cmListFileContext(const cmListFileContext& /*other*/) = default;
cmListFileContext(cmListFileContext&& /*other*/) = default;
cmListFileContext& operator=(const cmListFileContext& /*other*/) = default;
cmListFileContext& operator=(cmListFileContext&& /*other*/) = delete;
#endif
static cmListFileContext FromCommandContext(
cmCommandContext const& lfcc, std::string const& fileName,
cm::optional<std::string> deferId = {})