[all-commits] [llvm/llvm-project] e5f712: Disable constexpr function body checking in more s...
Aaron Ballman via All-commits
all-commits at lists.llvm.org
Tue Jun 4 10:32:33 PDT 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: e5f7123dfef3a80937d088d846ddb3b2bb1869b9
https://github.com/llvm/llvm-project/commit/e5f7123dfef3a80937d088d846ddb3b2bb1869b9
Author: Aaron Ballman <aaron at aaronballman.com>
Date: 2024-06-04 (Tue, 04 Jun 2024)
Changed paths:
M clang/docs/ReleaseNotes.rst
M clang/include/clang/Basic/LangOptions.def
M clang/include/clang/Driver/Options.td
M clang/lib/Frontend/CompilerInvocation.cpp
M clang/lib/Sema/SemaDeclCXX.cpp
A clang/test/SemaCXX/constexpr-never-constant.cpp
Log Message:
-----------
Disable constexpr function body checking in more situations (#94347)
Before C++23, we would check a constexpr function body to diagnose if
the function can never be evaluated in a constant expression context.
This was previously required standards behavior, but C++23 relaxed the
restrictions with P2448R2. While this checking is useful, it is also
quite expensive, especially in pathological cases (see #92924 for an
example), because it means the mere presence of a constexpr function
definition will require constant evaluation even if the function is not
used within the TU.
Clang suppresses diagnostics in system headers by default and system
headers (like STL implementations) can be full of constexpr function
bodies. Now we suppress the check for a diagnostic if the function
definition is in a system header or if the `-Winvalid-constexpr`
diagnostic is disabled. This should have some mild compile time
performance improvements.
Also, the previous implementation would disable the diagnostic in C++23
mode entirely. Due to the benefit of the check, this patch now makes it
possible to enable the diagnostic explicitly in C++23 mode.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list