Made GetVariableValue() more robust in the face
of failures in the AST importer. Also ensured
that a variable will not be blindly added if
GetVariableValue() returns an error.
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@119889 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Expression/ClangExpressionDeclMap.cpp b/source/Expression/ClangExpressionDeclMap.cpp
index f2d2bc9..b6427cc 100644
--- a/source/Expression/ClangExpressionDeclMap.cpp
+++ b/source/Expression/ClangExpressionDeclMap.cpp
@@ -1220,6 +1220,14 @@
{
type_to_use = GuardedCopyType(parser_ast_context, var_ast_context, var_opaque_type);
+ if (!type_to_use)
+ {
+ if (log)
+ log->Printf("Couldn't copy a variable's type into the parser's AST context");
+
+ return NULL;
+ }
+
if (parser_type)
*parser_type = TypeFromParser(type_to_use, parser_ast_context);
}
@@ -1271,6 +1279,9 @@
&ut,
&pt);
+ if (!var_location)
+ return;
+
NamedDecl *var_decl = context.AddVarDecl(pt.GetOpaqueQualType());
ClangExpressionVariable &entity(m_found_entities.VariableAtIndex(m_found_entities.CreateVariable()));