Skip to content

Commit 0333dd9

Browse files
committed
Restore test files accidentally deleted in r354839
I think there must be a bug in git-llvm causing parent directories to be deleted when the diff deletes files in a subdirectory. Perhaps it is Windows-only. There has been a behavior change, so some of these tests now fail. I have marked them XFAIL and will fix them in a follow-up to separate the changes. llvm-svn: 360699
1 parent 094584c commit 0333dd9

File tree

75 files changed

+1963
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+1963
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
class A {
2+
public:
3+
struct { int foo; } f;
4+
struct { int foo; } g;
5+
};
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
class A {
2+
public:
3+
struct { int foo; } f;
4+
struct { int foo; } g;
5+
};
6+
7+
inline int useA(A &a) {
8+
return (a.f.foo + a.g.foo);
9+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// RUN: %clang_cc1 -emit-pch -o %t.1.ast %S/Inputs/anonymous-fields1.cpp
2+
// RUN: %clang_cc1 -emit-pch -o %t.2.ast %S/Inputs/anonymous-fields2.cpp
3+
// RUN: %clang_cc1 -emit-obj -o /dev/null -ast-merge %t.1.ast -ast-merge %t.2.ast %s
4+
// expected-no-diagnostics
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
2+
unsigned char asmFunc(unsigned char a, unsigned char b) {
3+
unsigned int la = a;
4+
unsigned int lb = b;
5+
unsigned int bigres;
6+
unsigned char res;
7+
__asm__ ("0:\n1:\n" : [bigres] "=la"(bigres) : [la] "0"(la), [lb] "c"(lb) :
8+
"edx", "cc");
9+
res = bigres;
10+
return res;
11+
}
12+
13+
int asmFunc2(int i) {
14+
int res;
15+
asm ("mov %1, %0 \t\n"
16+
"inc %0 "
17+
: "=r" (res)
18+
: "r" (i)
19+
: "cc");
20+
return res;
21+
}

clang/test/ASTMerge/asm/test.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// RUN: %clang_cc1 -triple i386-unknown-unknown -fcxx-exceptions -emit-pch -o %t.1.ast %S/Inputs/asm-function.cpp
2+
// RUN: %clang_cc1 -triple i386-unknown-unknown -fcxx-exceptions -ast-merge %t.1.ast -fsyntax-only -verify %s
3+
// expected-no-diagnostics
4+
5+
void testAsmImport() {
6+
asmFunc(12, 42);
7+
asmFunc2(42);
8+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
@interface I1
2+
@end
3+
4+
// Matching category
5+
@interface I1 (Cat1)
6+
- (int)method0;
7+
@end
8+
9+
// Matching class extension
10+
@interface I1 ()
11+
- (int)method1;
12+
@end
13+
14+
// Mismatched category
15+
@interface I1 (Cat2)
16+
- (int)method2;
17+
@end
18+
19+
@interface I2
20+
@end
21+
22+
// Mismatched class extension
23+
@interface I2 ()
24+
- (int)method3;
25+
@end
26+
27+
// Category with implementation
28+
@interface I2 (Cat3)
29+
@end
30+
31+
@implementation I2 (Cat3)
32+
@end
33+
34+
// Category with implementation
35+
@interface I2 (Cat4)
36+
@end
37+
38+
@implementation I2 (Cat4)
39+
@end
40+
41+
// Category with mismatched implementation
42+
@interface I2 (Cat6)
43+
@end
44+
45+
@implementation I2 (Cat6)
46+
- (float)blah { return 0; }
47+
@end
48+
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
typedef int Int;
2+
3+
@interface I1
4+
@end
5+
6+
// Matching category
7+
@interface I1 (Cat1)
8+
- (Int)method0;
9+
@end
10+
11+
// Matching class extension
12+
@interface I1 ()
13+
- (Int)method1;
14+
@end
15+
16+
// Mismatched category
17+
@interface I1 (Cat2)
18+
- (float)method2;
19+
@end
20+
21+
@interface I2
22+
@end
23+
24+
// Mismatched class extension
25+
@interface I2 ()
26+
- (float)method3;
27+
@end
28+
29+
// Category with implementation
30+
@interface I2 (Cat3)
31+
@end
32+
33+
@implementation I2 (Cat3)
34+
@end
35+
36+
// Category with implementation
37+
@interface I2 (Cat5)
38+
@end
39+
40+
@implementation I2 (Cat5)
41+
@end
42+
43+
// Category with mismatched implementation
44+
@interface I2 (Cat6)
45+
@end
46+
47+
@implementation I2 (Cat6)
48+
- (int)blah { return 0; }
49+
@end

clang/test/ASTMerge/category/test.m

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// FIXME: Errors are now warnings.
2+
// XFAIL: *
3+
// RUN: %clang_cc1 -emit-pch -o %t.1.ast %S/Inputs/category1.m
4+
// RUN: %clang_cc1 -emit-pch -o %t.2.ast %S/Inputs/category2.m
5+
// RUN: not %clang_cc1 -ast-merge %t.1.ast -ast-merge %t.2.ast -fsyntax-only %s 2>&1 | FileCheck %s
6+
7+
// CHECK: category2.m:18:1: error: instance method 'method2' has incompatible result types in different translation units ('float' vs. 'int')
8+
// CHECK: category1.m:16:1: note: instance method 'method2' also declared here
9+
// CHECK: category2.m:26:1: error: instance method 'method3' has incompatible result types in different translation units ('float' vs. 'int')
10+
// CHECK: category1.m:24:1: note: instance method 'method3' also declared here
11+
// CHECK: category2.m:48:1: error: instance method 'blah' has incompatible result types in different translation units ('int' vs. 'float')
12+
// CHECK: category1.m:46:1: note: instance method 'blah' also declared here
13+
// CHECK: 3 errors generated.
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
template<typename T, class P>
2+
struct TwoOptionTemplate {};
3+
4+
template<typename T>
5+
struct TwoOptionTemplate<T, char> {
6+
int member;
7+
};
8+
9+
10+
template<typename T>
11+
struct TwoOptionTemplate<T, double> {
12+
float member;
13+
};
14+
15+
template<typename T>
16+
struct TwoOptionTemplate<T, T> {
17+
T** member;
18+
};
19+
20+
TwoOptionTemplate<int, char> X0;
21+
TwoOptionTemplate<int, float> X1;
22+
TwoOptionTemplate<void *, wchar_t> X2;
23+
TwoOptionTemplate<long, long> X3;
24+
TwoOptionTemplate<float, float> X4;
25+
TwoOptionTemplate<long, long> SingleSource;
26+
TwoOptionTemplate<char, double> SecondDoubleSource;
27+
28+
29+
template<int I, class C>
30+
struct IntTemplateSpec {};
31+
32+
template<class C>
33+
struct IntTemplateSpec<4, C> {
34+
C member;
35+
};
36+
37+
template<int I>
38+
struct IntTemplateSpec<I, void *> {
39+
int member;
40+
static constexpr int val = I;
41+
};
42+
43+
template<int I>
44+
struct IntTemplateSpec<I, double> {
45+
char member;
46+
static constexpr int val = I;
47+
};
48+
49+
IntTemplateSpec<4, wchar_t> Y0;
50+
IntTemplateSpec<5, void *> Y1;
51+
IntTemplateSpec<1, long> Y2;
52+
IntTemplateSpec<3, int> Y3;
53+
//template<int I> constexpr int IntTemplateSpec<I, double>::val;
54+
IntTemplateSpec<42, double> NumberSource;
55+
static_assert(NumberSource.val == 42);
56+
57+
namespace One {
58+
namespace Two {
59+
// Just an empty namespace to ensure we can deal with multiple namespace decls.
60+
}
61+
}
62+
63+
64+
namespace One {
65+
namespace Two {
66+
namespace Three {
67+
68+
template<class T>
69+
class Parent {};
70+
71+
} // namespace Three
72+
73+
} // namespace Two
74+
75+
template<typename T, typename X>
76+
struct Child1: public Two::Three::Parent<unsigned> {
77+
char member;
78+
};
79+
80+
template<class T>
81+
struct Child1<T, One::Two::Three::Parent<T>> {
82+
T member;
83+
};
84+
85+
} // namespace One
86+
87+
One::Child1<int, double> Z0Source;
88+
89+
// Test import of nested namespace specifiers
90+
template<typename T>
91+
struct Outer {
92+
template<typename U> class Inner0;
93+
};
94+
95+
template<typename X>
96+
template<typename Y>
97+
class Outer<X>::Inner0 {
98+
public:
99+
void f(X, Y);
100+
template<typename Z> struct Inner1;
101+
};
102+
103+
template<typename X>
104+
template<typename Y>
105+
void Outer<X>::Inner0<Y>::f(X, Y) {}
106+
107+
template<typename X>
108+
template<typename Y>
109+
template<typename Z>
110+
class Outer<X>::Inner0<Y>::Inner1 {
111+
public:
112+
void f(Y, Z);
113+
};
114+
115+
template<typename X>
116+
template<typename Y>
117+
template<typename Z>
118+
void Outer<X>::Inner0<Y>::Inner1<Z>::f(Y, Z) {}
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
template<typename T, typename P>
2+
struct TwoOptionTemplate {};
3+
4+
template<typename T>
5+
struct TwoOptionTemplate<T, char> {
6+
int member;
7+
};
8+
9+
10+
template<typename T>
11+
struct TwoOptionTemplate<T, double> {
12+
float member;
13+
};
14+
15+
template<typename T>
16+
struct TwoOptionTemplate<T, T> {
17+
T** member;
18+
};
19+
20+
TwoOptionTemplate<int, char> X0;
21+
TwoOptionTemplate<int, double> X1;
22+
TwoOptionTemplate<void *, wchar_t> X2;
23+
TwoOptionTemplate<long, long> X3;
24+
TwoOptionTemplate<int, int> X4;
25+
TwoOptionTemplate<long, long> SingleDest;
26+
TwoOptionTemplate<int, double> SecondDoubleDest;
27+
28+
29+
template<int I, class C>
30+
struct IntTemplateSpec {};
31+
32+
template<class C>
33+
struct IntTemplateSpec<4, C> {
34+
C member;
35+
};
36+
37+
template<int I>
38+
struct IntTemplateSpec<I, void *> {
39+
double member;
40+
static constexpr int val = I;
41+
};
42+
43+
template<int I>
44+
struct IntTemplateSpec<I, double> {
45+
char member;
46+
static constexpr int val = I;
47+
};
48+
49+
IntTemplateSpec<4, wchar_t>Y0;
50+
IntTemplateSpec<5, void *> Y1;
51+
IntTemplateSpec<1, int> Y2;
52+
IntTemplateSpec<2, int> Y3;
53+
IntTemplateSpec<43, double> NumberDest;
54+
55+
namespace One {
56+
namespace Two {
57+
namespace Three {
58+
59+
template<class T>
60+
class Parent {};
61+
62+
} // namespace Three
63+
64+
} // namespace Two
65+
66+
template<typename T, typename X>
67+
struct Child1: public Two::Three::Parent<unsigned> {
68+
char member;
69+
};
70+
71+
template<class T>
72+
struct Child1<T, One::Two::Three::Parent<T>> {
73+
T member;
74+
};
75+
76+
} // namespace One
77+
78+
namespace Dst { One::Child1<double, One::Two::Three::Parent<double>> Z0Dst; }
79+
One::Child1<int, float> Z1;
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// FIXME: Errors are now warnings.
2+
// XFAIL: *
3+
// RUN: %clang_cc1 -emit-pch -std=c++1z -o %t.1.ast %S/Inputs/class-template-partial-spec1.cpp
4+
// RUN: %clang_cc1 -emit-pch -std=c++1z -o %t.2.ast %S/Inputs/class-template-partial-spec2.cpp
5+
// RUN: not %clang_cc1 -std=c++1z -ast-merge %t.1.ast -ast-merge %t.2.ast -fsyntax-only %s 2>&1 | FileCheck %s
6+
7+
static_assert(sizeof(**SingleSource.member) == sizeof(**SingleDest.member));
8+
static_assert(sizeof(SecondDoubleSource.member) == sizeof(SecondDoubleDest.member));
9+
static_assert(NumberSource.val == 42);
10+
static_assert(sizeof(Z0Source.member) == sizeof(char));
11+
static_assert(sizeof(Dst::Z0Dst.member) == sizeof(double));
12+
static_assert(sizeof(One::Child1<double, One::Two::Three::Parent<double>>::member) == sizeof(double));
13+
14+
// CHECK: class-template-partial-spec2.cpp:21:32: error: external variable 'X1' declared with incompatible types in different translation units ('TwoOptionTemplate<int, double>' vs. 'TwoOptionTemplate<int, float>')
15+
// CHECK: class-template-partial-spec1.cpp:21:31: note: declared here with type 'TwoOptionTemplate<int, float>'
16+
17+
// CHECK: class-template-partial-spec2.cpp:24:29: error: external variable 'X4' declared with incompatible types in different translation units ('TwoOptionTemplate<int, int>' vs. 'TwoOptionTemplate<float, float>')
18+
// CHECK: class-template-partial-spec1.cpp:24:33: note: declared here with type 'TwoOptionTemplate<float, float>'
19+
20+
// CHECK: class-template-partial-spec1.cpp:38:8: warning: type 'IntTemplateSpec<5, void *>' has incompatible definitions in different translation units
21+
// CHECK: class-template-partial-spec1.cpp:39:7: note: field 'member' has type 'int' here
22+
// CHECK: class-template-partial-spec2.cpp:39:10: note: field 'member' has type 'double' here
23+
24+
// CHECK: class-template-partial-spec2.cpp:52:25: error: external variable 'Y3' declared with incompatible types in different translation units ('IntTemplateSpec<2, int>' vs. 'IntTemplateSpec<3, int>')
25+
// CHECK: class-template-partial-spec1.cpp:52:25: note: declared here with type 'IntTemplateSpec<3, int>'
26+
27+
// CHECK-NOT: static_assert

0 commit comments

Comments
 (0)