[clang] [clang] Instantiate attributes on LabelDecls (PR #115924)
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Fri Nov 15 06:10:57 PST 2024
================
@@ -1,4 +1,64 @@
-// RUN: %clang_cc1 -std=gnu++20 -fsyntax-only -verify %s
+// RUN: split-file %s %t
+// RUN: %clang_cc1 -std=gnu++20 -fsyntax-only -ast-dump -verify %t/good_annotate.cpp | FileCheck %s
+// RUN: %clang_cc1 -std=gnu++20 -fsyntax-only -verify %t/bad_annotate.cpp
+//--- good_annotate.cpp
+// expected-no-diagnostics
+
+void f() {
+ [[clang::annotate("decl", 1)]] int i = 0;
+ [[clang::annotate("stmt", 2)]] i += 1;
+[[clang::annotate("label", 3)]] label1:
+ i += 2;
+}
+
+// CHECK: -FunctionDecl 0x{{[0-9a-z]+}} {{.*:[0-9]+:[0-9]+, line:[0-9]+:[0-9]+> line:[0-9]+:[0-9]+}} f 'void ()'
----------------
erichkeane wrote:
Your check lines are WAAAAY overkill here :)
Just do:
`FunctionDecl {{.*}} f 'void ()'`
No need to separately check the contents of the pointer and the line/columns.
https://github.com/llvm/llvm-project/pull/115924
More information about the cfe-commits
mailing list