bool isOwnershipRAIIType(Symbol *symbol, const LookupContext &context) { if (!symbol) return false; // This is not a "real" comparison of types. What we do is to resolve the symbol // in question and then try to match its name with already known ones. if (symbol->isDeclaration()) { Declaration *declaration = symbol->asDeclaration(); const NamedType *namedType = declaration->type()->asNamedType(); if (namedType) { LookupScope *clazz = context.lookupType(namedType->name(), declaration->enclosingScope()); if (clazz && !clazz->symbols().isEmpty()) { Overview overview; Symbol *symbol = clazz->symbols().at(0); return isOwnershipRAIIName(overview.prettyName(symbol->name())); } } } return false; }