================
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -triple riscv64 -ast-dump -ast-dump-filter c23 -std=c23 -x
c %s | FileCheck --strict-whitespace %s
+
+// CHECK: FunctionDecl{{.*}}pre_c23
+// CHECK-NEXT: |-CompoundStmt
+// CHECK-NEXT: `-RISCVInterruptAttr{{.*}}supervisor
+__attribute__((interrupt("supervisor"))) void pre_c23(){}
+
+// CHECK: FunctionDecl{{.*}}in_c23
+// CHECK-NEXT: |-CompoundStmt
+// CHECK-NEXT: `-RISCVInterruptAttr{{.*}}supervisor
+// CHECK-NOT: `-RISCVInterruptAttr{{.*}}machine
----------------
AaronBallman wrote:
Before this patch, our "has attribute" check was looking through a
`StringSwitch` that had multiple cases with the same string argument but
different resulting values (that would check for target triples and arches). So
we'd hit the first case, say "this matches", and the test for the attribute
would only pass if the target triple matched. Because the first triple was
never the RISCV attribute, we'd always say "we don't have this attribute". In
turn, this would mean parsing would say "well, we don't know about this
attribute, so eat all the arguments". But because Sema could figure out which
`handleInterruptAttr` function to call, we'd actually go ahead and make the
correct attribute, just with the incorrect argument. The default if no argument
is specified for RISCV is `machine`. So we'd ignore `supervisor` and just
substitute in `machine` quietly for the user.
https://github.com/llvm/llvm-project/pull/140828
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits