Skip to content

Commit

Permalink
Remove double parsing of the template type
Browse files Browse the repository at this point in the history
  • Loading branch information
rmrf committed Dec 23, 2019
1 parent 7c96015 commit 589f136
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions src/FindTemplateTypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,18 +66,18 @@ FindTemplateTypes::type_vector_t FindTemplateTypes::Enumerate(
return template_types_;
}

//type->dump();
TraverseType(QualType(type, 0));
return template_types_;
}

bool FindTemplateTypes::VisitType(Type *type) {
QualType q{type->getCanonicalTypeInternal()};
// cout << "\n###### Type: " << q.getAsString() << " \n" ;
//cout << "\n###### Type: " << q.getAsString() << " \n";
if (type->isBuiltinType()) {
//cout << " ==> builtin type: " << q.getAsString() << "\n";
template_types_.push_back(TemplateType(q.getAsString(), type));
// template_types_.push_back( pair<string, const Type *>(q.getAsString(),
// type) );
return true;
return false;
}

// Template for sc_stream_in and sc_stream_out
Expand All @@ -88,15 +88,17 @@ bool FindTemplateTypes::VisitType(Type *type) {
auto tunder{tn.getUnderlying()};
auto name{tunder.getAsTemplateDecl()->getNameAsString()};
template_types_.push_back(TemplateType(name, type));
//cout << " ==> dependent type: " << name << "\n";
}
}

CXXRecordDecl *p_cxx_record{type->getAsCXXRecordDecl()};
if (p_cxx_record != nullptr) {
IdentifierInfo *info{p_cxx_record->getIdentifier()};
// cout << "##### info; " << info->getNameStart() << "\n";
if (info != nullptr) {
template_types_.push_back(TemplateType(info->getNameStart(), type));
} else {
CXXRecordDecl *p_cxx_record{type->getAsCXXRecordDecl()};
if (p_cxx_record != nullptr) {
IdentifierInfo *info{p_cxx_record->getIdentifier()};
// cout << "##### info; " << info->getNameStart() << "\n";
if (info != nullptr) {
template_types_.push_back(TemplateType(info->getNameStart(), type));
//cout << " ==> CXXRecord type: " << info->getNameStart() << "\n";
}
}
}
return true;
Expand Down

0 comments on commit 589f136

Please sign in to comment.