Merge pull request #21588 from jketema/jketema/compiler-error-bmn

C++: Silence `ExtractionRecoverableWarning`s when BMN is active
This commit is contained in:
Jeroen Ketema
2026-03-30 14:17:26 +02:00
committed by GitHub
3 changed files with 17 additions and 2 deletions

View File

@@ -50,7 +50,7 @@ private newtype TExtractionProblem =
/**
* Superclass for the extraction problem hierarchy.
*/
class ExtractionProblem extends TExtractionProblem {
abstract class ExtractionProblem extends TExtractionProblem {
/** Gets the string representation of the problem. */
string toString() { none() }
@@ -65,6 +65,9 @@ class ExtractionProblem extends TExtractionProblem {
/** Gets the SARIF severity of this problem. */
int getSeverity() { none() }
/** Gets the `Compilation` the problem is associated with. */
abstract Compilation getCompilation();
}
/**
@@ -96,6 +99,8 @@ class ExtractionUnrecoverableError extends ExtractionProblem, TCompilationFailed
// [errors](https://docs.oasis-open.org/sarif/sarif/v2.1.0/csprd01/sarif-v2.1.0-csprd01.html#_Toc10541338).
result = 2
}
override Compilation getCompilation() { result = c }
}
/**
@@ -122,6 +127,8 @@ class ExtractionRecoverableWarning extends ExtractionProblem, TReportableWarning
// [warnings](https://docs.oasis-open.org/sarif/sarif/v2.1.0/csprd01/sarif-v2.1.0-csprd01.html#_Toc10541338).
result = 1
}
override Compilation getCompilation() { result = err.getCompilation() }
}
/**
@@ -148,4 +155,6 @@ class ExtractionUnknownProblem extends ExtractionProblem, TUnknownProblem {
// [warnings](https://docs.oasis-open.org/sarif/sarif/v2.1.0/csprd01/sarif-v2.1.0-csprd01.html#_Toc10541338).
result = 1
}
override Compilation getCompilation() { result = err.getCompilation() }
}

View File

@@ -10,7 +10,9 @@ import ExtractionProblems
from ExtractionProblem warning
where
warning instanceof ExtractionRecoverableWarning and exists(warning.getFile().getRelativePath())
warning instanceof ExtractionRecoverableWarning and
exists(warning.getFile().getRelativePath()) and
not warning.getCompilation().buildModeNone()
or
warning instanceof ExtractionUnknownProblem
select warning,

View File

@@ -0,0 +1,4 @@
---
category: minorAnalysis
---
* The "Extraction warnings" (`cpp/diagnostics/extraction-warnings`) diagnostics query no longer yields `ExtractionRecoverableWarning`s for `build-mode: none` databases. The results were found to significantly increase the sizes of the produced SARIF files, making them unprocessable in some cases.