Files
clang-p2996/lldb/test/API/lang/cpp/namespace/ns2.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

57 lines
1.7 KiB
C++

#include "ns.h"
static int func()
{
std::printf("static m2.cpp func()\n");
return 2;
}
void test_lookup_at_file_scope()
{
// BP_file_scope
std::printf("at file scope: func() = %d\n", func()); // eval func(), exp: 2
std::printf("at file scope: func(10) = %d\n", func(10)); // eval func(10), exp: 11
}
namespace A {
namespace B {
int func()
{
std::printf("A::B::func()\n");
return 4;
}
void test_lookup_at_nested_ns_scope()
{
// BP_nested_ns_scope
std::printf("at nested ns scope: func() = %d\n", func()); // eval func(), exp: 4
//printf("func(10) = %d\n", func(10)); // eval func(10), exp: 13
// NOTE: Under the rules of C++, this test would normally get an error
// because A::B::func() hides A::func(), but lldb intentionally
// disobeys these rules so that the intended overload can be found
// by only removing duplicates if they have the same type.
}
void test_lookup_at_nested_ns_scope_after_using()
{
// BP_nested_ns_scope_after_using
using A::func;
std::printf("at nested ns scope after using: func() = %d\n", func()); // eval func(), exp: 3
}
}
}
int A::foo()
{
std::printf("A::foo()\n");
return 42;
}
int A::func(int a)
{
std::printf("A::func(int)\n");
return a + 3;
}
void A::test_lookup_at_ns_scope()
{
// BP_ns_scope
std::printf("at nested ns scope: func() = %d\n", func()); // eval func(), exp: 3
std::printf("at nested ns scope: func(10) = %d\n", func(10)); // eval func(10), exp: 13
std::printf("at nested ns scope: foo() = %d\n", foo()); // eval foo(), exp: 42
}