refactor: add constexpr to some methods.
This commit is contained in:
@@ -14,9 +14,7 @@ void BoundSymbolList::read(const fs::path& path) {
|
||||
|
||||
m_entities.clear();
|
||||
for (const auto& entity : data["data"]) {
|
||||
m_entities.emplace(
|
||||
BoundSymbol{entity["symbol"], entity["rva"], entity["is_function"]}
|
||||
);
|
||||
m_entities.emplace(entity);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ struct BoundSymbol {
|
||||
rva_t m_rva;
|
||||
bool m_is_function;
|
||||
|
||||
bool operator==(const BoundSymbol& other) const {
|
||||
constexpr bool operator==(const BoundSymbol& other) const {
|
||||
return m_symbol_name == other.m_symbol_name && m_rva == other.m_rva
|
||||
&& m_is_function == other.m_is_function;
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ struct HashValueImpl<Tuple, 0> {
|
||||
|
||||
template <typename... TT>
|
||||
struct hash<std::tuple<TT...>> {
|
||||
size_t operator()(std::tuple<TT...> const& tt) const {
|
||||
constexpr size_t operator()(std::tuple<TT...> const& tt) const {
|
||||
size_t seed = 0;
|
||||
HashValueImpl<std::tuple<TT...>>::apply(seed, tt);
|
||||
return seed;
|
||||
@@ -51,5 +51,3 @@ struct hash<std::tuple<TT...>> {
|
||||
};
|
||||
|
||||
} // namespace std
|
||||
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
@@ -11,9 +11,12 @@ using namespace llvm;
|
||||
#include <print>
|
||||
|
||||
#include <exception>
|
||||
#include <stacktrace>
|
||||
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
|
||||
@@ -28,3 +31,5 @@ using namespace llvm;
|
||||
|
||||
#include "nonstd.h"
|
||||
#include "typedef.h"
|
||||
|
||||
#include "error.h"
|
||||
|
||||
@@ -11,7 +11,7 @@ auto load_args(int argc, char* argv[]) {
|
||||
|
||||
struct {
|
||||
std::string m_magic_blob_path;
|
||||
std::string m_output_path;
|
||||
fs::path m_output_path;
|
||||
} args;
|
||||
|
||||
// clang-format off
|
||||
@@ -23,13 +23,14 @@ auto load_args(int argc, char* argv[]) {
|
||||
|
||||
program.add_argument("--output", "-o")
|
||||
.help("Path to output symlist.")
|
||||
.store_into(args.m_output_path)
|
||||
.required();
|
||||
|
||||
// clang-format on
|
||||
|
||||
program.parse_args(argc, argv);
|
||||
|
||||
args.m_output_path = program.get("--output");
|
||||
|
||||
return args;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,3 +8,5 @@ using addr_t = uint64_t;
|
||||
using hash_t = uint64_t;
|
||||
|
||||
} // namespace di
|
||||
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
Reference in New Issue
Block a user