diff options
-rw-r--r-- | include/clang/Frontend/ASTUnit.h | 3 | ||||
-rw-r--r-- | lib/Frontend/ASTUnit.cpp | 12 |
2 files changed, 10 insertions, 5 deletions
diff --git a/include/clang/Frontend/ASTUnit.h b/include/clang/Frontend/ASTUnit.h index f18e70e750..f8859425ff 100644 --- a/include/clang/Frontend/ASTUnit.h +++ b/include/clang/Frontend/ASTUnit.h @@ -241,7 +241,8 @@ private: /// \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 diff --git a/lib/Frontend/ASTUnit.cpp b/lib/Frontend/ASTUnit.cpp index a573fb41ab..b54162f8d7 100644 --- a/lib/Frontend/ASTUnit.cpp +++ b/lib/Frontend/ASTUnit.cpp @@ -191,10 +191,14 @@ void ASTUnit::CacheCodeCompletionResults() { 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; } |