Imported Upstream version 6.10.0.49

Former-commit-id: 1d6753294b2993e1fbf92de9366bb9544db4189b
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2020-01-16 16:38:04 +00:00
parent d94e79959b
commit 468663ddbb
48518 changed files with 2789335 additions and 61176 deletions

View File

@@ -0,0 +1,7 @@
[
{
"directory": "$test_dir/build",
"command": "clang++ -o test.o -I../include $test_dir/src/test.cpp",
"file": "$test_dir/src/test.cpp"
}
]

View File

@@ -0,0 +1,9 @@
namespace a {
enum E1 { Green, Red };
enum class E2 { Yellow };
class C {
enum E3 { Blue };
};
} // namespace a

View File

@@ -0,0 +1,5 @@
#include "function_test.h"
void f() {}
void A::f() {}

View File

@@ -0,0 +1,14 @@
void f();
inline int g() { return 0; }
template<typename T>
void h(T t) {}
template<>
void h(int t) {}
class A {
public:
void f();
};

View File

@@ -0,0 +1,97 @@
#include "helper_decls_test.h"
namespace {
class HelperC1 {
public:
static int I;
};
int HelperC1::I = 0;
class HelperC2 {};
class HelperC3 {
public:
static int I;
};
int HelperC3::I = 0;
void HelperFun1() {}
void HelperFun2() { HelperFun1(); }
const int K1 = 1;
} // namespace
static const int K2 = 2;
static void HelperFun3() { K2; }
namespace a {
static const int K3 = 3;
static const int K4 = HelperC3::I;
static const int K5 = 5;
static const int K6 = 6;
static void HelperFun4() {}
static void HelperFun6() {}
void Class1::f() { HelperFun2(); }
void Class2::f() {
HelperFun1();
HelperFun3();
}
void Class3::f() { HelperC1::I; }
void Class4::f() { HelperC2 c2; }
void Class5::f() {
int Result = K1 + K2 + K3;
HelperFun4();
}
int Class6::f() {
int R = K4;
return R;
}
int Class7::f() {
int R = K6;
return R;
}
int Class7::g() {
HelperFun6();
return 1;
}
static int HelperFun5() {
int R = K5;
return R;
}
void Fun1() { HelperFun5(); }
} // namespace a
namespace b {
namespace {
void HelperFun7();
class HelperC4;
} // namespace
void Fun3() {
HelperFun7();
HelperC4 *t;
}
namespace {
void HelperFun7() {}
class HelperC4 {};
} // namespace
} // namespace b

View File

@@ -0,0 +1,39 @@
namespace a {
class Class1 {
void f();
};
class Class2 {
void f();
};
class Class3 {
void f();
};
class Class4 {
void f();
};
class Class5 {
void f();
};
class Class6 {
int f();
};
class Class7 {
int f();
int g();
};
void Fun1();
inline void Fun2() {}
} // namespace a
namespace b {
void Fun3();
} // namespace b

View File

@@ -0,0 +1,13 @@
#include "macro_helper_test.h"
#define DEFINE(name) \
namespace ns { \
static const bool t1 = false; \
bool t2_##name = t1; \
bool t3_##name = t1; \
} \
using ns::t2_##name;
DEFINE(test)
void f1() {}

View File

@@ -0,0 +1,2 @@
class A {};
void f1();

View File

@@ -0,0 +1,52 @@
#include "multiple_class_test.h"
using a::Move1;
using namespace a;
using A = a::Move1;
static int g = 0;
namespace a {
int Move1::f() {
return 0;
}
} // namespace a
namespace {
using a::Move1;
using namespace a;
static int k = 0;
} // namespace
namespace b {
using a::Move1;
using namespace a;
using T = a::Move1;
int Move2::f() {
return 0;
}
} // namespace b
namespace c {
int Move3::f() {
using a::Move1;
using namespace b;
return 0;
}
int Move4::f() {
return k;
}
int EnclosingMove5::a = 1;
int EnclosingMove5::Nested::f() {
return g;
}
int EnclosingMove5::Nested::b = 1;
int NoMove::f() {
static int F = 0;
return g;
}
} // namespace c

