Skip to content
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

User command line defines are duplicated in debug info and in preprocessor #2673

Open
pow2clk opened this issue Jan 30, 2020 · 0 comments · May be fixed by #2675
Open

User command line defines are duplicated in debug info and in preprocessor #2673

pow2clk opened this issue Jan 30, 2020 · 0 comments · May be fixed by #2675
Assignees
Milestone

Comments

@pow2clk
Copy link
Member

pow2clk commented Jan 30, 2020

When invoking dxc with a -D option to define a macro, on the way down the pipe from command line to defines recognized by the preprocessor, they get duplicated in the argument list. This causes them to show up twice in the debug information. They are also applied twice to the preprocessor, but it treats them exactly as if the same define was set twice with the same value and accepts it without complaint.

This can be observed by compiling tools/clang/test/HLSLFileCheck/dxil/debug/misc/share_mem_dbg.hlsl with the dxc invocation stipulated by the RUN: command. The CHECK: like indicates that DefineA and DefineB should show up once. When invoked by the test infrastructure, which skips the initial compile operations found in dxc.cpp, that's what happens, but when invoked directly from the command line, both defines are duplicated:

!71 = !{!"DefineA=1", !"DefineB=0", !"DefineA=1", !"DefineB=0"}

@pow2clk pow2clk self-assigned this Jan 30, 2020
@pow2clk pow2clk changed the title User command line defines are duplicated in debug code and in preprocessor User command line defines are duplicated in debug info and in preprocessor Jan 31, 2020
pow2clk added a commit to pow2clk/DirectXShaderCompiler that referenced this issue Jan 31, 2020
When defines are specified through the command line of dxc using -D
flags, they are added to a vector of defines passed into WrapCompile as
part of the adaptor of the Compiler3 interface to the old interface.
WrapCompile then packages them up into an argument list for the
Compiler3 interface, but since the argument list already contains the
defines, adding them from the define vector duplicates them.

This problem was solved for -E entry points and -T target profiles by
adding optional skipping of these arguments when they are found to be
present by another means. This mechanism is here extended to account for
defines as well.

Fixes microsoft#2673
@pow2clk pow2clk linked a pull request Jan 31, 2020 that will close this issue
@damyanp damyanp moved this to Triaged in HLSL Triage Jun 20, 2024
@damyanp damyanp added this to the Dormant milestone Jun 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Triaged
Development

Successfully merging a pull request may close this issue.

2 participants