From 7736a208b8958a7e708c0756bdce40437f8f48f6 Mon Sep 17 00:00:00 2001 From: Sean Callanan Date: Fri, 29 Apr 2016 18:09:03 +0000 Subject: [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. llvm-svn: 268083 --- .../lldbsuite/test/lang/cpp/const_this/Makefile | 8 ++++++++ .../test/lang/cpp/const_this/TestConstThis.py | 4 ++++ .../lldbsuite/test/lang/cpp/const_this/main.cpp | 23 ++++++++++++++++++++++ 3 files changed, 35 insertions(+) create mode 100644 lldb/packages/Python/lldbsuite/test/lang/cpp/const_this/Makefile create mode 100644 lldb/packages/Python/lldbsuite/test/lang/cpp/const_this/TestConstThis.py create mode 100644 lldb/packages/Python/lldbsuite/test/lang/cpp/const_this/main.cpp (limited to 'lldb/packages/Python/lldbsuite/test') diff --git a/lldb/packages/Python/lldbsuite/test/lang/cpp/const_this/Makefile b/lldb/packages/Python/lldbsuite/test/lang/cpp/const_this/Makefile new file mode 100644 index 00000000000..52a92c0b61a --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/lang/cpp/const_this/Makefile @@ -0,0 +1,8 @@ +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 new file mode 100644 index 00000000000..2249a8c9b16 --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/lang/cpp/const_this/TestConstThis.py @@ -0,0 +1,4 @@ +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 new file mode 100644 index 00000000000..7614977b245 --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/lang/cpp/const_this/main.cpp @@ -0,0 +1,23 @@ +//===-- 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 + +class foo { +public: + template 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); +} -- cgit v1.2.3