xref: /llvm-project/clang/test/TableGen/redefined-group.td (revision 50d96f59d0966bdda6b3ac4f8964ed572435b847)
1// RUN: clang-tblgen -gen-clang-diag-groups -I%S %s -o /dev/null 2>&1 | FileCheck %s
2include "DiagnosticBase.inc"
3
4def NamedGroup : DiagGroup<"a">;
5def InNamedGroup1 : Warning<"">, InGroup<DiagGroup<"a">>;
6def InNamedGroup2 : Warning<"">, InGroup  < DiagGroup<"a"> >;
7// CHECK: redefined-group.td:[[@LINE-3]]:5: error: group 'a' is defined more than once
8// CHECK: redefined-group.td:[[@LINE-3]]:5: note: also implicitly defined here
9// CHECK: redefined-group.td:[[@LINE-3]]:5: note: also implicitly defined here
10
11def : DiagGroup<"b">;
12def InUnnamedGroup : Warning<"">, InGroup<DiagGroup<"b">>;
13// CHECK: redefined-group.td:[[@LINE-2]]:1: error: group 'b' is defined more than once
14// CHECK: redefined-group.td:[[@LINE-2]]:5: note: also implicitly defined here
15
16def ImplicitGroup1 : Warning<"">, InGroup<DiagGroup<"c">>;
17def ImplicitGroup2 : Warning<"">, InGroup<DiagGroup<"c">>;
18def ImplicitGroup3 : Warning<"">,
19  InGroup<DiagGroup<"c">>;
20// CHECK: redefined-group.td:[[@LINE-4]]:5: error: group 'c' is implicitly defined more than once
21// CHECK: redefined-group.td:[[@LINE-4]]:5: note: also implicitly defined here
22// CHECK: redefined-group.td:[[@LINE-4]]:5: note: also implicitly defined here
23
24def NamedAndUnnamed : DiagGroup<"d">;
25def : DiagGroup<"d">;
26// CHECK: redefined-group.td:[[@LINE-2]]:5: error: group 'd' is defined more than once
27// CHECK: redefined-group.td:[[@LINE-2]]:1: note: also defined here
28
29def : DiagGroup<"e">;
30def NamedAndUnnamed2 : DiagGroup<"e">;
31// CHECK: redefined-group.td:[[@LINE-1]]:5: error: group 'e' is defined more than once
32// CHECK: redefined-group.td:[[@LINE-3]]:1: note: also defined here
33
34def InGroupF1 : Warning<"">, InGroup<DiagGroup<"f">>;
35def : DiagGroup<"f">; // FIXME: It'd be nice to also note this, but it's hard to detect.
36def InGroupF2 : Warning<"">, InGroup<DiagGroup<"f">>;
37def GroupF : DiagGroup<"f">;
38def InGroupF3 : Warning<"">, InGroup<GroupF>;
39def InGroupF4 : Warning<"">, InGroup<DiagGroup<"f">>;
40// CHECK: redefined-group.td:[[@LINE-5]]:1: error: group 'f' is defined more than once
41// CHECK: redefined-group.td:[[@LINE-7]]:5: note: also implicitly defined here
42// CHECK: redefined-group.td:[[@LINE-6]]:5: note: also implicitly defined here
43// CHECK: redefined-group.td:[[@LINE-4]]:5: note: also implicitly defined here
44