Fix code generation for Endian template parameter values on LLVM 11

This commit is contained in:
Phillip Stephens 2020-12-11 19:49:16 -08:00
parent 4e29ba7d8f
commit f298113c4e
Signed by: Antidote
GPG Key ID: F8BEE4C83DACA60D
1 changed files with 5 additions and 3 deletions

View File

@ -419,7 +419,7 @@ class ATDNAEmitVisitor : public clang::RecursiveASTVisitor<ATDNAEmitVisitor> {
regType = regType->getUnqualifiedDesugaredType();
}
std::string fieldName = field->getName();
std::string fieldName = field->getName().str();
std::string propIdExpr = GetPropIdExpr(field, fieldName);
if (regType->getTypeClass() == clang::Type::TemplateSpecialization) {
@ -431,6 +431,8 @@ class ATDNAEmitVisitor : public clang::RecursiveASTVisitor<ATDNAEmitVisitor> {
llvm::APSInt endian(64, -1);
std::string endianExprStr;
bool defaultEndian = true;
/* FIXME: The is the following code required? */
#if 0
if (classParms->size() >= 2) {
const clang::NamedDecl* endianParm = classParms->getParam(1);
if (endianParm->getKind() == clang::Decl::NonTypeTemplateParm) {
@ -439,7 +441,7 @@ class ATDNAEmitVisitor : public clang::RecursiveASTVisitor<ATDNAEmitVisitor> {
nttParm->print(strStream, context.getPrintingPolicy());
}
}
#endif
for (const clang::TemplateArgument& arg : *tsType) {
if (arg.getKind() == clang::TemplateArgument::Expression) {
const clang::Expr* expr = arg.getAsExpr();
@ -818,7 +820,7 @@ class ATDNAEmitVisitor : public clang::RecursiveASTVisitor<ATDNAEmitVisitor> {
regType = regType->getUnqualifiedDesugaredType();
}
std::string fieldName = field->getName();
std::string fieldName = field->getName().str();
std::string propIdExpr = GetPropIdExpr(field, fieldName);
if (regType->getTypeClass() == clang::Type::TemplateSpecialization) {