https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/106714
This does nothing and returns 0. >From 45d97a71f5e76091234d0d919db4cb605d2d1949 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= <tbae...@redhat.com> Date: Fri, 30 Aug 2024 13:45:37 +0200 Subject: [PATCH] [clang][bytecode] Implement __noop This does nothing and returns 0. --- clang/lib/AST/ByteCode/InterpBuiltin.cpp | 4 ++++ clang/test/AST/ByteCode/ms.cpp | 2 ++ 2 files changed, 6 insertions(+) diff --git a/clang/lib/AST/ByteCode/InterpBuiltin.cpp b/clang/lib/AST/ByteCode/InterpBuiltin.cpp index 1a71bff25d2540..81e49f203524b7 100644 --- a/clang/lib/AST/ByteCode/InterpBuiltin.cpp +++ b/clang/lib/AST/ByteCode/InterpBuiltin.cpp @@ -1593,6 +1593,10 @@ bool InterpretBuiltin(InterpState &S, CodePtr OpPC, const Function *F, return false; break; + case Builtin::BI__noop: + pushInteger(S, 0, Call->getType()); + break; + default: S.FFDiag(S.Current->getLocation(OpPC), diag::note_invalid_subexpr_in_const_expr) diff --git a/clang/test/AST/ByteCode/ms.cpp b/clang/test/AST/ByteCode/ms.cpp index fe5ed219946e76..816f61fec37747 100644 --- a/clang/test/AST/ByteCode/ms.cpp +++ b/clang/test/AST/ByteCode/ms.cpp @@ -8,3 +8,5 @@ static_assert(_rotl(0x01, 5) == 32); static_assert(alignof(__unaligned int) == 1, ""); + +static_assert(__noop() == 0, ""); _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits