Skip to content

Commit 8845546

Browse files
authored
Merge pull request github#4645 from geoffw0/oddsends2
C++: Odds and ends
2 parents 618d9c3 + be537a8 commit 8845546

File tree

5 files changed

+38
-39
lines changed

5 files changed

+38
-39
lines changed

cpp/ql/src/experimental/semmle/code/cpp/security/PrivateCleartextWrite.qll

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import semmle.code.cpp.dataflow.TaintTracking
77
import experimental.semmle.code.cpp.security.PrivateData
88
import semmle.code.cpp.security.FileWrite
99
import semmle.code.cpp.security.BufferWrite
10-
import semmle.code.cpp.dataflow.TaintTracking
1110

1211
module PrivateCleartextWrite {
1312
/**

cpp/ql/src/semmle/code/cpp/exprs/Call.qll

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -441,40 +441,6 @@ class ConstructorCall extends FunctionCall {
441441
override Constructor getTarget() { result = super.getTarget() }
442442
}
443443

444-
/**
445-
* A C++ `throw` expression.
446-
* ```
447-
* throw Exc(2);
448-
* ```
449-
*/
450-
class ThrowExpr extends Expr, @throw_expr {
451-
/**
452-
* Gets the expression that will be thrown, if any. There is no result if
453-
* `this` is a `ReThrowExpr`.
454-
*/
455-
Expr getExpr() { result = this.getChild(0) }
456-
457-
override string getAPrimaryQlClass() { result = "ThrowExpr" }
458-
459-
override string toString() { result = "throw ..." }
460-
461-
override int getPrecedence() { result = 1 }
462-
}
463-
464-
/**
465-
* A C++ `throw` expression with no argument (which causes the current exception to be re-thrown).
466-
* ```
467-
* throw;
468-
* ```
469-
*/
470-
class ReThrowExpr extends ThrowExpr {
471-
ReThrowExpr() { this.getType() instanceof VoidType }
472-
473-
override string getAPrimaryQlClass() { result = "ReThrowExpr" }
474-
475-
override string toString() { result = "re-throw exception " }
476-
}
477-
478444
/**
479445
* A call to a destructor.
480446
* ```

cpp/ql/src/semmle/code/cpp/exprs/Expr.qll

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1146,6 +1146,40 @@ class BlockExpr extends Literal {
11461146
Function getFunction() { code_block(underlyingElement(this), unresolveElement(result)) }
11471147
}
11481148

1149+
/**
1150+
* A C++ `throw` expression.
1151+
* ```
1152+
* throw Exc(2);
1153+
* ```
1154+
*/
1155+
class ThrowExpr extends Expr, @throw_expr {
1156+
/**
1157+
* Gets the expression that will be thrown, if any. There is no result if
1158+
* `this` is a `ReThrowExpr`.
1159+
*/
1160+
Expr getExpr() { result = this.getChild(0) }
1161+
1162+
override string getAPrimaryQlClass() { result = "ThrowExpr" }
1163+
1164+
override string toString() { result = "throw ..." }
1165+
1166+
override int getPrecedence() { result = 1 }
1167+
}
1168+
1169+
/**
1170+
* A C++ `throw` expression with no argument (which causes the current exception to be re-thrown).
1171+
* ```
1172+
* throw;
1173+
* ```
1174+
*/
1175+
class ReThrowExpr extends ThrowExpr {
1176+
ReThrowExpr() { this.getType() instanceof VoidType }
1177+
1178+
override string getAPrimaryQlClass() { result = "ReThrowExpr" }
1179+
1180+
override string toString() { result = "re-throw exception " }
1181+
}
1182+
11491183
/**
11501184
* A C++11 `noexcept` expression, returning `true` if its subexpression is guaranteed
11511185
* not to `throw` exceptions. For example:

cpp/ql/src/semmle/code/cpp/models/interfaces/Iterator.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ abstract class IteratorReferenceFunction extends Function { }
2222
abstract class GetIteratorFunction extends Function {
2323
/**
2424
* Holds if the return value or buffer represented by `output` is an iterator over the container
25-
* passd in the argument, qualifier, or buffer represented by `input`.
25+
* passed in the argument, qualifier, or buffer represented by `input`.
2626
*/
2727
abstract predicate getsIterator(FunctionInput input, FunctionOutput output);
2828
}

cpp/ql/src/semmle/code/cpp/stmts/Stmt.qll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -678,7 +678,7 @@ class CoReturnStmt extends Stmt, @stmt_co_return {
678678
override string getAPrimaryQlClass() { result = "CoReturnStmt" }
679679

680680
/**
681-
* Gets the operand of this 'co_return' statement.
681+
* Gets the operand of this `co_return` statement.
682682
*
683683
* For example, for
684684
* ```
@@ -693,7 +693,7 @@ class CoReturnStmt extends Stmt, @stmt_co_return {
693693
FunctionCall getOperand() { result = this.getChild(0) }
694694

695695
/**
696-
* Gets the expression of this 'co_return' statement, if any.
696+
* Gets the expression of this `co_return` statement, if any.
697697
*
698698
* For example, for
699699
* ```
@@ -707,7 +707,7 @@ class CoReturnStmt extends Stmt, @stmt_co_return {
707707
Expr getExpr() { result = this.getOperand().getArgument(0) }
708708

709709
/**
710-
* Holds if this 'co_return' statement has an expression.
710+
* Holds if this `co_return` statement has an expression.
711711
*
712712
* For example, this holds for
713713
* ```

0 commit comments

Comments
 (0)