Files
clang-p2996/lldb/test/API/lang/cpp/class_static/main.cpp
Raphael Isemann fdea9a4ec9 [lldb] Remove license headers from all test source files
Summary:
Around a third of our test sources have LLVM license headers. This patch removes those headers from all test
sources and also fixes any tests that depended on the length of the license header.

The reasons for this are:

* A few tests verify line numbers and will start failing if the number of lines in the LLVM license header changes. Once I landed my patch for valid SourceLocations in debug info we will probably have even more tests that verify line numbers.
* No other LLVM project is putting license headers in its test files to my knowledge.
* They make the test sources much more verbose than they have to be. Several tests have longer license headers than the actual test source.

For the record, the following tests had their line numbers changed to pass with the removal of the license header:
    lldb-api :: functionalities/breakpoint/breakpoint_by_line_and_column/TestBreakpointByLineAndColumn.py
    lldb-shell :: Reproducer/TestGDBRemoteRepro.test
    lldb-shell :: Reproducer/TestMultipleTargets.test
    lldb-shell :: Reproducer/TestReuseDirectory.test
    lldb-shell :: ExecControl/StopHook/stop-hook-threads.test
    lldb-shell :: ExecControl/StopHook/stop-hook.test
    lldb-api :: lang/objc/exceptions/TestObjCExceptions.py

Reviewers: #lldb, espindola, JDevlieghere

Reviewed By: #lldb, JDevlieghere

Subscribers: emaste, aprantl, arphaman, JDevlieghere, lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D74839
2020-02-20 08:32:01 +01:00

45 lines
1.1 KiB
C++

// I made this example after noting that I was unable to display an unsized
// static class array. It turns out that gcc 4.2 will emit DWARF that correctly
// describes the PointType, but it will incorrectly emit debug info for the
// "g_points" array where the following things are wrong:
// - the DW_TAG_array_type won't have a subrange info
// - the DW_TAG_variable for "g_points" won't have a valid byte size, so even
// though we know the size of PointType, we can't infer the actual size
// of the array by dividing the size of the variable by the number of
// elements.
#include <stdio.h>
typedef struct PointType
{
int x, y;
} PointType;
class A
{
public:
static PointType g_points[];
};
PointType A::g_points[] =
{
{ 1, 2 },
{ 11, 22 }
};
static PointType g_points[] =
{
{ 3, 4 },
{ 33, 44 }
};
int
main (int argc, char const *argv[])
{
const char *hello_world = "Hello, world!";
printf ("A::g_points[1].x = %i\n", A::g_points[1].x); // Set break point at this line.
printf ("::g_points[1].x = %i\n", g_points[1].x);
printf ("%s\n", hello_world);
return 0;
}