Update atdna to emit new code style

This commit is contained in:
Jack Andersen 2018-12-12 21:38:14 -10:00
parent 0447e5be00
commit c5a4416463
1 changed files with 33 additions and 34 deletions

View File

@ -322,7 +322,7 @@ class ATDNAEmitVisitor : public clang::RecursiveASTVisitor<ATDNAEmitVisitor> {
GetNestedTypeName(decl, templateStmt, qualTypeStr);
fileOut << templateStmt;
fileOut << "template <class Op>\nvoid " << qualTypeStr << "::Enumerate(typename Op::StreamT& s)\n{\n";
fileOut << "template <class Op>\nvoid " << qualTypeStr << "::Enumerate(typename Op::StreamT& s) {\n";
if (baseDNA.size())
fileOut << " " << baseDNA << "::Enumerate<Op>(s);\n";
@ -723,14 +723,13 @@ class ATDNAEmitVisitor : public clang::RecursiveASTVisitor<ATDNAEmitVisitor> {
GetNestedTypeName(decl, templateStmt, qualTypeStr);
fileOut << templateStmt;
fileOut << "template <class Op>\nbool " << qualTypeStr << "::Lookup(uint64_t hash, typename Op::StreamT& s)\n{\n";
fileOut << "template <class Op>\nbool " << qualTypeStr << "::Lookup(uint64_t hash, typename Op::StreamT& s) {\n";
if (baseDNA.size())
fileOut << " if (" << baseDNA << "::Lookup<Op>(hash, s))\n"
<< " return true;\n";
fileOut << " switch (hash)\n"
<< " {\n";
fileOut << " switch (hash) {\n";
for (const clang::FieldDecl* field : decl->fields()) {
clang::QualType qualType = field->getType();
@ -1093,7 +1092,7 @@ public:
for (const auto& specialization : specializations) {
for (int i = 0; i < specialization.second; ++i)
fileOut << "template <>\n";
fileOut << "const char* " << specialization.first << "::DNAType()\n{\n return \"" << specialization.first
fileOut << "const char* " << specialization.first << "::DNAType() {\n return \"" << specialization.first
<< "\";\n}\n";
}
fileOut << "\n\n";