Currently CUDA/HIP defines their own language standards in LanguageStandards.def but they are redundant. They are the same as stdc++14. The fact that CUDA/HIP uses c++* in option -std= indicates that they have the same language standards as C++. The CUDA/HIP specific language features are conveyed through language options, not language standards features. It makes sense to let CUDA/HIP uses the same default language standard as C++.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
We should probably update documentation that C++ standard version for CUDA/HIP compilation now matches C++ default instead of previously used c++14.
Hi @yaxunl, your change appears to have broken the LLDB build. Can you take a look and revert if you time to investigate?
https://lab.llvm.org/buildbot/#/builders/243/builds/9581
FAILED: tools/lldb/source/Plugins/TypeSystem/Clang/CMakeFiles/lldbPluginTypeSystemClang.dir/TypeSystemClang.cpp.o /opt/ccache/bin/g++ -DGTEST_HAS_RTTI=0 -DHAVE_ROUND -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D_LIBCPP_ENABLE_ASSERTIONS -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/build/tools/lldb/source/Plugins/TypeSystem/Clang -I/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/lldb/source/Plugins/TypeSystem/Clang -I/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/lldb/include -I/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/build/tools/lldb/include -I/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/build/include -I/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/llvm/include -I/usr/include/python3.10 -I/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/llvm/../clang/include -I/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/build/tools/lldb/../clang/include -I/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/lldb/source -I/home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/build/tools/lldb/source -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -fno-lifetime-dse -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-maybe-uninitialized -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -Wno-deprecated-declarations -Wno-unknown-pragmas -Wno-strict-aliasing -Wno-stringop-truncation -O3 -DNDEBUG -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -std=c++17 -MD -MT tools/lldb/source/Plugins/TypeSystem/Clang/CMakeFiles/lldbPluginTypeSystemClang.dir/TypeSystemClang.cpp.o -MF tools/lldb/source/Plugins/TypeSystem/Clang/CMakeFiles/lldbPluginTypeSystemClang.dir/TypeSystemClang.cpp.o.d -o tools/lldb/source/Plugins/TypeSystem/Clang/CMakeFiles/lldbPluginTypeSystemClang.dir/TypeSystemClang.cpp.o -c /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp: In function ‘void ParseLangArgs(clang::LangOptions&, clang::InputKind, const char*)’: /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp:489:31: error: ‘lang_cuda’ is not a member of ‘clang::LangStandard’ 489 | LangStd = LangStandard::lang_cuda; | ^~~~~~~~~ /home/buildbot/buildbot-root/cross-project-tests-sie-ubuntu-dwarf5/llvm-project/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp:501:31: error: ‘lang_hip’ is not a member of ‘clang::LangStandard’ 501 | LangStd = LangStandard::lang_hip; | ^~~~~~~~
Other failing buildbots:
This change to lang-std.cpp causes it not to verify _which_ language standard is the default. It only verifies that cuda and hip don't _change_ it.
If you run FileCheck on one of those output files, it would preserve that property.
It is intentional since we just want to make sure CUDA/HIP uses the same default language standard as C++. We do not want to update the test when C++ changes its default language standard.
I agree you don't want to change the CUDA/HIP part. But we do want to preserve the check for what the actual default is. That was the purpose when the test was introduced in D131465. As it stands, there is no test for the actual default; you have repurposed the test from "check language standard defaults" to "check that CUDA/HIP don't affect the default" and that's losing test coverage.
If you want to extract the CUDA/HIP part into a separate test, that's fine. But please don't lose the coverage that we had.
Sorry, I misunderstood the purpose of this test. I will add the check back and create a review for that. Thanks.