Use quickFindDecl in findType (need more adaptations)

This commit is contained in:
Philippe Canal 2015-09-27 08:58:15 -05:00 committed by sftnight
parent 2f40299656
commit 795b215716

View File

@ -204,6 +204,7 @@ namespace cling {
if (declName[c] == '<' || declName[c] == '>') {
// For now we do not know how to deal with
// template instances.
// TODO: Should we quit on more cases (&,*,[]) in case we are called by findType.
return false;
}
if (declName[c] == ':') {
@ -214,6 +215,7 @@ namespace cling {
next = utils::Lookup::Named(&S, declName.substr(last, c - last), sofar);
if (next && next != (void *) -1) {
// Need to handle typedef here too.
// TODO: Should we keep the typedef in case we are called by findType.
const TypedefNameDecl *typedefDecl = dyn_cast<TypedefNameDecl>(next);
if (typedefDecl) {
// We are stripping the typedef, this is technically incorrect,
@ -297,6 +299,20 @@ namespace cling {
if (typeName.empty()) return TheQT;
if (1) {
const Decl *quickResult = nullptr;
if (quickFindDecl(typeName, quickResult, *m_Parser, diagOnOff)) {
// The result of quickFindDecl was definitive, we don't need
// to check any further.
Parser &P = *m_Parser;
Sema &S = P.getActions();
const TypeDecl *typedecl = dyn_cast<TypeDecl>(quickResult);
if (typedecl) return S.getASTContext().getTypeDeclType(typedecl);
return QualType();
}
}
// Could trigger deserialization of decls.
Interpreter::PushTransactionRAII RAII(m_Interpreter);