[llvm-branch-commits] [clang] 7d8d30d - [Clang][NFC] Added testcase from #49549
Dávid Bolvanský via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Mon Jan 31 14:44:29 PST 2022
Author: Dávid Bolvanský
Date: 2022-01-31T23:43:36+01:00
New Revision: 7d8d30d6d3ddb37230a519bf4ee8144a547e4195
URL: https://github.com/llvm/llvm-project/commit/7d8d30d6d3ddb37230a519bf4ee8144a547e4195
DIFF: https://github.com/llvm/llvm-project/commit/7d8d30d6d3ddb37230a519bf4ee8144a547e4195.diff
LOG: [Clang][NFC] Added testcase from #49549
The issue is fixed in trunk, so add testcase to avoid regression in the future.
Added:
Modified:
clang/test/SemaCXX/attr-likelihood.cpp
Removed:
################################################################################
diff --git a/clang/test/SemaCXX/attr-likelihood.cpp b/clang/test/SemaCXX/attr-likelihood.cpp
index f7503fed49b93..642d62fa89826 100644
--- a/clang/test/SemaCXX/attr-likelihood.cpp
+++ b/clang/test/SemaCXX/attr-likelihood.cpp
@@ -159,4 +159,18 @@ constexpr int constexpr_function() {
[[likely]] return 0;
}
static_assert(constexpr_function() == 0);
+
+constexpr double pow(double x, long long n) noexcept {
+ if (n > 0) [[likely]]
+ return x * pow(x, n - 1);
+ else [[unlikely]]
+ return 1;
+}
+constexpr long long fact(long long n) noexcept {
+ if (n > 1) [[likely]]
+ return n * fact(n - 1);
+ else [[unlikely]]
+ return 1;
+}
+
#endif
More information about the llvm-branch-commits
mailing list