teak-llvm/lldb/lit/Expr/Inputs/call-function.cpp
Chris Bieneman 4851558f55 [LIT] First pass of LLDB LIT support
Summary:
This patch supplies basic infrastructure for LLDB to use LIT, and ports a few basic test cases from the LLDB test suite into LIT.

With this patch the LLDB lit system is not capable or intended to fully replace the existing LLDB test suite, but this first patch enables people to write lit tests for LLDB.

The lit substitution for %cc and %cxx default to the host compiler unless the CMake option LLDB_TEST_CLANG is On, in which case the in-tree clang will be used.

The target check-lldb-lit will run all lit tests including the lit-based executor for the unit tests. Alternatively there is a target generated for each subdirectory under the lit directory, so check-lldb-unit and check-lldb-expr will run just the tests under their respective directories.

The ported tests are not removed from the existing suite, and should not be until such a time when the lit runner is mature and in use by bots and workflows.

Reviewers: zturner, labath, jingham, tfiala

Subscribers: beanz, mgorny, lldb-commits

Differential Revision: https://reviews.llvm.org/D24591

llvm-svn: 281651
2016-09-15 20:13:55 +00:00

54 lines
810 B
C++

#include <iostream>
#include <string>
#include <cstring>
struct Five
{
int number;
const char *name;
};
Five
returnsFive()
{
Five my_five = {5, "five"};
return my_five;
}
unsigned int
fib(unsigned int n)
{
if (n < 2)
return n;
else
return fib(n - 1) + fib(n - 2);
}
int
add(int a, int b)
{
return a + b;
}
bool
stringCompare(const char *str)
{
if (strcmp( str, "Hello world" ) == 0)
return true;
else
return false;
}
int main (int argc, char const *argv[])
{
std::string str = "Hello world";
std::cout << str << std::endl;
std::cout << str.c_str() << std::endl;
Five main_five = returnsFive();
#if 0
print str
print str.c_str()
#endif
return 0; // Please test these expressions while stopped at this line:
}