Aaron Ballman 0f1c1be196 [clang] Remove rdar links; NFC
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
2023-08-28 12:13:42 -04:00

125 lines
2.6 KiB
C++

// This is an IR generation test because the calculation of visibility
// during IR gen will cause linkage to be implicitly recomputed and
// compared against the earlier cached value. If we had a way of
// testing linkage directly in Sema, that would be better.
// RUN: %clang_cc1 -Werror -Wno-non-c-typedef-for-linkage -triple x86_64-apple-darwin10 -emit-llvm %s -o - | FileCheck %s
// CHECK: @_ZZN5test61A3fooEvE3bar = linkonce_odr global i32 0, align 4
// PR8926
namespace test0 {
typedef struct {
void *foo() { return 0; }
} A;
// CHECK: define linkonce_odr noundef ptr @_ZN5test01A3fooEv(
void test(A *a) {
a->foo();
}
}
namespace test1 {
typedef struct {
template <unsigned n> void *foo() { return 0; }
void foo() {
foo<0>();
}
} A;
// CHECK: define linkonce_odr void @_ZN5test11A3fooEv(
// another at the end
void test(A *a) {
a->foo();
}
}
namespace test2 {
typedef struct {
template <unsigned n> struct B {
void *foo() { return 0; }
};
void foo(B<0> *b) {
b->foo();
}
} A;
// CHECK: define linkonce_odr void @_ZN5test21A3fooEPNS0_1BILj0EEE(
void test(A *a) {
a->foo(0);
}
}
namespace test3 {
namespace { struct A {}; }
// CHECK: define internal void @_ZN5test34testENS_12_GLOBAL__N_11AE(
void test(A a) {}
void force() { test(A()); }
// CHECK: define{{.*}} void @test3(
extern "C" void test3(A a) {}
}
namespace {
// CHECK: define{{.*}} void @test4(
extern "C" void test4(void) {}
}
// PR9316: Ensure that even non-namespace-scope function declarations in
// a C declaration context respect that over the anonymous namespace.
extern "C" {
namespace {
struct X {
int f() {
extern int g();
extern int a;
// Test both for mangling in the code generation and warnings from use
// of internal, undefined names via -Werror.
// CHECK: call i32 @g(
// CHECK: load i32, ptr @a,
return g() + a;
}
};
}
// Force the above function to be emitted by codegen.
int test(X& x) {
return x.f();
}
}
// CHECK: define linkonce_odr noundef ptr @_ZN5test11A3fooILj0EEEPvv(
// CHECK: define linkonce_odr noundef ptr @_ZN5test21A1BILj0EE3fooEv(
namespace test5 {
struct foo {
};
extern "C" {
const foo bar[] = {
};
}
}
// Test that we don't compute linkage too hastily before we're done
// processing a record decl.
namespace test6 {
typedef struct {
int foo() {
// Tested at top of file.
static int bar = 0;
return bar++;
}
} A;
void test() {
A a;
a.foo();
}
}