Skip to content

NFC: Enable assertions for debug builds #7507

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

Closed
wants to merge 1 commit into from

Conversation

tex3d
Copy link
Contributor

@tex3d tex3d commented Jun 3, 2025

This change enables assertions for debug builds. LLVM_ENABLE_ASSERTIONS must be enabled explicitly, even for Debug builds, otherwise, it will set NDEBUG, which disables assertions.

@llvm-beanz
Copy link
Collaborator

We do default this On for Debug builds: https://github.com/microsoft/DirectXShaderCompiler/blob/main/CMakeLists.txt#L313

Do you know why that isn't working? Seems like we should understand that problem rather than changing the pipelines to work around a potentially bigger issue.

@tex3d
Copy link
Contributor Author

tex3d commented Jun 4, 2025

This change enables assertions for debug builds. LLVM_ENABLE_ASSERTIONS must be enabled explicitly, even for Debug builds, otherwise, it will set NDEBUG, which disables assertions.

Thanks @llvm-beanz - you're right.

I was thinking that the asserts were disabled when I it looked like something should have asserted in the pipeline, and I saw the code in HandleLLVMOptions.cmake, not realizing LLVM_ENABLE_ASSERTIONS was separately set based on debug build type in CMakeLists.txt.

@tex3d tex3d closed this Jun 4, 2025
@github-project-automation github-project-automation bot moved this from New to Done in HLSL Roadmap Jun 4, 2025
@tex3d tex3d deleted the enable-assertions-debug branch June 4, 2025 17:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants