Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/ReleaseNotes.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ line upon naming the release. Refer to previous for appropriate section names.
- Fixed members following a merged bitfield reading the wrong value when a
struct is flat-converted
[#8526](https://github.com/microsoft/DirectXShaderCompiler/issues/8526).
- Fixed a C++26 compilation error in `llvm::sys::TimeValue` due to arithmetic on unscoped enumeration `NANOSECONDS_PER_SECOND`
[#8992](https://github.com/microsoft/DirectXShaderCompiler/issues/8992).

### Upcoming Preview Release

Expand Down
5 changes: 3 additions & 2 deletions include/llvm/Support/TimeValue.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,9 @@ namespace sys {
: seconds_( 0 ) , nanos_ ( 0 ) {
SecondsType integer_part = static_cast<SecondsType>( new_time );
seconds_ = integer_part;
nanos_ = static_cast<NanoSecondsType>( (new_time -
static_cast<double>(integer_part)) * NANOSECONDS_PER_SECOND );
nanos_ = static_cast<NanoSecondsType>(
(new_time - static_cast<double>(integer_part)) *
static_cast<double>(NANOSECONDS_PER_SECOND));

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added release note to docs/ReleaseNotes.md under ### Upcoming Release -> #### Bug Fixes.

Comment on lines +110 to +112

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a unit test in unittests/Support/TimeValueTest.cpp covering the sys::TimeValue(double) constructor. As noted in CONTRIBUTING.md:145-157 regarding changes for external projects and test infrastructure limitations, DXC's host build environment and test suite compile in C++14/C++17 across all CI runners and do not provide a Clang 22 / -std=c++26 toolchain to run compile-only C++26 tests directly in CI.

this->normalize();
}

Expand Down
5 changes: 5 additions & 0 deletions unittests/Support/TimeValueTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,9 @@ TEST(TimeValue, Win32FILETIME) {
EXPECT_EQ(ft1970, epoch.toWin32Time());
}

TEST(TimeValue, DoubleConstructor) {
sys::TimeValue tv(1234.5);
EXPECT_EQ(1234, tv.seconds());
EXPECT_EQ(500000000u, static_cast<uint32_t>(tv.nanoseconds()));
}
}