mirror of
https://github.com/github/codeql.git
synced 2025-12-20 10:46:30 +01:00
Extract warning and error directives
This commit is contained in:
@@ -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" }
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user