File tree Expand file tree Collapse file tree
cpp/ql/src/semmle/code/cpp/exprs Expand file tree Collapse file tree Original file line number Diff line number Diff 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 * ```
Original file line number Diff line number Diff 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:
You can’t perform that action at this time.
0 commit comments