-
Notifications
You must be signed in to change notification settings - Fork 12.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SystemZ][z/OS] This change adds support for the PPA2 section in zOS #65407
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Please note the following: | ||
// + we are checking that the first bytes of the PPA2 are 0x3 0x0 | ||
// for C, and 0x3 0x1 for C++ | ||
// + the label for the PPA2 seems to vary on different versions. | ||
// We try to cover all cases, and use substitution blocks to | ||
// help write the tests. The contents of the PPA2 itself should | ||
// not be different. | ||
// + the [[:space:]] combines the two .byte lines into one pattern. | ||
// This is necessary because if the lines were separated, the first | ||
// .byte (i.e., the one for the 3) would, it seems, also match | ||
// the .byte line below for the 34. | ||
|
||
// RUN: %clang --target=s390x-ibm-zos -xc -S -o - %s | FileCheck %s --check-prefix CHECK-C | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use |
||
// CHECK-C: [[PPA2:(.L)|(@@)PPA2]]: | ||
// CHECK-C-NEXT: .byte 3{{[[:space:]]*}}.byte 0 | ||
// CHECK-C-NEXT: .byte 34{{$}} | ||
// CHECK-C-NEXT: .byte {{4}} | ||
// CHECK-C-NEXT: .long {{(CELQSTRT)}}-[[PPA2]] | ||
|
||
// RUN: %clang --target=s390x-ibm-zos -xc++ -S -o - %s | FileCheck %s --check-prefix CHECK-CXX | ||
// CHECK-CXX: [[PPA2:(.L)|(@@)PPA2]]: | ||
// CHECK-CXX-NEXT: .byte 3{{[[:space:]]*}}.byte 1 | ||
// CHECK-CXX-NEXT: .byte 34{{$}} | ||
// CHECK-CXX-NEXT: .byte {{4}} | ||
// CHECK-CXX-NEXT: .long {{(CELQSTRT)}}-[[PPA2]] |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,13 +33,33 @@ namespace sys { | |
template <typename D = std::chrono::nanoseconds> | ||
using TimePoint = std::chrono::time_point<std::chrono::system_clock, D>; | ||
|
||
// utc_clock and utc_time are only available since C++20. Add enough code to | ||
// support formatting date/time in UTC. | ||
class UtcClock : public std::chrono::system_clock {}; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This Support change needs to be split from this patch with a unittest in llvm/unittest/Support. Many people will think this z/OS patch is unrelated to them. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I created a new PR for the UTC clock changes here: #67846 |
||
|
||
template <typename D = std::chrono::nanoseconds> | ||
using UtcTime = std::chrono::time_point<UtcClock, D>; | ||
|
||
/// Convert a std::time_t to a UtcTime | ||
inline UtcTime<std::chrono::seconds> toUtcTime(std::time_t T) { | ||
using namespace std::chrono; | ||
return UtcTime<seconds>(seconds(T)); | ||
} | ||
|
||
/// Convert a TimePoint to std::time_t | ||
inline std::time_t toTimeT(TimePoint<> TP) { | ||
using namespace std::chrono; | ||
return system_clock::to_time_t( | ||
time_point_cast<system_clock::time_point::duration>(TP)); | ||
} | ||
|
||
/// Convert a UtcTime to std::time_t | ||
inline std::time_t toTimeT(UtcTime<> TP) { | ||
using namespace std::chrono; | ||
return system_clock::to_time_t(time_point<system_clock, seconds>( | ||
duration_cast<seconds>(TP.time_since_epoch()))); | ||
} | ||
|
||
/// Convert a std::time_t to a TimePoint | ||
inline TimePoint<std::chrono::seconds> | ||
toTimePoint(std::time_t T) { | ||
|
@@ -58,6 +78,7 @@ toTimePoint(std::time_t T, uint32_t nsec) { | |
} // namespace sys | ||
|
||
raw_ostream &operator<<(raw_ostream &OS, sys::TimePoint<> TP); | ||
raw_ostream &operator<<(raw_ostream &OS, sys::UtcTime<> TP); | ||
|
||
/// Format provider for TimePoint<> | ||
/// | ||
|
@@ -73,6 +94,11 @@ struct format_provider<sys::TimePoint<>> { | |
StringRef Style); | ||
}; | ||
|
||
template <> struct format_provider<sys::UtcTime<std::chrono::seconds>> { | ||
static void format(const sys::UtcTime<std::chrono::seconds> &TP, | ||
llvm::raw_ostream &OS, StringRef Style); | ||
}; | ||
|
||
namespace detail { | ||
template <typename Period> struct unit { static const char value[]; }; | ||
template <typename Period> const char unit<Period>::value[] = ""; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
languageToString
? This file correctly usesfunctionName
unlike many other Clang files...