aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/include
diff options
context:
space:
mode:
authorAlexander Karatarakis <alkarata@microsoft.com>2017-03-13 17:38:04 -0700
committerAlexander Karatarakis <alkarata@microsoft.com>2017-03-13 17:56:21 -0700
commit4114d87a0774fff7d8bc5e041bb56158bfdbcac8 (patch)
tree5afcf15a4de03e9294e5fe3b301cdc902b01ddd6 /toolsrc/include
parent98ea6780e7a4af7d237783a72a2a56a6188ae3da (diff)
downloadvcpkg-4114d87a0774fff7d8bc5e041bb56158bfdbcac8.tar.gz
vcpkg-4114d87a0774fff7d8bc5e041bb56158bfdbcac8.zip
All Checks now take LineInfo as the first argument
Diffstat (limited to 'toolsrc/include')
-rw-r--r--toolsrc/include/expected.h12
-rw-r--r--toolsrc/include/vcpkg_Checks.h26
-rw-r--r--toolsrc/include/vcpkg_Files.h2
3 files changed, 20 insertions, 20 deletions
diff --git a/toolsrc/include/expected.h b/toolsrc/include/expected.h
index cbb513b22..377168645 100644
--- a/toolsrc/include/expected.h
+++ b/toolsrc/include/expected.h
@@ -40,15 +40,15 @@ namespace vcpkg
return this->m_error_code;
}
- T&& get_or_throw() &&
+ T&& get_or_throw(const LineInfo& line_info) &&
{
- throw_if_error();
+ throw_if_error(line_info);
return std::move(this->m_t);
}
- const T& get_or_throw() const &
+ const T& get_or_throw(const LineInfo& line_info) const &
{
- throw_if_error();
+ throw_if_error(line_info);
return this->m_t;
}
@@ -71,9 +71,9 @@ namespace vcpkg
}
private:
- void throw_if_error() const
+ void throw_if_error(const LineInfo& line_info) const
{
- Checks::check_throw(!this->m_error_code, this->m_error_code.message().c_str());
+ Checks::check_throw(line_info, !this->m_error_code, this->m_error_code.message().c_str());
}
std::error_code m_error_code;
diff --git a/toolsrc/include/vcpkg_Checks.h b/toolsrc/include/vcpkg_Checks.h
index 76c86cfab..47662637f 100644
--- a/toolsrc/include/vcpkg_Checks.h
+++ b/toolsrc/include/vcpkg_Checks.h
@@ -8,45 +8,45 @@ namespace vcpkg::Checks
__declspec(noreturn) void unreachable(const LineInfo& line_info);
// Part of the reason these exist is to not include extra headers in this one to avoid circular #includes.
- _declspec(noreturn) void exit_with_message(const char* errorMessage);
+ _declspec(noreturn) void exit_with_message(const LineInfo& line_info, const char* errorMessage);
template <class...Args>
- _declspec(noreturn) void exit_with_message(const char* errorMessageTemplate, const Args&... errorMessageArgs)
+ _declspec(noreturn) void exit_with_message(const LineInfo& line_info, const char* errorMessageTemplate, const Args&... errorMessageArgs)
{
- exit_with_message(Strings::format(errorMessageTemplate, errorMessageArgs...).c_str());
+ exit_with_message(line_info, Strings::format(errorMessageTemplate, errorMessageArgs...).c_str());
}
- _declspec(noreturn) void throw_with_message(const char* errorMessage);
+ _declspec(noreturn) void throw_with_message(const LineInfo& line_info, const char* errorMessage);
template <class...Args>
- _declspec(noreturn) void throw_with_message(const char* errorMessageTemplate, const Args&... errorMessageArgs)
+ _declspec(noreturn) void throw_with_message(const LineInfo& line_info, const char* errorMessageTemplate, const Args&... errorMessageArgs)
{
- throw_with_message(Strings::format(errorMessageTemplate, errorMessageArgs...).c_str());
+ throw_with_message(line_info, Strings::format(errorMessageTemplate, errorMessageArgs...).c_str());
}
- void check_throw(bool expression, const char* errorMessage);
+ void check_throw(const LineInfo& line_info, bool expression, const char* errorMessage);
template <class...Args>
- void check_throw(bool expression, const char* errorMessageTemplate, const Args&... errorMessageArgs)
+ void check_throw(const LineInfo& line_info, bool expression, const char* errorMessageTemplate, const Args&... errorMessageArgs)
{
if (!expression)
{
// Only create the string if the expression is false
- throw_with_message(Strings::format(errorMessageTemplate, errorMessageArgs...).c_str());
+ throw_with_message(line_info, Strings::format(errorMessageTemplate, errorMessageArgs...).c_str());
}
}
- void check_exit(bool expression);
+ void check_exit(const LineInfo& line_info, bool expression);
- void check_exit(bool expression, const char* errorMessage);
+ void check_exit(const LineInfo& line_info, bool expression, const char* errorMessage);
template <class...Args>
- void check_exit(bool expression, const char* errorMessageTemplate, const Args&... errorMessageArgs)
+ void check_exit(const LineInfo& line_info, bool expression, const char* errorMessageTemplate, const Args&... errorMessageArgs)
{
if (!expression)
{
// Only create the string if the expression is false
- exit_with_message(Strings::format(errorMessageTemplate, errorMessageArgs...).c_str());
+ exit_with_message(line_info, Strings::format(errorMessageTemplate, errorMessageArgs...).c_str());
}
}
}
diff --git a/toolsrc/include/vcpkg_Files.h b/toolsrc/include/vcpkg_Files.h
index 3f9570946..0b0373231 100644
--- a/toolsrc/include/vcpkg_Files.h
+++ b/toolsrc/include/vcpkg_Files.h
@@ -8,7 +8,7 @@ namespace vcpkg::Files
{
static const char* FILESYSTEM_INVALID_CHARACTERS = R"(\/:*?"<>|)";
- void check_is_directory(const fs::path& dirpath);
+ void check_is_directory(const LineInfo& line_info, const fs::path& dirpath);
bool has_invalid_chars_for_filesystem(const std::string& s);