diff options
author | Greg Clayton <gclayton@apple.com> | 2015-09-08 18:15:05 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2015-09-08 18:15:05 +0000 |
commit | f73034f99a634ba9fa67960633753f729802b6c3 (patch) | |
tree | d2dd3872f57f667f3dfbfad09ff24e944627b386 /lldb/source/Expression/ClangExpressionDeclMap.cpp | |
parent | 21a145c341e0b2825fa7b58685bc27cac1a8cbcc (diff) | |
download | bcm5719-llvm-f73034f99a634ba9fa67960633753f729802b6c3.tar.gz bcm5719-llvm-f73034f99a634ba9fa67960633753f729802b6c3.zip |
Use LLVM casting for TypeSystem so you can cast it to subclasses.
This will keep our code cleaner and it removes the need for intrusive additions to TypeSystem like:
class TypeSystem
{
virtual ClangASTContext *
AsClangASTContext() = 0;
}
As you can now just use the llvm::dyn_cast and other casts.
llvm-svn: 247041
Diffstat (limited to 'lldb/source/Expression/ClangExpressionDeclMap.cpp')
-rw-r--r-- | lldb/source/Expression/ClangExpressionDeclMap.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lldb/source/Expression/ClangExpressionDeclMap.cpp b/lldb/source/Expression/ClangExpressionDeclMap.cpp index cba1122038a..42696a04fda 100644 --- a/lldb/source/Expression/ClangExpressionDeclMap.cpp +++ b/lldb/source/Expression/ClangExpressionDeclMap.cpp @@ -194,19 +194,23 @@ ClangExpressionDeclMap::AddPersistentVariable { assert (m_parser_vars.get()); + ClangASTContext *ast = llvm::dyn_cast_or_null<ClangASTContext>(parser_type.GetTypeSystem()); + if (ast == nullptr) + return false; + if (m_parser_vars->m_materializer && is_result) { Error err; ExecutionContext &exe_ctx = m_parser_vars->m_exe_ctx; Target *target = exe_ctx.GetTargetPtr(); - if (target == NULL) + if (target == nullptr) return false; ClangASTContext *context(target->GetScratchClangASTContext()); TypeFromUser user_type(m_ast_importer->DeportType(context->getASTContext(), - parser_type.GetTypeSystem()->AsClangASTContext()->getASTContext(), + ast->getASTContext(), parser_type.GetOpaqueQualType()), context); @@ -247,7 +251,7 @@ ClangExpressionDeclMap::AddPersistentVariable ClangASTContext *context(target->GetScratchClangASTContext()); TypeFromUser user_type(m_ast_importer->DeportType(context->getASTContext(), - parser_type.GetTypeSystem()->AsClangASTContext()->getASTContext(), + ast->getASTContext(), parser_type.GetOpaqueQualType()), context); |