aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-dataloader/AbstractSyntaxTree.hpp
diff options
context:
space:
mode:
author Spartan322 <Megacake1234@gmail.com>2024-08-03 23:29:33 +0200
committer Spartan322 <Megacake1234@gmail.com>2024-08-03 23:29:33 +0200
commit2addc7763556ff76809f14e2063d1452aa9d6275 (patch)
tree996cac9cfa3c18798b5e509f51935a2538baac3f /src/openvic-dataloader/AbstractSyntaxTree.hpp
parent2f6f6bdbb191aca01a1c4a9587e314442d219fb4 (diff)
Fix crash for empty/invalid/not-found filepaths
Add tests to validate empty string path Add tests to validate non-existent string path Add tests to validate nullptr buffer parser
Diffstat (limited to 'src/openvic-dataloader/AbstractSyntaxTree.hpp')
-rw-r--r--src/openvic-dataloader/AbstractSyntaxTree.hpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/openvic-dataloader/AbstractSyntaxTree.hpp b/src/openvic-dataloader/AbstractSyntaxTree.hpp
index f9f5796..f2d941b 100644
--- a/src/openvic-dataloader/AbstractSyntaxTree.hpp
+++ b/src/openvic-dataloader/AbstractSyntaxTree.hpp
@@ -23,6 +23,7 @@
namespace ovdl {
struct AbstractSyntaxTree : SymbolIntern {
+ AbstractSyntaxTree() = default;
explicit AbstractSyntaxTree(std::size_t max_elements) : _symbol_interner(max_elements) {}
symbol_type intern(const char* str, std::size_t length);
@@ -51,6 +52,8 @@ namespace ovdl {
using root_node_type = RootNodeT;
using node_type = typename file_type::node_type;
+ BasicAbstractSyntaxTree() = default;
+
explicit BasicAbstractSyntaxTree(file_type&& file)
: AbstractSyntaxTree(file.size() * file.visit_buffer([](auto&& buffer) -> size_t { return sizeof(typename std::decay_t<decltype(buffer)>::char_type); })),
_file { std::move(file) } {}