aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimm Bäder <tbaeder@redhat.com>2024-02-05 17:32:40 +0100
committerTimm Bäder <tbaeder@redhat.com>2024-02-05 17:33:08 +0100
commit66cd768504b349f7bd16d236a3b4f611ffabf78f (patch)
treec84f485868333aa741007560f869267b50443d87
parentf958ad3b89c38be84dcf263ef9f9508a5cd3a6e3 (diff)
downloadllvm-66cd768504b349f7bd16d236a3b4f611ffabf78f.zip
llvm-66cd768504b349f7bd16d236a3b4f611ffabf78f.tar.gz
llvm-66cd768504b349f7bd16d236a3b4f611ffabf78f.tar.bz2
[clang][Interp] Handle __assume like __builtin_assume.
-rw-r--r--clang/lib/AST/Interp/InterpBuiltin.cpp1
-rw-r--r--clang/test/AST/Interp/builtins.cpp10
2 files changed, 7 insertions, 4 deletions
diff --git a/clang/lib/AST/Interp/InterpBuiltin.cpp b/clang/lib/AST/Interp/InterpBuiltin.cpp
index 280aa393..5976d4c 100644
--- a/clang/lib/AST/Interp/InterpBuiltin.cpp
+++ b/clang/lib/AST/Interp/InterpBuiltin.cpp
@@ -660,6 +660,7 @@ bool InterpretBuiltin(InterpState &S, CodePtr OpPC, const Function *F,
S.Stk.push<Boolean>(Boolean::from(S.inConstantContext()));
break;
case Builtin::BI__builtin_assume:
+ case Builtin::BI__assume:
break;
case Builtin::BI__builtin_strcmp:
if (!interp__builtin_strcmp(S, OpPC, Frame))
diff --git a/clang/test/AST/Interp/builtins.cpp b/clang/test/AST/Interp/builtins.cpp
index 5e2ffe5..06a22b1 100644
--- a/clang/test/AST/Interp/builtins.cpp
+++ b/clang/test/AST/Interp/builtins.cpp
@@ -1,7 +1,7 @@
-// RUN: %clang_cc1 -fexperimental-new-constant-interpreter %s -verify
-// RUN: %clang_cc1 -fexperimental-new-constant-interpreter %s -S -emit-llvm -o - | FileCheck %s
-// RUN: %clang_cc1 -verify=ref %s -Wno-constant-evaluated
-// RUN: %clang_cc1 -verify=ref %s -Wno-constant-evaluated %s -S -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 -fexperimental-new-constant-interpreter %s -verify -fms-extensions
+// RUN: %clang_cc1 -fexperimental-new-constant-interpreter %s -fms-extensions -S -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 -verify=ref %s -Wno-constant-evaluated -fms-extensions
+// RUN: %clang_cc1 -verify=ref %s -Wno-constant-evaluated %s -fms-extensions -S -emit-llvm -o - | FileCheck %s
// expected-no-diagnostics
// ref-no-diagnostics
@@ -26,6 +26,8 @@ bool is_this_constant() {
constexpr bool assume() {
__builtin_assume(true);
__builtin_assume(false);
+ __assume(1);
+ __assume(false);
return true;
}
static_assert(assume(), "");