[clang] [Clang] Reject __annotation on unsupported targets (PR #193731)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 28 03:11:24 PDT 2026
================
@@ -3263,10 +3263,17 @@ Sema::CheckBuiltinFunctionCall(FunctionDecl *FDecl, unsigned BuiltinID,
case Builtin::BI##ID: \
return AtomicOpsOverloaded(TheCallResult, AtomicExpr::AO##ID);
#include "clang/Basic/Builtins.inc"
- case Builtin::BI__annotation:
+ case Builtin::BI__annotation: {
+ const llvm::Triple &TT = Context.getTargetInfo().getTriple();
+ if (!TT.isOSWindows() && !TT.isUEFI()) {
----------------
kjedruczyk wrote:
I've added the char with check back, and added the test for it now.
FWIW, I did verify the test caught this issue:
```
% ../dbg/build/bin/llvm-lit -v ../../llvm-project/clang/test/CodeGen/ms-annotation.c
llvm-lit: llvm-project/llvm/utils/lit/lit/llvm/config.py:569: note: using clang: llvm-workspace/dbg/build/bin/clang
llvm-lit: llvm-project/llvm/utils/lit/lit/llvm/subst.py:130: note: Did not find cir-opt in llvm-workspace/dbg/build/bin:llvm-workspace/dbg/build/bin
llvm-lit: llvm-project/llvm/utils/lit/lit/util.py:363: note: using SDKROOT: '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX26.4.sdk'
-- Testing: 1 tests, 1 workers --
FAIL: Clang :: CodeGen/ms-annotation.c (1 of 1)
******************** TEST 'Clang :: CodeGen/ms-annotation.c' FAILED ********************
Exit Code: 2
Command Output (stdout):
--
# RUN: at line 1
llvm-workspace/dbg/build/bin/clang -cc1 -internal-isystem llvm-workspace/dbg/build/lib/clang/23/include -nostdsysteminc -triple i686-windows llvm-project/
clang/test/CodeGen/ms-annotation.c -fms-extensions -emit-llvm -o - | llvm-workspace/dbg/build/bin/FileCheck llvm-project/clang/test/CodeGen/ms-annotation.c
# executed command: llvm-workspace/dbg/build/bin/clang -cc1 -internal-isystem llvm-workspace/dbg/build/lib/clang/23/include -nostdsysteminc -triple i686-windows llvm-project/clang/test/CodeGen/ms-annotation.c -fms-extensions -emit-llvm -o -
# executed command: llvm-workspace/dbg/build/bin/FileCheck llvm-project/clang/test/CodeGen/ms-annotation.c
# RUN: at line 2
llvm-workspace/dbg/build/bin/clang -cc1 -internal-isystem llvm-workspace/dbg/build/lib/clang/23/include -nostdsysteminc -triple i686-windows llvm-project/
clang/test/CodeGen/ms-annotation.c -fms-extensions -fwchar-type=int -fsigned-wchar -emit-llvm -o - | llvm-workspace/dbg/build/bin/FileCheck llvm-project/clang/test/CodeGen/ms-annota
tion.c
# executed command: llvm-workspace/dbg/build/bin/clang -cc1 -internal-isystem llvm-workspace/dbg/build/lib/clang/23/include -nostdsysteminc -triple i686-windows llvm-project/clang/test/CodeGen/ms-annotation.c -fms-extensions -fwchar-type=int -fsigned-wchar -emit-llvm -o -
# .---command stderr------------
# | Assertion failed: (Str->getCharByteWidth() == 2), function EmitBuiltinExpr, file CGBuiltin.cpp, line 5600.
...
```
https://github.com/llvm/llvm-project/pull/193731
More information about the cfe-commits
mailing list