Swift: QLDoc Diagnostics.qll.

This commit is contained in:
Geoffrey White
2023-06-08 11:35:18 +01:00
parent e0f16f46d2
commit a3ef5c6918

View File

@@ -1,8 +1,14 @@
private import codeql.swift.generated.Diagnostics
/**
* A compiler-generated error, warning, note or remark.
*/
class Diagnostics extends Generated::Diagnostics {
override string toString() { result = this.getSeverity() + ": " + this.getText() }
/**
* Gets a string representing the severity of this compiler diagnostic.
*/
string getSeverity() {
this.getKind() = 1 and result = "error"
or
@@ -14,18 +20,30 @@ class Diagnostics extends Generated::Diagnostics {
}
}
/**
* A compiler error message.
*/
class CompilerError extends Diagnostics {
CompilerError() { this.getSeverity() = "error" }
}
/**
* A compiler-generated warning.
*/
class CompilerWarning extends Diagnostics {
CompilerWarning() { this.getSeverity() = "warning" }
}
/**
* A compiler-generated note (typically attached to an error or warning).
*/
class CompilerNote extends Diagnostics {
CompilerNote() { this.getSeverity() = "note" }
}
/**
* A compiler-generated remark (milder than a warning, this does not indicate an issue).
*/
class CompilerRemark extends Diagnostics {
CompilerRemark() { this.getSeverity() = "remark" }
}