View File

@@ -0,0 +1,39 @@
namespace a {
class Move1 {
public:
int f();
};
} // namespace a
namespace b {
class Move2 {
public:
int f();
};
} // namespace b
namespace c {
class Move3 {
public:
int f();
};
class Move4 {
public:
int f();
};
class EnclosingMove5 {
public:
class Nested {
int f();
static int b;
};
static int a;
};
class NoMove {
public:
int f();
};
} // namespace c

View File

@@ -0,0 +1,13 @@
#include "template_class_test.h"
template <typename T>
void A<T>::g() {}
template <typename T>
template <typename U>
void A<T>::k() {}
template <typename T>
int A<T>::c = 2;
void B::f() {}

View File

@@ -0,0 +1,30 @@
#ifndef TEMPLATE_CLASS_TEST_H // comment 1
#define TEMPLATE_CLASS_TEST_H
template <typename T>
class A {
public:
void f();
void g();
template <typename U> void h();
template <typename U> void k();
static int b;
static int c;
};
template <typename T>
void A<T>::f() {}
template <typename T>
template <typename U>
void A<T>::h() {}
template <typename T>
int A<T>::b = 2;
class B {
public:
void f();
};
#endif // TEMPLATE_CLASS_TEST_H

View File

@@ -0,0 +1,11 @@
#include "test.h"
#include "test2.h"
namespace a {
int Foo::f() {
return 0;
}
int Foo::f2(int a, int b) {
return a + b;
}
} // namespace a

View File

@@ -0,0 +1,10 @@
#ifndef TEST_H // comment 1
#define TEST_H
namespace a {
class Foo {
public:
int f();
int f2(int a, int b);
};
} // namespace a
#endif // TEST_H

View File

@@ -0,0 +1,11 @@
typedef int Int1;
using Int2 = int;
template<class T>
struct A {};
template <class T> using B = A<T>;
class C {
typedef int Int3;
};

View File

@@ -0,0 +1,6 @@
#include "var_test.h"
namespace a{
int kGlobalInt = 1;
const char *const kGlobalStr = "Hello";
}

View File

@@ -0,0 +1,11 @@
namespace a {
extern int kGlobalInt;
extern const char *const kGlobalStr;
}
int kEvilInt = 2;
inline void f1() {
int kGlobalInt = 3;
const char *const kGlobalStr = "Hello2";
}

View File

