Ignore unqualified template types in atdna

This commit is contained in:
Jack Andersen 2016-02-01 18:28:52 -10:00
parent a87832e357
commit 80e03dbe12
2 changed files with 17 additions and 9 deletions

View File

@ -710,8 +710,10 @@ class ATDNAEmitVisitor : public clang::RecursiveASTVisitor<ATDNAEmitVisitor>
for (const clang::FieldDecl* field : decl->fields())
{
clang::QualType qualType = field->getType();
clang::TypeInfo regTypeInfo = context.getTypeInfo(qualType);
const clang::Type* regType = qualType.getTypePtrOrNull();
if (!regType || regType->getTypeClass() == clang::Type::TemplateTypeParm)
continue;
clang::TypeInfo regTypeInfo = context.getTypeInfo(qualType);
while (regType->getTypeClass() == clang::Type::Elaborated ||
regType->getTypeClass() == clang::Type::Typedef)
regType = regType->getUnqualifiedDesugaredType();
@ -1068,8 +1070,10 @@ class ATDNAEmitVisitor : public clang::RecursiveASTVisitor<ATDNAEmitVisitor>
for (const clang::FieldDecl* field : decl->fields())
{
clang::QualType qualType = field->getType();
clang::TypeInfo regTypeInfo = context.getTypeInfo(qualType);
const clang::Type* regType = qualType.getTypePtrOrNull();
if (!regType || regType->getTypeClass() == clang::Type::TemplateTypeParm)
continue;
clang::TypeInfo regTypeInfo = context.getTypeInfo(qualType);
while (regType->getTypeClass() == clang::Type::Elaborated ||
regType->getTypeClass() == clang::Type::Typedef)
regType = regType->getUnqualifiedDesugaredType();
@ -1842,8 +1846,10 @@ class ATDNAEmitVisitor : public clang::RecursiveASTVisitor<ATDNAEmitVisitor>
for (const clang::FieldDecl* field : decl->fields())
{
clang::QualType qualType = field->getType();
clang::TypeInfo regTypeInfo = context.getTypeInfo(qualType);
const clang::Type* regType = qualType.getTypePtrOrNull();
if (!regType || regType->getTypeClass() == clang::Type::TemplateTypeParm)
continue;
clang::TypeInfo regTypeInfo = context.getTypeInfo(qualType);
while (regType->getTypeClass() == clang::Type::Elaborated ||
regType->getTypeClass() == clang::Type::Typedef)
regType = regType->getUnqualifiedDesugaredType();
@ -2272,7 +2278,7 @@ int main(int argc, const char** argv)
clang::tooling::ToolInvocation TI(args, new ATDNAAction, fman.get());
if (!TI.run())
return 1;
return 0;
}

View File

@ -539,23 +539,24 @@ public:
inline const YAMLNode* getRootNode() const {return m_rootNode.get();}
std::unique_ptr<YAMLNode> releaseRootNode() {return std::move(m_rootNode);}
void enterSubRecord(const char* name)
bool enterSubRecord(const char* name)
{
YAMLNode* curSub = m_subStack.back();
if (curSub->m_type == YAML_SEQUENCE_NODE)
{
int& seqIdx = m_seqTrackerStack.back();
m_subStack.push_back(curSub->m_seqChildren[seqIdx++].get());
return;
return true;
}
for (const auto& item : curSub->m_mapChildren)
{
if (!item.first.compare(name))
{
m_subStack.push_back(item.second.get());
return;
return true;
}
}
return false;
}
void leaveSubRecord()
@ -572,7 +573,7 @@ public:
leaveSubRecord();
}
void enterSubVector(const char* name)
bool enterSubVector(const char* name)
{
YAMLNode* curSub = m_subStack.back();
for (const auto& item : curSub->m_mapChildren)
@ -582,9 +583,10 @@ public:
YAMLNode* nextSub = item.second.get();
m_subStack.push_back(nextSub);
m_seqTrackerStack.push_back(0);
break;
return true;
}
}
return false;
}
void leaveSubVector()