Skip to content

Commit d91e91d

Browse files
committed
more compile time improvment
1 parent d795497 commit d91e91d

5 files changed

Lines changed: 35 additions & 3 deletions

File tree

‎api/python/src/pylief-pch.hpp‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
#if defined __cplusplus
22
#include <nanobind/nanobind.h>
33
#include <nanobind/stl/string.h>
4-
#include <LIEF/errors.hpp>
4+
#include <nanobind/stl/unique_ptr.h>
5+
#include <nanobind/make_iterator.h>
6+
7+
#include <string>
58
#include <sstream>
69
#include <ostream>
710
#include <memory>
811
#include <vector>
12+
#include <algorithm>
13+
#include <cstdint>
914
#else
1015
#include <stdint.h>
1116
#include <stddef.h>

‎include/LIEF/PE/Binary.hpp‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
#include "LIEF/PE/DataDirectory.hpp"
2525
#include "LIEF/PE/Builder.hpp"
2626
#include "LIEF/PE/ResourcesManager.hpp"
27-
#include "LIEF/PE/ExceptionInfo.hpp"
2827
#include "LIEF/PE/signature/Signature.hpp"
2928

3029
#include "LIEF/COFF/Symbol.hpp"

‎include/LIEF/errors.hpp‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#ifndef LIEF_ERROR_H
1717
#define LIEF_ERROR_H
1818
#include <cstdint>
19-
#include <cstdint>
19+
#include <string>
2020
#include <LIEF/compiler_attributes.hpp>
2121
#include <LIEF/third-party/expected.hpp>
2222

@@ -126,5 +126,13 @@ inline bool is_err(const ok_error_t& val) {
126126

127127
}
128128

129+
extern template class tl::expected<LIEF::ok_t, lief_errors>;
130+
extern template class LIEF::result<LIEF::ok_t>;
131+
extern template class tl::expected<uint64_t, lief_errors>;
132+
extern template class LIEF::result<uint64_t>;
133+
extern template class tl::expected<uint32_t, lief_errors>;
134+
extern template class LIEF::result<uint32_t>;
135+
extern template class tl::expected<std::string, lief_errors>;
136+
extern template class LIEF::result<std::string>;
129137

130138
#endif

‎src/errors.cpp‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,18 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
#define LIEF_ERRORS_IMPL
1617
#include "LIEF/errors.hpp"
1718

19+
template class tl::expected<LIEF::ok_t, lief_errors>;
20+
template class LIEF::result<LIEF::ok_t>;
21+
template class tl::expected<uint64_t, lief_errors>;
22+
template class LIEF::result<uint64_t>;
23+
template class tl::expected<uint32_t, lief_errors>;
24+
template class LIEF::result<uint32_t>;
25+
template class tl::expected<std::string, lief_errors>;
26+
template class LIEF::result<std::string>;
27+
1828
const char* to_string(lief_errors err) {
1929
switch (err) {
2030
case lief_errors::read_error: return "read_error";

‎src/lief-pch.hpp‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,21 @@
33
#if defined __cplusplus
44
#include "spdlog/spdlog.h"
55
#include <spdlog/fmt/fmt.h>
6+
#include <spdlog/fmt/ranges.h>
7+
68
#include <string>
9+
#include <vector>
710
#include <set>
11+
#include <map>
12+
#include <unordered_map>
13+
#include <array>
814
#include <memory>
15+
#include <algorithm>
916
#include <cstdint>
1017
#include <cstddef>
18+
#include <ostream>
19+
#include <sstream>
20+
1121
#if LIEF_JSON_SUPPORT
1222
#ifndef LIEF_NLOHMANN_JSON_EXTERNAL
1323
#include "internal/nlohmann/json.hpp"

0 commit comments

Comments
 (0)