/// \brief The set of cached code-completion results.
std::vector<CachedCodeCompletionResult> CachedCompletionResults;
- /// \brief Cache any "global" code-completion results, so that we
+ /// \brief Cache any "global" code-completion results, so that we can avoid
+ /// recomputing them with each completion.
void CacheCodeCompletionResults();
/// \brief Clear out and deallocate
Ctx->getLangOptions());
CachedResult.Priority = Results[I].Priority;
CachedResult.Kind = Results[I].CursorKind;
- CachedResult.TypeClass
- = getSimplifiedTypeClass(
- Ctx->getCanonicalType(getDeclUsageType(*Ctx,
- Results[I].Declaration)));
+
+ QualType UsageType = getDeclUsageType(*Ctx, Results[I].Declaration);
+ if (UsageType.isNull())
+ CachedResult.TypeClass = STC_Void;
+ else {
+ CachedResult.TypeClass
+ = getSimplifiedTypeClass(Ctx->getCanonicalType(UsageType));
+ }
CachedCompletionResults.push_back(CachedResult);
break;
}