Skip to content

Commit 0784776

Browse files
committed
bringing back mayThrowException to make it cleaner/easier for backwards compatibility.
1 parent 63ddd81 commit 0784776

File tree

2 files changed

+4
-17
lines changed

2 files changed

+4
-17
lines changed

cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedCall.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,11 +363,11 @@ class TranslatedFunctionCall extends TranslatedCallExpr, TranslatedDirectCall {
363363
}
364364

365365
final override predicate mayThrowException() {
366-
expr.getTarget().(ThrowingFunction).raisesException(_)
366+
expr.getTarget().(ThrowingFunction).mayThrowException(_)
367367
}
368368

369369
final override predicate mustThrowException() {
370-
expr.getTarget().(ThrowingFunction).raisesException(true)
370+
expr.getTarget().(ThrowingFunction).mayThrowException(true)
371371
}
372372
}
373373

cpp/ql/lib/semmle/code/cpp/models/interfaces/Throwing.qll

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -66,23 +66,10 @@ abstract class ThrowingFunction extends ExceptionAnnotation {
6666
* Do not specify `none()` if no exception is raised, instead use the
6767
* `NonThrowingFunction` class instead.
6868
*/
69-
abstract predicate raisesException(boolean unconditional);
70-
71-
/**
72-
* DEPRECATES: use/extend `raisesException` instead.
73-
*/
74-
deprecated predicate mayThrowException(boolean unconditional){
75-
this.raisesException(unconditional)
76-
}
69+
abstract predicate mayThrowException(boolean unconditional);
7770

7871
/**
7972
* Holds if this function will always raise an exception if called
8073
*/
81-
final predicate alwaysRaisesException() { this.raisesException(true) }
82-
83-
/**
84-
* Holds if this function may raise an exception if called but
85-
* it is not guaranteed to do so. I.e., the function does not always raise an exception.
86-
*/
87-
final predicate mayRaiseException() { this.raisesException(false) }
74+
final predicate alwaysRaisesException() { this.mayThrowException(true) }
8875
}

0 commit comments

Comments
 (0)