Put LineInfo in separate h/cpp
ADD
include/LineInfo.h
+#pragma once
+
+namespace vcpkg
+{
+ struct LineInfo
+ {
+ int line_number;
+ const char* file_name;
+
+ constexpr LineInfo() : line_number(0), file_name(nullptr) {}
+ constexpr LineInfo(const int line_number, const char* file_name) : line_number(line_number), file_name(file_name) {}
+
+ std::string toString() const;
+ };
+}
+
+#define VCPKG_LINE_INFO vcpkg::LineInfo(__LINE__, __FILE__)

MODIFY
include/vcpkg_Checks.h
include/vcpkg_Checks.h
#pragma once
#include "vcpkg_Strings.h"
-
-namespace vcpkg
-{
- struct LineInfo
- {
- int line_number;
- const char* file_name;
-
- constexpr LineInfo() : line_number(0), file_name(nullptr) {}
- constexpr LineInfo(const int line_number, const char* file_name) : line_number(line_number), file_name(file_name) {}
-
- std::string toString() const;
- };
-}
-
-#define VCPKG_LINE_INFO vcpkg::LineInfo(__LINE__, __FILE__)
+#include "LineInfo.h"
namespace vcpkg::Checks
{

ADD
src/LineInfo.cpp
+#include "pch.h"
+#include "LineInfo.h"
+#include "vcpkg_Strings.h"
+
+namespace vcpkg
+{
+ std::string LineInfo::toString() const
+ {
+ return Strings::format("%s(%d)", this->file_name, this->line_number);
+ }
+}

MODIFY
src/vcpkg_Checks.cpp
src/vcpkg_Checks.cpp
#include "vcpkg_System.h"
#include "vcpkglib.h"
-namespace vcpkg
-{
- std::string LineInfo::toString() const
- {
- return Strings::format("%s(%d)", this->file_name, this->line_number);
- }
-}
-
namespace vcpkg::Checks
{
__declspec(noreturn) void unreachable(const LineInfo& line_info)

MODIFY
vcpkglib/vcpkglib.vcxproj
vcpkglib/vcpkglib.vcxproj
<ItemGroup>
<ClInclude Include="..\include\BinaryParagraph.h" />
<ClInclude Include="..\include\lazy.h" />
+ <ClInclude Include="..\include\LineInfo.h" />
<ClInclude Include="..\include\PostBuildLint_BuildInfo.h" />
<ClInclude Include="..\include\PostBuildLint_BuildPolicies.h" />
<ClInclude Include="..\include\coff_file_reader.h" />
<ItemGroup>
<ClCompile Include="..\src\BinaryParagraph.cpp" />
<ClCompile Include="..\src\commands_ci.cpp" />
+ <ClCompile Include="..\src\LineInfo.cpp" />
<ClCompile Include="..\src\PostBuildLint_BuildInfo.cpp" />
<ClCompile Include="..\src\PostBuildLint_BuildPolicies.cpp" />
<ClCompile Include="..\src\coff_file_reader.cpp" />

MODIFY
vcpkglib/vcpkglib.vcxproj.filters
vcpkglib/vcpkglib.vcxproj.filters
<ClCompile Include="..\src\vcpkg_Chrono.cpp">
<Filter>Source Files</Filter>
</ClCompile>
+ <ClCompile Include="..\src\LineInfo.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\include\package_spec.h">
<ClInclude Include="..\include\lazy.h">
<Filter>Header Files</Filter>
</ClInclude>
+ <ClInclude Include="..\include\LineInfo.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
</ItemGroup>
</Project>
\ No newline at end of file

Put LineInfo in separate h/cpp