diff options
| author | Pavel Labath <labath@google.com> | 2016-04-28 08:16:19 +0000 |
|---|---|---|
| committer | Pavel Labath <labath@google.com> | 2016-04-28 08:16:19 +0000 |
| commit | 35e9ea38127b99a261f946a415d3641538b8baa3 (patch) | |
| tree | d0283839aa6960b1402f557f34674397d33d09f5 /lldb | |
| parent | 8d598299472f36a2770d13f3c6e4764742b41aea (diff) | |
| download | bcm5719-llvm-35e9ea38127b99a261f946a415d3641538b8baa3.tar.gz bcm5719-llvm-35e9ea38127b99a261f946a415d3641538b8baa3.zip | |
Revert "Fixed a bug where const this would cause parser errors about $__lldb_expr."
This reverts commit r267833 as it breaks the build. It looks like some work in progress got
committed together with the actual fix, but I'm not sure which one is which, so I'll revert the
whole patch and let author resumbit it after fixing the build error.
llvm-svn: 267861
Diffstat (limited to 'lldb')
8 files changed, 9 insertions, 120 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/lang/cpp/const_this/Makefile b/lldb/packages/Python/lldbsuite/test/lang/cpp/const_this/Makefile deleted file mode 100644 index 52a92c0b61a..00000000000 --- a/lldb/packages/Python/lldbsuite/test/lang/cpp/const_this/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -LEVEL = ../../../make -CXX_SOURCES := main.cpp -CXXFLAGS += -std=c++11 -include $(LEVEL)/Makefile.rules - -cleanup: - rm -f Makefile *.d - diff --git a/lldb/packages/Python/lldbsuite/test/lang/cpp/const_this/TestConstThis.py b/lldb/packages/Python/lldbsuite/test/lang/cpp/const_this/TestConstThis.py deleted file mode 100644 index 2249a8c9b16..00000000000 --- a/lldb/packages/Python/lldbsuite/test/lang/cpp/const_this/TestConstThis.py +++ /dev/null @@ -1,4 +0,0 @@ -from lldbsuite.test import lldbinline -from lldbsuite.test import decorators - -lldbinline.MakeInlineTest(__file__, globals(), [decorators.expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24764")] ) diff --git a/lldb/packages/Python/lldbsuite/test/lang/cpp/const_this/main.cpp b/lldb/packages/Python/lldbsuite/test/lang/cpp/const_this/main.cpp deleted file mode 100644 index 7614977b245..00000000000 --- a/lldb/packages/Python/lldbsuite/test/lang/cpp/const_this/main.cpp +++ /dev/null @@ -1,23 +0,0 @@ -//===-- main.cpp ------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#include <stdio.h> - -class foo { -public: - template <class T> T func(T x) const { - return x+2; //% self.expect("expr 2+3", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["5"]) - } -}; - -int i; - -int main() { - return foo().func(i); -} diff --git a/lldb/source/Core/Scalar.cpp b/lldb/source/Core/Scalar.cpp index 04970a69b84..a45424d0b1f 100644 --- a/lldb/source/Core/Scalar.cpp +++ b/lldb/source/Core/Scalar.cpp @@ -78,74 +78,6 @@ PromoteToMaxType return Scalar::e_void; } -llvm::APInt -Scalar::APIntWithTypeAndValue(Scalar::Type type, uint64_t raw_value) -{ - // APInt(unsigned numBits, uint64_t val, bool isSigned = false) - unsigned num_bits = 1; - bool is_signed = false; - - switch (type) - { - case Scalar::e_void: - break; - case Scalar::e_sint: - is_signed = true; - num_bits = sizeof(sint_t) * 8; - break; - case Scalar::e_uint: - is_signed = false; - num_bits = sizeof(uint_t) * 8; - break; - case Scalar::e_slong: - is_signed = true; - num_bits = sizeof(slong_t) * 8; - break; - case Scalar::e_ulong: - is_signed = false; - num_bits = sizeof(ulong_t) * 8; - break; - case Scalar::e_slonglong: - is_signed = true; - num_bits = sizeof(slonglong_t) * 8; - break; - case Scalar::e_ulonglong: - is_signed = false; - num_bits = sizeof(ulonglong_t) * 8; - break; - case Scalar::e_sint128: - is_signed = true; - num_bits = 128; - break; - case Scalar::e_uint128: - is_signed = false; - num_bits = 128; - break; - case Scalar::e_sint256: - is_signed = true; - num_bits = 256; - break; - case Scalar::e_uint256: - is_signed = false; - num_bits = 256; - break; - case Scalar::e_float: - is_signed = false; - num_bits = sizeof(float_t) * 8; - break; - case Scalar::e_double: - is_signed = false; - num_bits = sizeof(double_t) * 8; - break; - case Scalar::e_long_double: - is_signed = false; - num_bits = sizeof(long_double_t) * 8; - break; - } - - return llvm::APInt(num_bits, raw_value, is_signed); -} - Scalar::Scalar() : m_type(e_void), m_float((float)0) diff --git a/lldb/source/Expression/ExpressionSourceCode.cpp b/lldb/source/Expression/ExpressionSourceCode.cpp index d82ed608407..14e98105b8a 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 static_method, ExecutionContext &exe_ctx) const +bool ExpressionSourceCode::GetText (std::string &text, lldb::LanguageType wrapping_language, bool const_object, bool static_method, ExecutionContext &exe_ctx) const { const char *target_specific_defines = "typedef signed char BOOL;\n"; std::string module_macros; @@ -337,12 +337,13 @@ 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) \n" + "$__lldb_class::%s(void *$__lldb_arg) %s\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 0b969806280..60f68b129d3 100644 --- a/lldb/source/Expression/LLVMUserExpression.cpp +++ b/lldb/source/Expression/LLVMUserExpression.cpp @@ -59,6 +59,7 @@ 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 4b398631fd4..1bb59ade5e4 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, - 0); + copied_clang_type.GetTypeQualifiers()); 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; - CXXMethodDecl *method_decl = ClangASTContext::GetASTContext(m_ast_context)-> + ClangASTContext::GetASTContext(m_ast_context)-> AddMethodToCXXRecordType (copied_clang_type.GetOpaqueQualType(), "$__lldb_expr", method_type, @@ -2253,16 +2253,6 @@ 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 53b6fe1b4c7..50669bd4e3c 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_in_static_method, exe_ctx)) + if (!source_code->GetText(m_transformed_text, lang_type, m_const_object, m_in_static_method, exe_ctx)) { diagnostic_manager.PutCString(eDiagnosticSeverityError, "couldn't construct expression body"); return false; |

