From 2c76b13451ee12d6a2af014af24db1614ea94b2c Mon Sep 17 00:00:00 2001 From: Jeroen Ketema Date: Fri, 19 Apr 2024 14:11:09 +0200 Subject: [PATCH 1/2] C++: Improve handling of re-used qualifier in delete expressions --- cpp/ql/lib/semmle/code/cpp/exprs/Expr.qll | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/cpp/ql/lib/semmle/code/cpp/exprs/Expr.qll b/cpp/ql/lib/semmle/code/cpp/exprs/Expr.qll index 2aff0ebf4701..ab95d5ff2b4a 100644 --- a/cpp/ql/lib/semmle/code/cpp/exprs/Expr.qll +++ b/cpp/ql/lib/semmle/code/cpp/exprs/Expr.qll @@ -6,6 +6,7 @@ import semmle.code.cpp.Element private import semmle.code.cpp.Enclosing private import semmle.code.cpp.internal.ResolveClass private import semmle.code.cpp.internal.AddressConstantExpression +private import semmle.code.cpp.internal.ExtractorVersion /** * A C/C++ expression. @@ -1371,17 +1372,7 @@ class ReuseExpr extends Expr, @reuseexpr { /** * Gets the expression that is being re-used. */ - Expr getReusedExpr() { - // In the case of a prvalue, the extractor outputs the expression - // before conversion, but the converted expression is intended. - if this.isPRValueCategory() - then result = this.getBaseReusedExpr().getFullyConverted() - else result = this.getBaseReusedExpr() - } - - private Expr getBaseReusedExpr() { - expr_reuse(underlyingElement(this), unresolveElement(result), _) - } + Expr getReusedExpr() { expr_reuse(underlyingElement(this), unresolveElement(result), _) } override Type getType() { result = this.getReusedExpr().getType() } From bcde7151e8fe14fb66bedbd305c79057569d90f4 Mon Sep 17 00:00:00 2001 From: Jeroen Ketema Date: Mon, 22 Apr 2024 10:23:03 +0200 Subject: [PATCH 2/2] C++: Address review comment --- cpp/ql/lib/semmle/code/cpp/exprs/Expr.qll | 1 - 1 file changed, 1 deletion(-) diff --git a/cpp/ql/lib/semmle/code/cpp/exprs/Expr.qll b/cpp/ql/lib/semmle/code/cpp/exprs/Expr.qll index ab95d5ff2b4a..db80d5a31a69 100644 --- a/cpp/ql/lib/semmle/code/cpp/exprs/Expr.qll +++ b/cpp/ql/lib/semmle/code/cpp/exprs/Expr.qll @@ -6,7 +6,6 @@ import semmle.code.cpp.Element private import semmle.code.cpp.Enclosing private import semmle.code.cpp.internal.ResolveClass private import semmle.code.cpp.internal.AddressConstantExpression -private import semmle.code.cpp.internal.ExtractorVersion /** * A C/C++ expression.