Question about test show-diag-options.c

I am looking at a test, test/Misc/show-diag-options.c, and I see this line:

  // CATEGORY_ID: {{.*}}: warning: {{[a-z ]+}} [2]

Can anyone tell me where this [2] comes from? I see that it refers to a diag
category index of some kind, but I can't figure out from .td files why the
category for that particular warning should have an index of "2".

Thanks,

I am looking at a test, test/Misc/show-diag-options.c, and I see this line:

// CATEGORY_ID: {{.*}}: warning: {{[a-z ]+}} [2]

Can anyone tell me where this [2] comes from? I see that it refers to a diag
category index of some kind, but I can't figure out from .td files why the
category for that particular warning should have an index of "2".

Check DiagnosticCategories.h, the number is the index in the enum list.

-Argyrios

Argyrios Kyrtzidis <kyrtzidis@apple.com> writes:

I am looking at a test, test/Misc/show-diag-options.c, and I see this line:

// CATEGORY_ID: {{.*}}: warning: {{[a-z ]+}} [2]

Can anyone tell me where this [2] comes from? I see that it refers to a
diag category index of some kind, but I can't figure out from .td files why
the category for that particular warning should have an index of "2".

Check DiagnosticCategories.h, the number is the index in the enum list.

Aha, I think I may have found an invalid ordering expectations in Clang's test
then. Here is the key difference between my fork and upstream in
DiagnosticGroups.inc:

--8<---------------cut here---------------start------------->8---
#ifdef GET_CATEGORY_TABLE
CATEGORY("", DiagCat_None)
CATEGORY("Lexical or Preprocessor Issue", DiagCat_Lexical_or_Preprocessor_Issue)
-CATEGORY("Parse Issue", DiagCat_Parse_Issue)
CATEGORY("Semantic Issue", DiagCat_Semantic_Issue)
+CATEGORY("Parse Issue", DiagCat_Parse_Issue)
CATEGORY("Automatic Reference Counting Issue", DiagCat_Automatic_Reference_Counting_Issue)
CATEGORY("Inline Assembly Issue", DiagCat_Inline_Assembly_Issue)
CATEGORY("Modules Issue", DiagCat_Modules_Issue)
--8<---------------cut here---------------end--------------->8---

The category indices for Parse Issue and Semantic Issue have been flipped.
Any idea what could cause this to happen? I haven't renamed, added or deleted
any files in include/clang/Basic...

Thanks,