mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-28 21:16: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
116 lines
1.8 KiB
C
116 lines
1.8 KiB
C
// RUN: %clang_cc1 -emit-llvm-only %s
|
|
|
|
int main(void)
|
|
{
|
|
double _Complex a = 5;
|
|
double _Complex b = 42;
|
|
|
|
return a * b != b * a;
|
|
}
|
|
|
|
_Complex double bar(int);
|
|
void test(_Complex double*);
|
|
void takecomplex(_Complex double);
|
|
|
|
void test2(int c) {
|
|
_Complex double X;
|
|
X = bar(1);
|
|
test(&X);
|
|
takecomplex(X);
|
|
}
|
|
|
|
_Complex double g1, g2;
|
|
_Complex float cf;
|
|
double D;
|
|
|
|
void test3(void) {
|
|
g1 = g1 + g2;
|
|
g1 = g1 - g2;
|
|
g1 = g1 * g2;
|
|
g1 = +-~g1;
|
|
|
|
double Gr = __real g1;
|
|
|
|
cf += D;
|
|
D += cf;
|
|
cf /= g1;
|
|
g1 = g1 + D;
|
|
g1 = D + g1;
|
|
}
|
|
|
|
__complex__ int ci1, ci2;
|
|
__complex__ short cs;
|
|
int i;
|
|
void test3int(void) {
|
|
ci1 = ci1 + ci2;
|
|
ci1 = ci1 - ci2;
|
|
ci1 = ci1 * ci2;
|
|
ci1 = +-~ci1;
|
|
|
|
i = __real ci1;
|
|
|
|
cs += i;
|
|
D += cf;
|
|
cs /= ci1;
|
|
ci1 = ci1 + i;
|
|
ci1 = i + ci1;
|
|
}
|
|
|
|
void t1(void) {
|
|
(__real__ cf) = 4.0;
|
|
}
|
|
|
|
void t2(void) {
|
|
(__imag__ cf) = 4.0;
|
|
}
|
|
|
|
// PR1960
|
|
void t3(void) {
|
|
__complex__ long long v = 2;
|
|
}
|
|
|
|
// PR3131
|
|
float _Complex t4(void);
|
|
|
|
void t5(void) {
|
|
float _Complex x = t4();
|
|
}
|
|
|
|
void t6(void) {
|
|
g1++;
|
|
g1--;
|
|
++g1;
|
|
--g1;
|
|
ci1++;
|
|
ci1--;
|
|
++ci1;
|
|
--ci1;
|
|
}
|
|
|
|
double t7(double _Complex c) {
|
|
return __builtin_fabs(__real__(c));
|
|
}
|
|
|
|
void t8(void) {
|
|
__complex__ int *x = &(__complex__ int){1};
|
|
}
|
|
|
|
const _Complex double test9const = 0;
|
|
_Complex double test9func(void) { return test9const; }
|
|
|
|
// D6217
|
|
void t91(void) {
|
|
// Check for proper type promotion of conditional expression
|
|
char c[(int)(sizeof(typeof((0 ? 2.0f : (_Complex double) 2.0f))) - sizeof(_Complex double))];
|
|
// Check for proper codegen
|
|
(0 ? 2.0f : (_Complex double) 2.0f);
|
|
}
|
|
|
|
void t92(void) {
|
|
// Check for proper type promotion of conditional expression
|
|
char c[(int)(sizeof(typeof((0 ? (_Complex double) 2.0f : 2.0f))) - sizeof(_Complex double))];
|
|
// Check for proper codegen
|
|
(0 ? (_Complex double) 2.0f : 2.0f);
|
|
}
|
|
|