Skip to content

Commit 66cd768

Browse files
committed
[clang][Interp] Handle __assume like __builtin_assume.
1 parent f958ad3 commit 66cd768

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

clang/lib/AST/Interp/InterpBuiltin.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -660,6 +660,7 @@ bool InterpretBuiltin(InterpState &S, CodePtr OpPC, const Function *F,
660660
S.Stk.push<Boolean>(Boolean::from(S.inConstantContext()));
661661
break;
662662
case Builtin::BI__builtin_assume:
663+
case Builtin::BI__assume:
663664
break;
664665
case Builtin::BI__builtin_strcmp:
665666
if (!interp__builtin_strcmp(S, OpPC, Frame))

clang/test/AST/Interp/builtins.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
// RUN: %clang_cc1 -fexperimental-new-constant-interpreter %s -verify
2-
// RUN: %clang_cc1 -fexperimental-new-constant-interpreter %s -S -emit-llvm -o - | FileCheck %s
3-
// RUN: %clang_cc1 -verify=ref %s -Wno-constant-evaluated
4-
// RUN: %clang_cc1 -verify=ref %s -Wno-constant-evaluated %s -S -emit-llvm -o - | FileCheck %s
1+
// RUN: %clang_cc1 -fexperimental-new-constant-interpreter %s -verify -fms-extensions
2+
// RUN: %clang_cc1 -fexperimental-new-constant-interpreter %s -fms-extensions -S -emit-llvm -o - | FileCheck %s
3+
// RUN: %clang_cc1 -verify=ref %s -Wno-constant-evaluated -fms-extensions
4+
// RUN: %clang_cc1 -verify=ref %s -Wno-constant-evaluated %s -fms-extensions -S -emit-llvm -o - | FileCheck %s
55

66
// expected-no-diagnostics
77
// ref-no-diagnostics
@@ -26,6 +26,8 @@ bool is_this_constant() {
2626
constexpr bool assume() {
2727
__builtin_assume(true);
2828
__builtin_assume(false);
29+
__assume(1);
30+
__assume(false);
2931
return true;
3032
}
3133
static_assert(assume(), "");

0 commit comments

Comments
 (0)