@@ -0,0 +1,43 @@
// RUN: mkdir -p %T/clang-move/build
// RUN: mkdir -p %T/clang-move/include
// RUN: mkdir -p %T/clang-move/src
// RUN: sed 's|$test_dir|%/T/clang-move|g' %S/Inputs/database_template.json > %T/clang-move/compile_commands.json
// RUN: cp %S/Inputs/test.h %T/clang-move/include
// RUN: cp %S/Inputs/test.cpp %T/clang-move/src
// RUN: touch %T/clang-move/include/test2.h
// RUN: cd %T/clang-move/build
// RUN: clang-move -names="a::Foo" -new_cc=%T/clang-move/new_test.cpp -new_header=%T/clang-move/new_test.h -old_cc=../src/test.cpp -old_header=../include/test.h %T/clang-move/src/test.cpp
// RUN: FileCheck -input-file=%T/clang-move/new_test.cpp -check-prefix=CHECK-NEW-TEST-CPP %s
// RUN: FileCheck -input-file=%T/clang-move/new_test.h -check-prefix=CHECK-NEW-TEST-H %s
// RUN: FileCheck -input-file=%T/clang-move/src/test.cpp -check-prefix=CHECK-OLD-TEST-EMPTY -allow-empty %s
// RUN: FileCheck -input-file=%T/clang-move/include/test.h -check-prefix=CHECK-OLD-TEST-EMPTY -allow-empty %s
//
// RUN: cp %S/Inputs/test.h %T/clang-move/include
// RUN: cp %S/Inputs/test.cpp %T/clang-move/src
// RUN: cd %T/clang-move/build
// RUN: clang-move -names="a::Foo" -new_cc=%T/clang-move/new_test.cpp -new_header=%T/clang-move/new_test.h -old_cc=%T/clang-move/src/test.cpp -old_header=%T/clang-move/include/test.h %T/clang-move/src/test.cpp
// RUN: FileCheck -input-file=%T/clang-move/new_test.cpp -check-prefix=CHECK-NEW-TEST-CPP %s
// RUN: FileCheck -input-file=%T/clang-move/new_test.h -check-prefix=CHECK-NEW-TEST-H %s
// RUN: FileCheck -input-file=%T/clang-move/src/test.cpp -check-prefix=CHECK-OLD-TEST-EMPTY -allow-empty %s
// RUN: FileCheck -input-file=%T/clang-move/include/test.h -check-prefix=CHECK-OLD-TEST-EMPTY -allow-empty %s
//
//
// CHECK-NEW-TEST-H: #ifndef TEST_H // comment 1
// CHECK-NEW-TEST-H: #define TEST_H
// CHECK-NEW-TEST-H: namespace a {
// CHECK-NEW-TEST-H: class Foo {
// CHECK-NEW-TEST-H: public:
// CHECK-NEW-TEST-H: int f();
// CHECK-NEW-TEST-H: int f2(int a, int b);
// CHECK-NEW-TEST-H: };
// CHECK-NEW-TEST-H: } // namespace a
// CHECK-NEW-TEST-H: #endif // TEST_H
//
// CHECK-NEW-TEST-CPP: #include "{{.*}}new_test.h"
// CHECK-NEW-TEST-CPP: #include "test2.h"
// CHECK-NEW-TEST-CPP: namespace a {
// CHECK-NEW-TEST-CPP: int Foo::f() { return 0; }
// CHECK-NEW-TEST-CPP: int Foo::f2(int a, int b) { return a + b; }
// CHECK-NEW-TEST-CPP: } // namespace a
//
// CHECK-OLD-TEST-EMPTY: {{^}}{{$}}

View File

@@ -0,0 +1,44 @@
// RUN: mkdir -p %T/move-enum
// RUN: cp %S/Inputs/enum.h %T/move-enum/enum.h
// RUN: echo '#include "enum.h"' > %T/move-enum/enum.cpp
// RUN: cd %T/move-enum
//
// -----------------------------------------------------------------------------
// Test moving enum declarations.
// -----------------------------------------------------------------------------
// RUN: clang-move -names="a::E1" -new_cc=%T/move-enum/new_test.cpp -new_header=%T/move-enum/new_test.h -old_cc=%T/move-enum/enum.cpp -old_header=%T/move-enum/enum.h %T/move-enum/enum.cpp -- -std=c++11
// RUN: FileCheck -input-file=%T/move-enum/new_test.h -check-prefix=CHECK-NEW-TEST-H-CASE1 %s
// RUN: FileCheck -input-file=%T/move-enum/enum.h -check-prefix=CHECK-OLD-TEST-H-CASE1 %s
//
// CHECK-NEW-TEST-H-CASE1: namespace a {
// CHECK-NEW-TEST-H-CASE1-NEXT: enum E1 { Green, Red };
// CHECK-NEW-TEST-H-CASE1-NEXT: }
// CHECK-OLD-TEST-H-CASE1-NOT: enum E1 { Green, Red };
// -----------------------------------------------------------------------------
// Test moving scoped enum declarations.
// -----------------------------------------------------------------------------
// RUN: cp %S/Inputs/enum.h %T/move-enum/enum.h
// RUN: echo '#include "enum.h"' > %T/move-enum/enum.cpp
// RUN: clang-move -names="a::E2" -new_cc=%T/move-enum/new_test.cpp -new_header=%T/move-enum/new_test.h -old_cc=%T/move-enum/enum.cpp -old_header=%T/move-enum/enum.h %T/move-enum/enum.cpp -- -std=c++11
// RUN: FileCheck -input-file=%T/move-enum/new_test.h -check-prefix=CHECK-NEW-TEST-H-CASE2 %s
// RUN: FileCheck -input-file=%T/move-enum/enum.h -check-prefix=CHECK-OLD-TEST-H-CASE2 %s
// CHECK-NEW-TEST-H-CASE2: namespace a {
// CHECK-NEW-TEST-H-CASE2-NEXT: enum class E2 { Yellow };
// CHECK-NEW-TEST-H-CASE2-NEXT: }
// CHECK-OLD-TEST-H-CASE2-NOT: enum class E2 { Yellow };
// -----------------------------------------------------------------------------
// Test not moving class-insided enum declarations.
// -----------------------------------------------------------------------------
// RUN: cp %S/Inputs/enum.h %T/move-enum/enum.h
// RUN: echo '#include "enum.h"' > %T/move-enum/enum.cpp
// RUN: clang-move -names="a::C::E3" -new_cc=%T/move-enum/new_test.cpp -new_header=%T/move-enum/new_test.h -old_cc=%T/move-enum/enum.cpp -old_header=%T/move-enum/enum.h %T/move-enum/enum.cpp -- -std=c++11
// RUN: FileCheck -input-file=%T/move-enum/new_test.h -allow-empty -check-prefix=CHECK-EMPTY %s
// CHECK-EMPTY: {{^}}{{$}}

