[clang] 623b66e - [Clang][NFC] Added testcase from #49549

Dávid Bolvanský via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 31 14:46:02 PST 2022


Author: Dávid Bolvanský
Date: 2022-01-31T23:45:56+01:00
New Revision: 623b66eded4b1ab2fbb962d3841899458bac6693

URL: https://github.com/llvm/llvm-project/commit/623b66eded4b1ab2fbb962d3841899458bac6693
DIFF: https://github.com/llvm/llvm-project/commit/623b66eded4b1ab2fbb962d3841899458bac6693.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 cfe-commits mailing list