summaryrefslogtreecommitdiffstats
path: root/lldb/source
diff options
context:
space:
mode:
authorSean Callanan <scallanan@apple.com>2016-04-29 18:09:03 +0000
committerSean Callanan <scallanan@apple.com>2016-04-29 18:09:03 +0000
commit7736a208b8958a7e708c0756bdce40437f8f48f6 (patch)
tree47114371e62e174ee586383cdc704cdf0cc1a9d4 /lldb/source
parent327b06400fc208fbd2da720383733d09568ae5f3 (diff)
downloadbcm5719-llvm-7736a208b8958a7e708c0756bdce40437f8f48f6.tar.gz
bcm5719-llvm-7736a208b8958a7e708c0756bdce40437f8f48f6.zip
[fix] Fixed a bug where const this would cause parser errors about $__lldb_expr.
In templated const functions, trying to run an expression would produce the error error: out-of-line definition of '$__lldb_expr' does not match any declaration in 'foo' member declaration does not match because it is const qualified error: 1 error parsing expression which is no good. It turned out we don't actually need to worry about "const," we just need to be consistent about the declaration of the expression and the FunctionDecl we inject into the class for "this." Also added a test case. <rdar://problem/24985958> llvm-svn: 268083
Diffstat (limited to 'lldb/source')
-rw-r--r--lldb/source/Expression/ExpressionSourceCode.cpp5
-rw-r--r--lldb/source/Expression/LLVMUserExpression.cpp1
-rw-r--r--lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp18
-rw-r--r--lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp2
4 files changed, 17 insertions, 9 deletions
diff --git a/lldb/source/Expression/ExpressionSourceCode.cpp b/lldb/source/Expression/ExpressionSourceCode.cpp
index 14e98105b8a..d82ed608407 100644
--- a/lldb/source/Expression/ExpressionSourceCode.cpp
+++ b/lldb/source/Expression/ExpressionSourceCode.cpp
@@ -195,7 +195,7 @@ AddLocalVariableDecls(const lldb::VariableListSP &var_list_sp, StreamString &str
}
}
-bool ExpressionSourceCode::GetText (std::string &text, lldb::LanguageType wrapping_language, bool const_object, bool static_method, ExecutionContext &exe_ctx) const
+bool ExpressionSourceCode::GetText (std::string &text, lldb::LanguageType wrapping_language, bool static_method, ExecutionContext &exe_ctx) const
{
const char *target_specific_defines = "typedef signed char BOOL;\n";
std::string module_macros;
@@ -337,13 +337,12 @@ bool ExpressionSourceCode::GetText (std::string &text, lldb::LanguageType wrappi
break;
case lldb::eLanguageTypeC_plus_plus:
wrap_stream.Printf("void \n"
- "$__lldb_class::%s(void *$__lldb_arg) %s\n"
+ "$__lldb_class::%s(void *$__lldb_arg) \n"
"{ \n"
" %s; \n"
"%s"
"} \n",
m_name.c_str(),
- (const_object ? "const" : ""),
lldb_local_var_decls.GetData(),
tagged_body.c_str());
break;
diff --git a/lldb/source/Expression/LLVMUserExpression.cpp b/lldb/source/Expression/LLVMUserExpression.cpp
index 60f68b129d3..0b969806280 100644
--- a/lldb/source/Expression/LLVMUserExpression.cpp
+++ b/lldb/source/Expression/LLVMUserExpression.cpp
@@ -59,7 +59,6 @@ LLVMUserExpression::LLVMUserExpression(ExecutionContextScope &exe_scope,
m_in_objectivec_method(false),
m_in_static_method(false),
m_needs_object_ptr(false),
- m_const_object(false),
m_target(NULL),
m_can_interpret(false),
m_materialized_address(LLDB_INVALID_ADDRESS)
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
index 1bb59ade5e4..4b398631fd4 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
@@ -2213,10 +2213,10 @@ ClangExpressionDeclMap::AddThisType(NameSearchContext &context,
{
CompilerType copied_clang_type = GuardedCopyType(ut);
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
+
if (!copied_clang_type)
{
- Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
-
if (log)
log->Printf("ClangExpressionDeclMap::AddThisType - Couldn't import the type");
@@ -2233,7 +2233,7 @@ ClangExpressionDeclMap::AddThisType(NameSearchContext &context,
&void_ptr_clang_type,
1,
false,
- copied_clang_type.GetTypeQualifiers());
+ 0);
const bool is_virtual = false;
const bool is_static = false;
@@ -2242,7 +2242,7 @@ ClangExpressionDeclMap::AddThisType(NameSearchContext &context,
const bool is_attr_used = true;
const bool is_artificial = false;
- ClangASTContext::GetASTContext(m_ast_context)->
+ CXXMethodDecl *method_decl = ClangASTContext::GetASTContext(m_ast_context)->
AddMethodToCXXRecordType (copied_clang_type.GetOpaqueQualType(),
"$__lldb_expr",
method_type,
@@ -2253,6 +2253,16 @@ ClangExpressionDeclMap::AddThisType(NameSearchContext &context,
is_explicit,
is_attr_used,
is_artificial);
+
+ if (log)
+ {
+ ASTDumper method_ast_dumper((clang::Decl*)method_decl);
+ ASTDumper type_ast_dumper(copied_clang_type);
+
+ log->Printf(" CEDM::AddThisType Added function $__lldb_expr (description %s) for this type %s",
+ method_ast_dumper.GetCString(),
+ type_ast_dumper.GetCString());
+ }
}
if (!copied_clang_type.IsValid())
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
index 50669bd4e3c..53b6fe1b4c7 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
@@ -417,7 +417,7 @@ ClangUserExpression::Parse(DiagnosticManager &diagnostic_manager, ExecutionConte
else
lang_type = lldb::eLanguageTypeC;
- if (!source_code->GetText(m_transformed_text, lang_type, m_const_object, m_in_static_method, exe_ctx))
+ if (!source_code->GetText(m_transformed_text, lang_type, m_in_static_method, exe_ctx))
{
diagnostic_manager.PutCString(eDiagnosticSeverityError, "couldn't construct expression body");
return false;
OpenPOWER on IntegriCloud