================
@@ -3476,6 +3493,95 @@ diagnostic verifier will pass. However, if the expected 
error does not appear
 or appears in a different location than expected, or if additional diagnostics
 appear, the diagnostic verifier will fail and emit information as to why.
 
+Directive Syntax
+~~~~~~~~~~~~~~~~
+Syntax description of the directives is the following:
+
+.. parsed-literal::
+  
+  `directive`
+      `prefix` ``-`` `diagnostic-kind` `regex-match`:sub:`opt` 
`diagnostic-loc`:sub:`opt` `quantifier`:sub:`opt` ``{{`` 
`delimiter-open`:sub:`opt` `diagnostic-text` `delimiter-close`:sub:`opt` ``}}``
+
+  `diagnostic-kind`
+      ``error``
+      ``warning``
+      ``note``
+      ``remark``
+
+  `regex-match`
+      ``-re``
+
+  `diagnostic-loc`
+      ``@+`` `number`
+      ``@-`` `number`
+      ``@`` `line`
+      ``@`` `file-path` ``:`` `line`
+      ``@*``
+      ``@*:*``
+      ``@#`` `marker-name`
+
+  `line`
+      ``*``
+      `number`
+  
+  `quantifier`
+      ``+``
+      `number` ``+``
+      `number` ``-`` `number`
+
+  `delimiter-open`
+      ``{`` `delimiter-open`:sub:`opt`
+
+  `delimiter-close`
+      ``}`` `delimiter-close`:sub:`opt`
+
+  `number`
+      `digit` `number`:sub:`opt`
+
+  `digit`
+      ``0`` ``1`` ``2`` ``3`` ``4`` ``5`` ``6`` ``7`` ``8`` ``9``
+
+Where:
+
+- ``prefix`` is "expected" or a custom string
+  (:ref:`Custom Prefixes <custom-prefixes>`).
+- ``delimiter-open`` and ``delimiter-close`` have to have the same length
+  (:ref:`Diagnostic Text <diagnostic-text>`).
+- ``file-path`` is relative or absolte path to a file
+  (:ref:`Diagnostic Location <diagnostic-location>`).
+- ``marker-name`` is name of the marker placed somewhere in the source file
+  (:ref:`Diagnostic Location <diagnostic-location>`).
+- ``diagnostic-text`` is text of the expected diagnostic
+  (:ref:`Diagnostic Text <diagnostic-text>`).
+
+Examples:
+
+- ``// expected-note {{declared here}}``
+  One note ``declared here`` has to be issued on the same line as the
+  directive.
+- ``// expected-error@+1 0-1 {{{expected identifier or '{'}}}``
----------------
AaronBallman wrote:

```suggestion
- ``// expected-error@+1 0-1 {{expected identifier or '{'}}``
```

https://github.com/llvm/llvm-project/pull/179835
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to