[Lldb-commits] [lldb] r153128 - /lldb/trunk/source/Expression/ClangASTSource.cpp

Sean Callanan scallanan at apple.com
Tue Mar 20 14:11:13 PDT 2012


Author: spyffe
Date: Tue Mar 20 16:11:12 2012
New Revision: 153128

URL: http://llvm.org/viewvc/llvm-project?rev=153128&view=rev
Log:
Fixed some potential null-pointer bugs in the
expression parser code.

Modified:
    lldb/trunk/source/Expression/ClangASTSource.cpp

Modified: lldb/trunk/source/Expression/ClangASTSource.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangASTSource.cpp?rev=153128&r1=153127&r2=153128&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangASTSource.cpp (original)
+++ lldb/trunk/source/Expression/ClangASTSource.cpp Tue Mar 20 16:11:12 2012
@@ -387,6 +387,9 @@
             
             Decl *copied_decl = m_ast_importer->CopyDecl(m_ast_context, original_ctx, decl);
             
+            if (!copied_decl)
+                continue;
+            
             if (FieldDecl *copied_field = dyn_cast<FieldDecl>(copied_decl))
             {
                 QualType copied_field_type = copied_field->getType();
@@ -1291,6 +1294,9 @@
     
     Decl *copied_decl = m_ast_importer->CopyDecl(m_ast_context, namespace_decl.GetASTContext(), namespace_decl.GetNamespaceDecl());
     
+    if (!copied_decl)
+        return NULL;
+    
     NamespaceDecl *copied_namespace_decl = dyn_cast<NamespaceDecl>(copied_decl);
     
     m_ast_importer->RegisterNamespaceMap(copied_namespace_decl, namespace_decls);
@@ -1311,7 +1317,7 @@
     
     SetImportInProgress(false);
     
-    if (ret_qual_type->getCanonicalTypeInternal().isNull()) 
+    if (ret && ret_qual_type->getCanonicalTypeInternal().isNull())
         // this shouldn't happen, but we're hardening because the AST importer seems to be generating bad types
         // on occasion.
         return NULL;





More information about the lldb-commits mailing list