Extract warning and error directives

This commit is contained in:
Tamas Vajk
2021-01-20 08:55:41 +01:00
parent 3740aba4a8
commit 15c611e22f
10 changed files with 100 additions and 1 deletions

View File

@@ -70,3 +70,27 @@ class UndefineDirective extends PreprocessorDirective, @directive_undefine {
override string getAPrimaryQlClass() { result = "UndefineDirective" }
}
/**
* A `#warning` directive.
*/
class WarningDirective extends PreprocessorDirective, @directive_warning {
/** Gets the text of the warning. */
string getMessage() { directive_warnings(this, result) }
override string toString() { result = "#warning ..." }
override string getAPrimaryQlClass() { result = "WarningDirective" }
}
/**
* An `#error` directive.
*/
class ErrorDirective extends PreprocessorDirective, @directive_error {
/** Gets the text of the error. */
string getMessage() { directive_errors(this, result) }
override string toString() { result = "#error ..." }
override string getAPrimaryQlClass() { result = "ErrorDirective" }
}

View File

@@ -331,7 +331,16 @@ using_directive_location(
unique int id: @using_directive ref,
int loc: @location ref);
@preprocessor_directive = @pragma_warning | @pragma_checksum | @directive_define | @directive_undefine;
@preprocessor_directive = @pragma_warning | @pragma_checksum | @directive_define | @directive_undefine | @directive_warning
| @directive_error;
directive_warnings(
unique int id: @directive_warning,
string message: string ref);
directive_errors(
unique int id: @directive_error,
string message: string ref);
directive_undefines(
unique int id: @directive_undefine,