Skip to content

Commit 0bc0231

Browse files
committed
C++: autoformat for first-class destructors
1 parent 56c9566 commit 0bc0231

File tree

4 files changed

+10
-13
lines changed

4 files changed

+10
-13
lines changed

cpp/ql/lib/semmle/code/cpp/PrintAST.qll

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -687,7 +687,8 @@ private string getChildAccessorWithoutConversions(Locatable parent, Element chil
687687
exists(int n | expr.getChild(n) = child and result = "getChild(" + n + ")")
688688
or
689689
exists(int n |
690-
expr.getImplicitDestructorCall(n) = child and result = "getImplicitDestructorCall(" + n + ")"
690+
expr.getImplicitDestructorCall(n) = child and
691+
result = "getImplicitDestructorCall(" + n + ")"
691692
)
692693
)
693694
)

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,7 @@ class Expr extends StmtParent, @expr {
6969
/**
7070
* Gets a compiler-generated destructor call that is performed after this expression.
7171
*/
72-
DestructorCall getAnImplicitDestructorCall() {
73-
synthetic_destructor_call(this, _, result)
74-
}
72+
DestructorCall getAnImplicitDestructorCall() { synthetic_destructor_call(this, _, result) }
7573

7674
/** Gets the location of this expression. */
7775
override Location getLocation() {

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ class Stmt extends StmtParent, @stmt {
6262
/**
6363
* Gets the `n`th compiler-generated destructor call that is performed after this statement, in
6464
* order of destruction.
65-
*
65+
*
6666
* For instance, in the following code, `getImplicitDestructorCall(0)` for the block will be the
6767
* destructor call for `c2`:
6868
* ```cpp
@@ -79,9 +79,7 @@ class Stmt extends StmtParent, @stmt {
7979
/**
8080
* Gets a compiler-generated destructor call that is performed after this statement.
8181
*/
82-
DestructorCall getAnImplicitDestructorCall() {
83-
synthetic_destructor_call(this, _, result)
84-
}
82+
DestructorCall getAnImplicitDestructorCall() { synthetic_destructor_call(this, _, result) }
8583

8684
override Location getLocation() { stmts(underlyingElement(this), _, result) }
8785

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import cpp
22

33
query predicate exprDestructors(Expr e, int i, DestructorCall d, Expr destructed) {
4-
d = e.getImplicitDestructorCall(i) and
5-
d.getQualifier() = destructed
4+
d = e.getImplicitDestructorCall(i) and
5+
d.getQualifier() = destructed
66
}
77

88
query predicate stmtDestructors(Stmt s, int i, DestructorCall d, Expr destructed) {
9-
d = s.getImplicitDestructorCall(i) and
10-
d.getQualifier() = destructed
11-
}
9+
d = s.getImplicitDestructorCall(i) and
10+
d.getQualifier() = destructed
11+
}

0 commit comments

Comments
 (0)