Add dynamic allocation alignment to be able to load T6 MemoryBlock asset which isnt used at all so why am i doing this again

This commit is contained in:
Jan
2021-03-05 09:23:37 +01:00
parent 286eaadd1c
commit 88c48e8107
12 changed files with 91 additions and 11 deletions

View File

@ -1,6 +1,7 @@
#include "CommandsParser.h"
#include "Parsing/Commands/Sequence/SequenceAction.h"
#include "Parsing/Commands/Sequence/SequenceAllocAlign.h"
#include "Parsing/Commands/Sequence/SequenceArchitecture.h"
#include "Parsing/Commands/Sequence/SequenceArrayCount.h"
#include "Parsing/Commands/Sequence/SequenceArraySize.h"
@ -27,6 +28,7 @@ const std::vector<CommandsParser::sequence_t*>& CommandsParser::GetTestsForState
{
static std::vector<sequence_t*> tests({
new SequenceAction(),
new SequenceAllocAlign(),
new SequenceArchitecture(),
new SequenceArrayCount(),
new SequenceArraySize(),

View File

@ -0,0 +1,34 @@
#include "SequenceAllocAlign.h"
#include "Parsing/Commands/Matcher/CommandsMatcherFactory.h"
#include "Parsing/Commands/Matcher/CommandsCommonMatchers.h"
SequenceAllocAlign::SequenceAllocAlign()
{
const CommandsMatcherFactory create(this);
AddLabeledMatchers(CommandsCommonMatchers::Typename(this), CommandsCommonMatchers::LABEL_TYPENAME);
AddLabeledMatchers(CommandsCommonMatchers::Evaluation(this), CommandsCommonMatchers::LABEL_EVALUATION);
AddMatchers({
create.Keyword("set"),
create.Keyword("allocalign"),
create.Label(CommandsCommonMatchers::LABEL_TYPENAME).Capture(CAPTURE_TYPE),
create.Label(CommandsCommonMatchers::LABEL_EVALUATION),
create.Char(';')
});
}
void SequenceAllocAlign::ProcessMatch(CommandsParserState* state, SequenceResult<CommandsParserValue>& result) const
{
const auto& typeNameToken = result.NextCapture(CAPTURE_TYPE);
StructureInformation* type;
std::vector<MemberInformation*> memberChain;
if (!state->GetTypenameAndMembersFromTypename(typeNameToken.TypeNameValue(), type, memberChain))
throw ParsingException(typeNameToken.GetPos(), "Unknown type");
if(memberChain.empty())
throw ParsingException(typeNameToken.GetPos(), "Need to specify a member");
auto allocAlignEvaluation = CommandsCommonMatchers::ProcessEvaluation(state, result, type);
memberChain.back()->m_alloc_alignment = std::move(allocAlignEvaluation);
}

View File

@ -0,0 +1,14 @@
#pragma once
#include "Parsing/Commands/Impl/CommandsParser.h"
class SequenceAllocAlign final : public CommandsParser::sequence_t
{
static constexpr auto CAPTURE_TYPE = 1;
protected:
void ProcessMatch(CommandsParserState* state, SequenceResult<CommandsParserValue>& result) const override;
public:
SequenceAllocAlign();
};