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/packages/Python/lldbsuite/test | |
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/packages/Python/lldbsuite/test')
3 files changed, 35 insertions, 0 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 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 <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); +} |