[Lldb-commits] [lldb] r220024 - Add null-checks around getter/setter before using them.

Jason Molenda jmolenda at apple.com
Thu Oct 16 18:55:08 PDT 2014


Author: jmolenda
Date: Thu Oct 16 20:55:08 2014
New Revision: 220024

URL: http://llvm.org/viewvc/llvm-project?rev=220024&view=rev
Log:
Add null-checks around getter/setter before using them.
clang static analyzer fixit.

Modified:
    lldb/trunk/source/Symbol/ClangASTType.cpp

Modified: lldb/trunk/source/Symbol/ClangASTType.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTType.cpp?rev=220024&r1=220023&r2=220024&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/ClangASTType.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTType.cpp Thu Oct 16 20:55:08 2014
@@ -5370,9 +5370,12 @@ ClangASTType::AddObjCClassProperty (cons
                     if (getter && metadata)
                         ClangASTContext::SetMetadata(m_ast, getter, *metadata);
                     
-                    getter->setMethodParams(*m_ast, llvm::ArrayRef<clang::ParmVarDecl*>(), llvm::ArrayRef<clang::SourceLocation>());
+                    if (getter)
+                    {
+                        getter->setMethodParams(*m_ast, llvm::ArrayRef<clang::ParmVarDecl*>(), llvm::ArrayRef<clang::SourceLocation>());
                     
-                    class_interface_decl->addDecl(getter);
+                        class_interface_decl->addDecl(getter);
+                    }
                 }
                 
                 if (!setter_sel.isNull() && !class_interface_decl->lookupInstanceMethod(setter_sel))
@@ -5417,9 +5420,12 @@ ClangASTType::AddObjCClassProperty (cons
                                                                   clang::SC_Auto,
                                                                   nullptr));
                     
-                    setter->setMethodParams(*m_ast, llvm::ArrayRef<clang::ParmVarDecl*>(params), llvm::ArrayRef<clang::SourceLocation>());
+                    if (setter)
+                    {
+                        setter->setMethodParams(*m_ast, llvm::ArrayRef<clang::ParmVarDecl*>(params), llvm::ArrayRef<clang::SourceLocation>());
                     
-                    class_interface_decl->addDecl(setter);
+                        class_interface_decl->addDecl(setter);
+                    }
                 }
                 
                 return true;





More information about the lldb-commits mailing list