================
@@ -3476,6 +3492,53 @@ 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
+~~~~~~~~~~~~~~~~
+EBNF syntax description of the directives is the following:
+
+.. productionlist:: verify-grammar
+ directive: prefix , "-" , diagnostic-kind , [ regex-match ] , [
diagnotic-loc ] , [ " " , quantifier ] , "{" , [ delimiter-open ], "{", [
diagnostic-text ] , "}" , [ delimiter-close ], "}" ;
+ diagnostic-kind : "error" | "warning" | "note" | "remark" ;
+ regex-match : "-re" ;
+ diagnostic-loc : "@" , ( "+" | "-" ) , number
+ : | "@" , line
+ : | "@" , file-path , ":" , line
+ : | "@" , "*" , [ ":" , "*" ]
+ : | "@" , "#" , marker-name ;
+ line : number | "*" ;
+ number : digit, { digit } ;
+ quantifier : "+"
+ : | number , [ "+" ]
+ : | number , "-" , number ;
+ delimiter-open : { "{" } ;
+ delimiter-close : { "}" } ;
+
+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 somewhere in the source
+ (:ref:`Diagnostic Location <diagnostic-location>`).
+- ``diagnostic-text`` is text of the expected diagnostic
+ (:ref:`Diagnostic Text <diagnostic-text>`).
+
+Examples:
+
+- ``// expected-note {{declared here}}``
----------------
AaronBallman wrote:
Might make sense to leave explanations of what the examples are doing.
https://github.com/llvm/llvm-project/pull/179835
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits