mirror of https://github.com/libAthena/athena.git
Allow Value<> specialization with DNA type as template parameter
This commit is contained in:
parent
c043178254
commit
6a76fa90dc
|
@ -102,6 +102,7 @@ class ATDNAEmitVisitor : public clang::RecursiveASTVisitor<ATDNAEmitVisitor>
|
||||||
std::string m_fieldName;
|
std::string m_fieldName;
|
||||||
std::string m_sizeExpr;
|
std::string m_sizeExpr;
|
||||||
std::string m_ioOp;
|
std::string m_ioOp;
|
||||||
|
bool m_isDNAType;
|
||||||
bool m_output = true;
|
bool m_output = true;
|
||||||
|
|
||||||
YAMLFieldNode(Type tp) : m_type(tp) {}
|
YAMLFieldNode(Type tp) : m_type(tp) {}
|
||||||
|
@ -124,10 +125,17 @@ class ATDNAEmitVisitor : public clang::RecursiveASTVisitor<ATDNAEmitVisitor>
|
||||||
out << " }\n";
|
out << " }\n";
|
||||||
break;
|
break;
|
||||||
case Type::Value:
|
case Type::Value:
|
||||||
|
if (m_isDNAType)
|
||||||
|
{
|
||||||
|
out << " " << m_fieldName << "." << m_ioOp << ";\n";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
if (!p)
|
if (!p)
|
||||||
out << " " << m_fieldName << " = " << m_ioOp << ";\n";
|
out << " " << m_fieldName << " = " << m_ioOp << ";\n";
|
||||||
else
|
else
|
||||||
out << " " << m_ioOp << "\n";
|
out << " " << m_ioOp << "\n";
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case Type::VectorRefSize:
|
case Type::VectorRefSize:
|
||||||
if (!p)
|
if (!p)
|
||||||
|
@ -1300,11 +1308,18 @@ class ATDNAEmitVisitor : public clang::RecursiveASTVisitor<ATDNAEmitVisitor>
|
||||||
}
|
}
|
||||||
|
|
||||||
fileOut << " /* " << fieldName << " */\n";
|
fileOut << " /* " << fieldName << " */\n";
|
||||||
|
if (isDNAType)
|
||||||
|
{
|
||||||
|
fileOut << " " << fieldName << "." << ioOp << ";\n";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
if (!p)
|
if (!p)
|
||||||
fileOut << " " << fieldName << " = " << ioOp << ";\n";
|
fileOut << " " << fieldName << " = " << ioOp << ";\n";
|
||||||
else
|
else
|
||||||
fileOut << " " << ioOp << "\n";
|
fileOut << " " << ioOp << "\n";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (!tsDecl->getName().compare("Vector"))
|
else if (!tsDecl->getName().compare("Vector"))
|
||||||
{
|
{
|
||||||
llvm::APSInt endian(64, -1);
|
llvm::APSInt endian(64, -1);
|
||||||
|
@ -2029,6 +2044,7 @@ class ATDNAEmitVisitor : public clang::RecursiveASTVisitor<ATDNAEmitVisitor>
|
||||||
outputNodes.emplace_back(YAMLFieldNode::Type::Value);
|
outputNodes.emplace_back(YAMLFieldNode::Type::Value);
|
||||||
YAMLFieldNode& outNode = outputNodes.back();
|
YAMLFieldNode& outNode = outputNodes.back();
|
||||||
outNode.m_fieldName = fieldName;
|
outNode.m_fieldName = fieldName;
|
||||||
|
outNode.m_isDNAType = isDNAType;
|
||||||
outNode.m_ioOp = ioOp;
|
outNode.m_ioOp = ioOp;
|
||||||
}
|
}
|
||||||
else if (!tsDecl->getName().compare("Vector"))
|
else if (!tsDecl->getName().compare("Vector"))
|
||||||
|
|
Loading…
Reference in New Issue