mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-25 10:46:06 +00:00

We have a new policy in place making links to private resources something we try to avoid in source and test files. Normally, we'd organically switch to the new policy rather than make a sweeping change across a project. However, Clang is in a somewhat special circumstance currently: recently, I've had several new contributors run into rdar links around test code which their patch was changing the behavior of. This turns out to be a surprisingly bad experience, especially for newer folks, for a handful of reasons: not understanding what the link is and feeling intimidated by it, wondering whether their changes are actually breaking something important to a downstream in some way, having to hunt down strangers not involved with the patch to impose on them for help, accidental pressure from asking for potentially private IP to be made public, etc. Because folks run into these links entirely by chance (through fixing bugs or working on new features), there's not really a set of problematic links to focus on -- all of the links have basically the same potential for causing these problems. As a result, this is an omnibus patch to remove all such links. This was not a mechanical change; it was done by manually searching for rdar, radar, radr, and other variants to find all the various problematic links. From there, I tried to retain or reword the surrounding comments so that we would lose as little context as possible. However, because most links were just a plain link with no supporting context, the majority of the changes are simple removals. Differential Review: https://reviews.llvm.org/D158071
109 lines
2.2 KiB
C++
109 lines
2.2 KiB
C++
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o - %s -std=c++11 | FileCheck %s
|
|
|
|
struct A {
|
|
A();
|
|
A(const A&);
|
|
A(A&);
|
|
~A();
|
|
};
|
|
|
|
struct B {
|
|
B();
|
|
B(B&);
|
|
};
|
|
|
|
struct C {
|
|
C() {}
|
|
C(C& other, A a = A());
|
|
int i, j;
|
|
};
|
|
|
|
struct POD {
|
|
int array[3][4];
|
|
};
|
|
|
|
struct D : A, B, virtual C {
|
|
D();
|
|
int scalar;
|
|
int scalar_array[2][3];
|
|
B class_member;
|
|
C class_member_array[2][3];
|
|
POD pod_array[2][3];
|
|
|
|
union {
|
|
int x;
|
|
float f[3];
|
|
};
|
|
};
|
|
|
|
void f(D d) {
|
|
D d2(d);
|
|
}
|
|
|
|
// CHECK-LABEL: define linkonce_odr void @_ZN1DC1ERS_(ptr {{[^,]*}} %this, ptr noundef nonnull align {{[0-9]+}} dereferenceable({{[0-9]+}}) %0) unnamed_addr
|
|
// CHECK: call void @_ZN1AC1Ev
|
|
// CHECK: call void @_ZN1CC2ERS_1A
|
|
// CHECK: call void @_ZN1AD1Ev
|
|
// CHECK: call void @_ZN1AC2ERS_
|
|
// CHECK: call void @_ZN1BC2ERS_
|
|
// CHECK: {{call void @llvm.memcpy.p0.p0.i64.*i64 28}}
|
|
// CHECK: call void @_ZN1BC1ERS_
|
|
// CHECK: br label
|
|
// CHECK: call void @_ZN1AC1Ev
|
|
// CHECK: call void @_ZN1CC1ERS_1A
|
|
// CHECK: call void @_ZN1AD1Ev
|
|
// CHECK: {{icmp eq.*, 3}}
|
|
// CHECK: br i1
|
|
// CHECK: {{icmp eq.*, 2}}
|
|
// CHECK: br i1
|
|
// CHECK: {{call void @llvm.memcpy.p0.p0.i64.*i64 300}}
|
|
// CHECK: ret void
|
|
|
|
|
|
template<class T> struct X0 { void f0(T * ) { } };
|
|
template <class > struct X1 { X1( X1& , int = 0 ) { } };
|
|
struct X2 { X1<int> result; };
|
|
void test_X2()
|
|
{
|
|
typedef X2 impl;
|
|
typedef X0<impl> pimpl;
|
|
impl* i;
|
|
pimpl pdata;
|
|
pdata.f0( new impl(*i));
|
|
}
|
|
|
|
namespace test3 {
|
|
struct A { A(const A&); A&operator=(const A&); };
|
|
struct B { A a; unsigned : 0; };
|
|
void test(const B &x) {
|
|
B y = x;
|
|
y = x;
|
|
}
|
|
}
|
|
|
|
namespace test4 {
|
|
// When determining whether to implement an array copy as a memcpy, look at
|
|
// whether the *selected* constructor is trivial.
|
|
struct S {
|
|
int arr[5][5];
|
|
S(S &);
|
|
S(const S &) = default;
|
|
};
|
|
// CHECK: @_ZN5test42f1
|
|
void f1(S a) {
|
|
// CHECK-NOT: memcpy
|
|
// CHECK: call void @_ZN5test41SC1ERS0_
|
|
// CHECK-NOT: memcpy
|
|
S b(a);
|
|
// CHECK: }
|
|
}
|
|
// CHECK: @_ZN5test42f2
|
|
void f2(const S a) {
|
|
// CHECK-NOT: call void @_ZN5test41SC1ERS0_
|
|
// CHECK: memcpy
|
|
// CHECK-NOT: call void @_ZN5test41SC1ERS0_
|
|
S b(a);
|
|
// CHECK: }
|
|
}
|
|
}
|