mirror of
https://github.com/github/codeql.git
synced 2026-04-29 10:45:15 +02:00
C++ IR: Move ErrorExpr filter to TranslatedElement
The convention in the IR translation is to handle all ignored expressions in this central place.
This commit is contained in:
@@ -84,7 +84,13 @@ private predicate ignoreExprOnly(Expr expr) {
|
||||
// Ignore the allocator call, because we always synthesize it. Don't ignore
|
||||
// its arguments, though, because we use them as part of the synthesis.
|
||||
newExpr.getAllocatorCall() = expr
|
||||
) or
|
||||
)
|
||||
or
|
||||
// The extractor deliberately emits an `ErrorExpr` as the first argument to
|
||||
// the allocator call, if any, of a `NewOrNewArrayExpr`. That `ErrorExpr`
|
||||
// should not be translated.
|
||||
exists(NewOrNewArrayExpr new | expr = new.getAllocatorCall().getArgument(0))
|
||||
or
|
||||
not translateFunction(expr.getEnclosingFunction())
|
||||
or
|
||||
// We do not yet translate destructors properly, so for now we ignore the
|
||||
|
||||
@@ -2866,13 +2866,6 @@ class TranslatedStmtExpr extends TranslatedNonConstantExpr {
|
||||
class TranslatedErrorExpr extends TranslatedSingleInstructionExpr {
|
||||
override ErrorExpr expr;
|
||||
|
||||
TranslatedErrorExpr() {
|
||||
// The extractor deliberately emits an `ErrorExpr` as the first argument to
|
||||
// the allocator call, if any, of a `NewOrNewArrayExpr`. That `ErrorExpr`
|
||||
// should not be translated.
|
||||
not exists(NewOrNewArrayExpr new | expr = new.getAllocatorCall().getArgument(0))
|
||||
}
|
||||
|
||||
override final Instruction getFirstInstruction() {
|
||||
result = getInstruction(OnlyInstructionTag())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user