From c4421e966d77a18f815284175b3fcbb46f36fa39 Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Mon, 16 Aug 2010 16:46:30 +0000 Subject: Dereferencing NULL pointers is such poor form. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111150 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Frontend/ASTUnit.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'lib/Frontend/ASTUnit.cpp') 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; } -- cgit v1.2.3-18-g5258