microsoft / microsoft/DirectXShaderCompiler
dxc downstream change to StringRef.h causes clang warning
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 3.7k
- Forks
- 900
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 44
Description
Description
When compiling this line https://github.com/microsoft/DirectXShaderCompiler/blob/main/include/llvm/ADT/StringRef.h#L577 in Chromium with a libc++ that has https://github.com/llvm/llvm-project/pull/118167, we get the following compiler diagnostic:
FAILED: 15371519-e5ab-417b-87d7-def1293a582d "./obj/third_party/dawn/third_party/gn/dxc/Support/Locale.obj" CXX obj/third_party/dawn/third_party/gn/dxc/Support/Locale.obj
err: exit=1
"C:/b/s/w/ir/cipd_bin_packages/cpython3/bin/python3.exe" ../../build/toolchain/clang_code_coverage_wrapper.py --target-os=win --files-to-instrument=../../.code-coverage/files_to_instrument.txt ..\..\third_party\llvm-build\Release+Asserts\bin\clang-cl.exe /c ../../third_party/dawn/third_party/dxc/lib/Support/Locale.cpp /Foobj/third_party/dawn/third_party/gn/dxc/Support/Locale.obj /nologo /showIncludes:user /winsysroot../../third_party/depot_tools/win_toolchain/vs_files/7393122652 -DLLVM_ASSERTIONS_NO_STRINGS -DLLVM_ASSERTIONS_TRAP -DDCHECK_ALWAYS_ON=1 -DUSE_AURA=1 "-DCR_CLANG_REVISION=\"llvmorg-20-init-17108-g29ed6000-3\"" -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE -D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS -D_LIBCPP_INSTRUMENTED_WITH_ASAN=0 -DCR_LIBCXX_REVISION=40d7dfa609a8f4936740ffd2b0b0469e732feda5 -DTMP_REBUILD_HACK -D__STD_C -D_CRT_RAND_S -D_CRT_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_DEPRECATE -D_ATL_NO_OPENGL -D_WINDOWS -DCERT_CHAIN_PARA_HAS_EXTRA_FIELDS -DPSAPI_VERSION=2 -DWIN32 -D_SECURE_ATL -DWINAPI_FAMILY=WINAPI_FAMILY_DESKTOP_APP -DWIN32_LEAN_AND_MEAN -DNOMINMAX -DNTDDI_VERSION=NTDDI_WIN10_NI -D_WIN32_WINNT=0x0A00 -DWINVER=0x0A00 -D_CRT_NONSTDC_NO_WARNINGS -D_WINSOCK_DEPRECATED_NO_WARNINGS -I../.. -Igen -I../../buildtools/third_party/libc++ -I../../third_party/dawn/third_party/dxc/include -I../../third_party/dawn/third_party/dxc/tools/clang/include -I../../third_party/dawn/third_party/dxc/tools/clang/tools -Igen/third_party/dawn/third_party/gn/dxc/include -I../../third_party/dawn/third_party/dxc/include/llvm/llvm_assert -fno-delete-null-pointer-checks /clang:-fwrapv -fno-ident -fcolor-diagnostics -fmerge-all-constants /Zc:sizedDealloc- -fcrash-diagnostics-dir=../../tools/clang/crashreports -mllvm -instcombine-lower-dbg-declare=0 -mllvm -split-threshold-for-reg-with-hint=0 /clang:-ffp-contract=off -fcomplete-member-pointers /Gy /FS /bigobj /utf-8 /Zc:twoPhase -ffile-reproducible /Zc:sizedDealloc- /D__WRL_ENABLE_FUNCTION_STATICS__ -fmsc-version=1934 -m64 -msse3 /Brepro -Wno-builtin-macro-redefined -D__DATE__= -D__TIME__= -D__TIMESTAMP__= -ffile-compilation-dir=. -no-canonical-prefixes -ftrivial-auto-var-init=pattern /O2 /clang:-O2 /Oy- /Zc:inline /Gw /clang:-fno-math-errno -fprofile-instr-generate -fcoverage-mapping -mllvm -runtime-counter-relocation=true -mllvm -limited-coverage-experimental=true /guard:cf /MT -Wheader-hygiene -Wstring-conversion -Wtautological-overlap-compare -Xclang -add-plugin -Xclang find-bad-constructs -Xclang -plugin-arg-find-bad-constructs -Xclang span-ctor-from-string-literal -Xclang -plugin-arg-find-bad-constructs -Xclang raw-ref-template-as-trivial-member -Xclang -plugin-arg-find-bad-constructs -Xclang raw-span-template-as-trivial-member -Xclang -plugin-arg-find-bad-constructs -Xclang check-stack-allocated -Xclang -add-plugin -Xclang raw-ptr-plugin -Xclang -plugin-arg-raw-ptr-plugin -Xclang check-raw-ptr-to-stack-allocated -Xclang -plugin-arg-raw-ptr-plugin -Xclang disable-check-raw-ptr-to-stack-allocated-error -Xclang -plugin-arg-raw-ptr-plugin -Xclang raw-ptr-exclude-path=../../third_party/dawn/ -Xclang -plugin-arg-raw-ptr-plugin -Xclang check-raw-ptr-fields -Xclang -plugin-arg-raw-ptr-plugin -Xclang check-span-fields -Xclang -plugin-arg-raw-ptr-plugin -Xclang check-raw-ref-fields -DUNSAFE_BUFFERS_BUILD -Xclang -add-plugin -Xclang unsafe-buffers -Xclang -plugin-arg-unsafe-buffers -Xclang ../../build/config/unsafe_buffers_paths.txt /W3 /wd4800 /wd4267 -Wno-unused-variable -Wno-c++11-narrowing -Wno-unused-but-set-variable -Wno-misleading-indentation -Wno-missing-field-initializers -Wno-unused-parameter -Wno-psabi -Wloop-analysis -Wno-unneeded-internal-declaration -Wno-nonportable-include-path -Wno-cast-function-type -Wno-thread-safety-reference-return -Wno-nontrivial-memcall /WX /std:c++20 -Wno-trigraphs /TP /GR- -I../../third_party/libc++/src/include -Wno-invalid-offsetof -Wenum-compare-conditional -Wno-c++11-narrowing-const-reference -Wno-missing-template-arg-list-after-template-kw -Wno-dangling-assignment-gsl /EHsc /Zc:__cplusplus /Zc:sizedDealloc- -Wno-error -Wno-unknown-pragmas -Wno-shadow -Wno-deprecated-declarations -Wno-deprecated-enum-float-conversion -Wno-extra-semi -Wno-reorder-ctor -Wno-implicit-fallthrough -Wno-header-hygiene -Wno-unused-const-variable -Wno-implicit-fallthrough -Wno-sign-compare -Wno-unused-but-set-variable -Wno-unreachable-code-return -Wno-unreachable-code-break -Wno-unused-function -Wno-unused-local-typedef -Wno-string-conversion -Wno-macro-redefined -Wno-unreachable-code -Wno-switch -Wno-constant-logical-operand -Wno-microsoft-exception-spec -Wno-inconsistent-missing-override -Wno-enum-compare-conditional -Wno-rtti -Wno-microsoft-extra-qualification -Wno-range-loop-bind-reference -Wno-pessimizing-move -Wno-unused-lambda-capture -Wno-bool-conversion -Wno-enum-compare -Wno-deprecated-copy -Wno-unused-variable -Wno-microsoft-template -Wno-unused-private-field -Wno-deprecated-enum-enum-conversion -Wno-deprecated-anon-enum-enum-conversion -Wno-ambiguous-reversed-operator /Fd"obj/third_party/dawn/third_party/gn/dxc/Support_cc.pdb"
build step: cxx "./obj/third_party/dawn/third_party/gn/dxc/Support/Locale.obj"
siso_rule: clang-coverage/cxx
stderr:
In file included from ../../third_party/dawn/third_party/dxc/lib/Support/Locale.cpp:2:
In file included from ../../third_party/dawn/third_party/dxc/include\llvm/Support/Locale.h:5:
../../third_party/dawn/third_party/dxc/include\llvm/ADT/StringRef.h(579,10): error: 'is_nothrow_constructible' cannot be specialized: Users are not allowed to specialize this standard library entity [-Winvalid-specialization]
579 | struct is_nothrow_constructible <std::string, llvm::StringRef>
| ^
../../third_party/libc++/src/include\__type_traits/is_nothrow_constructible.h(24,29): note: marked 'no_specializations' here
24 | struct _LIBCPP_TEMPLATE_VIS _LIBCPP_NO_SPECIALIZATIONS is_nothrow_constructible
| ^
Steps to Reproduce
Build with a recent libc++.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with include/llvm/ADT/StringRef.h around line 577 and compare the specialization with the libc++ diagnostic shown in the report. Reproduce the failure by building with a recent libc++; done means the affected code builds without the is_nothrow_constructible specialization warning or error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100