Skip to content

Commit

Permalink
[TestCppIncompleteTypes] Remove the dependence on std::string.
Browse files Browse the repository at this point in the history
Reviewers: dblaikie, clayborg

Subscribers: lldb-commits

Differential Revision: http://reviews.llvm.org/D13143

llvm-svn: 248541
  • Loading branch information
Siva Chandra committed Sep 24, 2015
1 parent b02f5a5 commit bd7f0df
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 26 deletions.
13 changes: 8 additions & 5 deletions lldb/test/lang/cpp/incomplete-types/Makefile
@@ -1,6 +1,6 @@
LEVEL = ../../../make

CXX_SOURCES = main.cpp length.cpp
CXX_SOURCES = main.cpp length.cpp a.cpp

CFLAGS_LIMIT = -c $(CXXFLAGS)
CFLAGS_NO_LIMIT = -c $(CXXFLAGS)
Expand All @@ -12,11 +12,11 @@ endif

all: limit nolimit

limit: main.o length_limit.o
$(CXX) $(LDFLAGS) main.o length_limit.o -o limit
limit: main.o length_limit.o a.o
$(CXX) $(LDFLAGS) main.o length_limit.o a.o -o limit

nolimit: main.o length_nolimit.o
$(CXX) $(LDFLAGS) main.o length_nolimit.o -o nolimit
nolimit: main.o length_nolimit.o a.o
$(CXX) $(LDFLAGS) main.o length_nolimit.o a.o -o nolimit

main.o: main.cpp
$(CXX) $(CFLAGS_LIMIT) main.cpp -o main.o
Expand All @@ -27,6 +27,9 @@ length_limit.o: length.cpp
length_nolimit.o: length.cpp
$(CXX) $(CFLAGS_NO_LIMIT) length.cpp -o length_nolimit.o

a.o: a.cpp
$(CXX) -c a.cpp -o a.o

clean: OBJECTS += limit nolimit length_limit.o length_nolimit.o

include $(LEVEL)/Makefile.rules
12 changes: 6 additions & 6 deletions lldb/test/lang/cpp/incomplete-types/TestCppIncompleteTypes.py
Expand Up @@ -16,9 +16,9 @@ def test_with_dwarf_limit_debug_info(self):
self.assertTrue(value_f.IsValid(), "'expr f' results in a valid SBValue object")
self.assertFalse(value_f.GetError().Success(), "'expr f' results in an error, but LLDB does not crash")

value_s = frame.EvaluateExpression("s")
self.assertTrue(value_s.IsValid(), "'expr s' results in a valid SBValue object")
self.assertFalse(value_s.GetError().Success(), "'expr s' results in an error, but LLDB does not crash")
value_a = frame.EvaluateExpression("a")
self.assertTrue(value_a.IsValid(), "'expr a' results in a valid SBValue object")
self.assertFalse(value_a.GetError().Success(), "'expr a' results in an error, but LLDB does not crash")

@dwarf_test
@skipIfGcc
Expand All @@ -30,9 +30,9 @@ def test_with_dwarf_partial_limit_debug_info(self):
self.assertTrue(value_f.IsValid(), "'expr f' results in a valid SBValue object")
self.assertTrue(value_f.GetError().Success(), "'expr f' is successful")

value_s = frame.EvaluateExpression("s")
self.assertTrue(value_s.IsValid(), "'expr s' results in a valid SBValue object")
self.assertTrue(value_s.GetError().Success(), "'expr s' is successful")
value_a = frame.EvaluateExpression("a")
self.assertTrue(value_a.IsValid(), "'expr a' results in a valid SBValue object")
self.assertTrue(value_a.GetError().Success(), "'expr a' is successful")

def setUp(self):
TestBase.setUp(self)
Expand Down
10 changes: 10 additions & 0 deletions lldb/test/lang/cpp/incomplete-types/a.cpp
@@ -0,0 +1,10 @@

#include "a.h"

A::A () { }

int
A::length ()
{
return 123;
}
11 changes: 11 additions & 0 deletions lldb/test/lang/cpp/incomplete-types/a.h
@@ -0,0 +1,11 @@
#ifndef __A_H__
#define __A_H__

class A
{
public:
A();
virtual int length();
};

#endif
6 changes: 3 additions & 3 deletions lldb/test/lang/cpp/incomplete-types/length.cpp
@@ -1,8 +1,8 @@

#include "length.h"

size_t
length (const std::string &str)
int
length (A &a)
{
return str.length();
return a.length();
}
4 changes: 2 additions & 2 deletions lldb/test/lang/cpp/incomplete-types/length.h
@@ -1,8 +1,8 @@
#ifndef __LENGTH_H__
#define __LENGTH_H__

#include <string>
#include "a.h"

size_t length (const std::string &str);
int length (A &a);

#endif
15 changes: 5 additions & 10 deletions lldb/test/lang/cpp/incomplete-types/main.cpp
Expand Up @@ -3,21 +3,16 @@

class Foo {
public:
Foo(std::string x) : s(x) {}

private:
std::string s;
A a;
};

class MyString : public std::string {
public:
MyString(std::string x) : std::string(x) {}
class MyA : public A {
};

int main()
{
Foo f("qwerty");
MyString s("qwerty");
Foo f;
MyA a;

return length(s); // break here
return length(a); // break here
}

0 comments on commit bd7f0df

Please sign in to comment.