AaronBallman 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?
That's an interesting situation! I'm not sure what I'd expect the LLVM IR to be there. For Clang AST, we want to keep around the expression AST nodes. But for LLVM IR, perhaps it makes sense to drop anything without a value rather than mark it as undef? https://github.com/llvm/llvm-project/pull/105789 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits