[Lldb-commits] [lldb] r265443 - Fix a crasher that could happen if ClangASTSource::CompleteType() found a type whose name matched, but came from a different language. We need to verify that any types we find are clang types before trying to extra a clang::QualType and then use it.

Greg Clayton via lldb-commits lldb-commits at lists.llvm.org
Tue Apr 5 12:29:05 PDT 2016


Author: gclayton
Date: Tue Apr  5 14:29:05 2016
New Revision: 265443

URL: http://llvm.org/viewvc/llvm-project?rev=265443&view=rev
Log:
Fix a crasher that could happen if ClangASTSource::CompleteType() found a type whose name matched, but came from a different language. We need to verify that any types we find are clang types before trying to extra a clang::QualType and then use it.

<rdar://problem/24138711>


Modified:
    lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp

Modified: lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp?rev=265443&r1=265442&r2=265443&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp (original)
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp Tue Apr  5 14:29:05 2016
@@ -275,7 +275,7 @@ ClangASTSource::CompleteType (TagDecl *t
 
                     CompilerType clang_type (type->GetFullCompilerType ());
 
-                    if (!clang_type)
+                    if (!ClangUtil::IsClangType(clang_type))
                         continue;
 
                     const TagType *tag_type = ClangUtil::GetQualType(clang_type)->getAs<TagType>();
@@ -315,7 +315,7 @@ ClangASTSource::CompleteType (TagDecl *t
 
                 CompilerType clang_type (type->GetFullCompilerType ());
 
-                if (!clang_type)
+                if (!ClangUtil::IsClangType(clang_type))
                     continue;
 
                 const TagType *tag_type = ClangUtil::GetQualType(clang_type)->getAs<TagType>();
@@ -2053,7 +2053,7 @@ NameSearchContext::AddGenericFunDecl()
 clang::NamedDecl *
 NameSearchContext::AddTypeDecl(const CompilerType &clang_type)
 {
-    if (clang_type)
+    if (ClangUtil::IsClangType(clang_type))
     {
         QualType qual_type = ClangUtil::GetQualType(clang_type);
 




More information about the lldb-commits mailing list