
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
60 lines
2.0 KiB
C++
60 lines
2.0 KiB
C++
// RUN: %clang_cc1 -fms-extensions -std=c++11 -E %s -fuse-line-directives | FileCheck %s
|
|
|
|
// Test that we properly expand the C99 _Pragma and Microsoft __pragma
|
|
// into #pragma directives, with newlines where needed.
|
|
|
|
// CHECK: #line
|
|
// CHECK: #pragma warning(push)
|
|
// CHECK: extern "C" {
|
|
// CHECK: #line
|
|
// CHECK: #pragma warning(push)
|
|
// CHECK: int foo() { return 0; } }
|
|
// CHECK: #pragma warning(pop)
|
|
#define A(X) extern "C" { __pragma(warning(push)) \
|
|
int X() { return 0; } \
|
|
}
|
|
#define B(X) A(X)
|
|
#pragma warning(push)
|
|
B(foo)
|
|
#pragma warning(pop)
|
|
|
|
#define pragma_L _Pragma(L"GCC diagnostic push")
|
|
#define pragma_u8 _Pragma(u8"pack(1)")
|
|
#define pragma_u _Pragma(u"GCC diagnostic pop")
|
|
#define pragma_U _Pragma(U"comment(lib, \"libfoo\")")
|
|
#define pragma_R _Pragma(R"(clang diagnostic ignored "-Wunused")")
|
|
#define pragma_UR _Pragma(UR"(clang diagnostic error "-Wunused")")
|
|
#define pragma_hello _Pragma(u8R"x(message R"y("Hello", world!)y")x")
|
|
// CHECK: int n =
|
|
// CHECK: #pragma GCC diagnostic push
|
|
// CHECK: #pragma pack(1)
|
|
// CHECK: #pragma GCC diagnostic pop
|
|
// CHECK: #pragma comment(lib, "libfoo")
|
|
// CHECK: #pragma clang diagnostic ignored "-Wunused"
|
|
// CHECK: #pragma clang diagnostic error "-Wunused"
|
|
// CHECK: #pragma message("\042Hello\042, world!")
|
|
// CHECK: 0;
|
|
int n = pragma_L pragma_u8 pragma_u pragma_U pragma_R pragma_UR pragma_hello 0;
|
|
|
|
#pragma warning(disable : 1 2L 3U ; error : 4 5 6 ; suppress : 7 8 9)
|
|
// CHECK: #pragma warning(disable: 1 2 3)
|
|
// CHECK: #line [[@LINE-2]]
|
|
// CHECK: #pragma warning(error: 4 5 6)
|
|
// CHECK: #line [[@LINE-4]]
|
|
// CHECK: #pragma warning(suppress: 7 8 9)
|
|
|
|
#pragma warning(push)
|
|
#pragma warning(push, 1L)
|
|
#pragma warning(push, 4U)
|
|
#pragma warning(push, 0x1)
|
|
#pragma warning(push, 03)
|
|
#pragma warning(push, 0b10)
|
|
#pragma warning(push, 1i8)
|
|
// CHECK: #pragma warning(push)
|
|
// CHECK: #pragma warning(push, 1)
|
|
// CHECK: #pragma warning(push, 4)
|
|
// CHECK: #pragma warning(push, 1)
|
|
// CHECK: #pragma warning(push, 3)
|
|
// CHECK: #pragma warning(push, 2)
|
|
// CHECK: #pragma warning(push, 1)
|