View File

@@ -0,0 +1,67 @@
// RUN: mkdir -p %T/move-function
// RUN: cp %S/Inputs/function_test* %T/move-function
// RUN: cd %T/move-function
// RUN: clang-move -names="g" -new_header=%T/move-function/new_function_test.h -old_header=../move-function/function_test.h %T/move-function/function_test.cpp --
// RUN: FileCheck -input-file=%T/move-function/new_function_test.h -check-prefix=CHECK-NEW-TEST-H-CASE1 %s
//
// CHECK-NEW-TEST-H-CASE1: #ifndef {{.*}}NEW_FUNCTION_TEST_H
// CHECK-NEW-TEST-H-CASE1: #define {{.*}}NEW_FUNCTION_TEST_H
// CHECK-NEW-TEST-H-CASE1: {{[[:space:]]+}}
// CHECK-NEW-TEST-H-CASE1: inline int g() { return 0; }
// CHECK-NEW-TEST-H-CASE1: {{[[:space:]]+}}
// CHECK-NEW-TEST-H-CASE1: #endif // {{.*}}NEW_FUNCTION_TEST_H
//
// RUN: cp %S/Inputs/function_test* %T/move-function
// RUN: clang-move -names="h" -new_header=%T/move-function/new_function_test.h -old_header=../move-function/function_test.h %T/move-function/function_test.cpp --
// RUN: FileCheck -input-file=%T/move-function/new_function_test.h -check-prefix=CHECK-NEW-TEST-H-CASE2 %s
//
// CHECK-NEW-TEST-H-CASE2: #ifndef {{.*}}NEW_FUNCTION_TEST_H
// CHECK-NEW-TEST-H-CASE2: #define {{.*}}NEW_FUNCTION_TEST_H
// CHECK-NEW-TEST-H-CASE2: {{[[:space:]]+}}
// CHECK-NEW-TEST-H-CASE2: template <typename T> void h(T t) {}
// CHECK-NEW-TEST-H-CASE2: {{[[:space:]]+}}
// CHECK-NEW-TEST-H-CASE2: template <> void h(int t) {}
// CHECK-NEW-TEST-H-CASE2: {{[[:space:]]+}}
// CHECK-NEW-TEST-H-CASE2: #endif // {{.*}}NEW_FUNCTION_TEST_H
//
// RUN: cp %S/Inputs/function_test* %T/move-function
// RUN: clang-move -names="f" -new_header=%T/move-function/new_function_test.h -new_cc=%T/move-function/new_function_test.cpp -old_header=../move-function/function_test.h -old_cc=../move-function/function_test.cpp %T/move-function/function_test.cpp --
// RUN: FileCheck -input-file=%T/move-function/new_function_test.h -check-prefix=CHECK-NEW-TEST-H-CASE3 %s
// RUN: FileCheck -input-file=%T/move-function/new_function_test.cpp -check-prefix=CHECK-NEW-TEST-CPP-CASE3 %s
//
// CHECK-NEW-TEST-H-CASE3: #ifndef {{.*}}NEW_FUNCTION_TEST_H
// CHECK-NEW-TEST-H-CASE3: #define {{.*}}NEW_FUNCTION_TEST_H
// CHECK-NEW-TEST-H-CASE3: {{[[:space:]]+}}
// CHECK-NEW-TEST-H-CASE3: void f();
// CHECK-NEW-TEST-H-CASE3: {{[[:space:]]+}}
// CHECK-NEW-TEST-H-CASE3: #endif // {{.*}}NEW_FUNCTION_TEST_H
// CHECK-NEW-TEST-CPP-CASE3: #include "{{.*}}new_function_test.h"
// CHECK-NEW-TEST-CPP-CASE3: {{[[:space:]]+}}
// CHECK-NEW-TEST-CPP-CASE3: void f() {}
//
// RUN: cp %S/Inputs/function_test* %T/move-function
// RUN: clang-move -names="A::f" -new_header=%T/move-function/new_function_test.h -new_cc=%T/move-function/new_function_test.cpp -old_header=../move-function/function_test.h -old_cc=../move-function/function_test.cpp %T/move-function/function_test.cpp -dump_result -- | FileCheck %s -check-prefix=CHECK-EMPTY
//
// CHECK-EMPTY: [{{[[:space:]]*}}]
//
// RUN: cp %S/Inputs/function_test* %T/move-function
// RUN: clang-move -names="f,A" -new_header=%T/move-function/new_function_test.h -new_cc=%T/move-function/new_function_test.cpp -old_header=../move-function/function_test.h -old_cc=../move-function/function_test.cpp %T/move-function/function_test.cpp --
// RUN: FileCheck -input-file=%T/move-function/new_function_test.h -check-prefix=CHECK-NEW-TEST-H-CASE4 %s
// RUN: FileCheck -input-file=%T/move-function/new_function_test.cpp -check-prefix=CHECK-NEW-TEST-CPP-CASE4 %s
// CHECK-NEW-TEST-H-CASE4: #ifndef {{.*}}NEW_FUNCTION_TEST_H
// CHECK-NEW-TEST-H-CASE4: #define {{.*}}NEW_FUNCTION_TEST_H
// CHECK-NEW-TEST-H-CASE4: {{[[:space:]]+}}
// CHECK-NEW-TEST-H-CASE4: void f();
// CHECK-NEW-TEST-H-CASE4: {{[[:space:]]+}}
// CHECK-NEW-TEST-H-CASE4: class A {
// CHECK-NEW-TEST-H-CASE4: public:
// CHECK-NEW-TEST-H-CASE4: void f();
// CHECK-NEW-TEST-H-CASE4: };
// CHECK-NEW-TEST-H-CASE4: {{[[:space:]]+}}
// CHECK-NEW-TEST-H-CASE4: #endif // {{.*}}NEW_FUNCTION_TEST_H
// CHECK-NEW-TEST-CPP-CASE4: #include "{{.*}}new_function_test.h"
// CHECK-NEW-TEST-CPP-CASE4: {{[[:space:]]+}}
// CHECK-NEW-TEST-CPP-CASE4: void f() {}
// CHECK-NEW-TEST-CPP-CASE4: {{[[:space:]]+}}
// CHECK-NEW-TEST-CPP-CASE4: void A::f() {}

Some files were not shown because too many files have changed in this diff Show More