[clang] [clang] Remove an incorrect assertion in ConstantFoldAttrs (PR #105789)
Timm Baeder via cfe-commits
cfe-commits at lists.llvm.org
Fri Jan 17 04:38:51 PST 2025
tbaederr wrote:
For
```c++
void f() {
[[clang::annotate("B", (void)1, (void)2, 7)]] int j = 0;
}
```
The IR is:
```llvm
@.str = private unnamed_addr constant [2 x i8] c"B\00", section "llvm.metadata"
@.str.1 = private unnamed_addr constant [10 x i8] c"array.cpp\00", section "llvm.metadata"
@.args = private unnamed_addr constant { i8, i8, i32 } { i8 undef, i8 undef, i32 7 }, section "llvm.metadata
; Function Attrs: mustprogress noinline nounwind optnone uwtable
define dso_local void @_Z1fv() #0 {
entry:
%j = alloca i32, align 4
call void @llvm.var.annotation.p0.p0(ptr %j, ptr @.str, ptr @.str.1, i32 187, ptr @.args)
store i32 0, ptr %j, align 4
ret void
}
```
So the void arguments get translated to `undef`. Is that acceptable?
https://github.com/llvm/llvm-project/pull/105789
More information about the cfe-commits
mailing list