summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2011-01-23 00:34:52 +0000
committerGreg Clayton <gclayton@apple.com>2011-01-23 00:34:52 +0000
commit1b03cb5d1b18b1843dcfe010cbf38a1d643dc34b (patch)
tree2a22d07043261b2dd2fda3341981a506473f1786
parent61c2e57b09ea4a19ac387cb2c1c16392eace6dbd (diff)
downloadbcm5719-llvm-1b03cb5d1b18b1843dcfe010cbf38a1d643dc34b.tar.gz
bcm5719-llvm-1b03cb5d1b18b1843dcfe010cbf38a1d643dc34b.zip
Watch out for NULL types in NameSearchContext::AddTypeDecl or we crash.
llvm-svn: 124051
-rw-r--r--lldb/source/Expression/ClangASTSource.cpp40
1 files changed, 20 insertions, 20 deletions
diff --git a/lldb/source/Expression/ClangASTSource.cpp b/lldb/source/Expression/ClangASTSource.cpp
index b18536b5f9e..a23547d83dd 100644
--- a/lldb/source/Expression/ClangASTSource.cpp
+++ b/lldb/source/Expression/ClangASTSource.cpp
@@ -240,26 +240,26 @@ NameSearchContext::AddGenericFunDecl()
clang::NamedDecl *
NameSearchContext::AddTypeDecl(void *type)
{
- QualType qual_type = QualType::getFromOpaquePtr(type);
-
- if (TagType *tag_type = dyn_cast<clang::TagType>(qual_type))
- {
- TagDecl *tag_decl = tag_type->getDecl();
-
- m_decls.push_back(tag_decl);
-
- return tag_decl;
- }
- else if (ObjCObjectType *objc_object_type = dyn_cast<clang::ObjCObjectType>(qual_type))
- {
- ObjCInterfaceDecl *interface_decl = objc_object_type->getInterface();
-
- m_decls.push_back((NamedDecl*)interface_decl);
-
- return (NamedDecl*)interface_decl;
- }
- else
+ if (type)
{
- return NULL;
+ QualType qual_type = QualType::getFromOpaquePtr(type);
+
+ if (TagType *tag_type = dyn_cast<clang::TagType>(qual_type))
+ {
+ TagDecl *tag_decl = tag_type->getDecl();
+
+ m_decls.push_back(tag_decl);
+
+ return tag_decl;
+ }
+ else if (ObjCObjectType *objc_object_type = dyn_cast<clang::ObjCObjectType>(qual_type))
+ {
+ ObjCInterfaceDecl *interface_decl = objc_object_type->getInterface();
+
+ m_decls.push_back((NamedDecl*)interface_decl);
+
+ return (NamedDecl*)interface_decl;
+ }
}
+ return NULL;
}
OpenPOWER on IntegriCloud