summaryrefslogtreecommitdiffstats
path: root/lldb/source/Symbol/Function.cpp
diff options
context:
space:
mode:
authorJim Ingham <jingham@apple.com>2012-10-12 17:34:26 +0000
committerJim Ingham <jingham@apple.com>2012-10-12 17:34:26 +0000
commit28eb57114d05dd100d9b4a56e0a00be85cd09e3b (patch)
tree61467023c9112981c8ff375d429b244c7b95c475 /lldb/source/Symbol/Function.cpp
parente87f41f43e5d5dafa5794a1f78c849a774ea989a (diff)
downloadbcm5719-llvm-28eb57114d05dd100d9b4a56e0a00be85cd09e3b.tar.gz
bcm5719-llvm-28eb57114d05dd100d9b4a56e0a00be85cd09e3b.zip
Bunch of cleanups for warnings found by the llvm static analyzer.
llvm-svn: 165808
Diffstat (limited to 'lldb/source/Symbol/Function.cpp')
-rw-r--r--lldb/source/Symbol/Function.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/lldb/source/Symbol/Function.cpp b/lldb/source/Symbol/Function.cpp
index 9ee35e3737e..0f060ddda9f 100644
--- a/lldb/source/Symbol/Function.cpp
+++ b/lldb/source/Symbol/Function.cpp
@@ -343,7 +343,9 @@ void
Function::GetDescription(Stream *s, lldb::DescriptionLevel level, Target *target)
{
Type* func_type = GetType();
- *s << "id = " << (const UserID&)*this << ", name = \"" << func_type->GetName() << "\", range = ";
+ const char *name = func_type ? func_type->GetName().AsCString() : "<unknown>";
+
+ *s << "id = " << (const UserID&)*this << ", name = \"" << name << "\", range = ";
Address::DumpStyle fallback_style;
if (level == eDescriptionLevelVerbose)
@@ -493,10 +495,14 @@ Function::GetType() const
clang_type_t
Function::GetReturnClangType ()
{
- clang::QualType clang_type (clang::QualType::getFromOpaquePtr(GetType()->GetClangFullType()));
- const clang::FunctionType *function_type = llvm::dyn_cast<clang::FunctionType> (clang_type);
- if (function_type)
- return function_type->getResultType().getAsOpaquePtr();
+ Type *type = GetType();
+ if (type)
+ {
+ clang::QualType clang_type (clang::QualType::getFromOpaquePtr(type->GetClangFullType()));
+ const clang::FunctionType *function_type = llvm::dyn_cast<clang::FunctionType> (clang_type);
+ if (function_type)
+ return function_type->getResultType().getAsOpaquePtr();
+ }
return NULL;
}
OpenPOWER on IntegriCloud