diff options
author | Sean Callanan <scallanan@apple.com> | 2016-04-28 01:36:21 +0000 |
---|---|---|
committer | Sean Callanan <scallanan@apple.com> | 2016-04-28 01:36:21 +0000 |
commit | 8bdcd522510f923185cdfaec66c4a78d0a0d38c0 (patch) | |
tree | d74ced8eb42f135ffea1bbd7f686ea11133a01e5 /lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp | |
parent | a9ad1552ab92a8a8725f628827766008e034d1c0 (diff) | |
download | bcm5719-llvm-8bdcd522510f923185cdfaec66c4a78d0a0d38c0.tar.gz bcm5719-llvm-8bdcd522510f923185cdfaec66c4a78d0a0d38c0.zip |
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: 267833
Diffstat (limited to 'lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp')
-rw-r--r-- | lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp index b40fe3b311f..556b27348e5 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp @@ -2212,10 +2212,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"); @@ -2232,7 +2232,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; @@ -2241,7 +2241,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, @@ -2252,6 +2252,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()) |