Skip to content

Commit 5abb033

Browse files
authored
Merge pull request #9552 from jketema/rc/3.6/braced
C++: Introduce relation for tracking braced initializers
2 parents 5780f15 + f71807c commit 5abb033

File tree

10 files changed

+9303
-829
lines changed

10 files changed

+9303
-829
lines changed

cpp/downgrades/19e31bf071f588bb7efd1e4d5a185ce4f6fbbd84/old.dbscheme

Lines changed: 2115 additions & 0 deletions
Large diffs are not rendered by default.

cpp/downgrades/19e31bf071f588bb7efd1e4d5a185ce4f6fbbd84/semmlecode.cpp.dbscheme

Lines changed: 2111 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
description: Add relation for tracking C++ braced initializers
2+
compatibility: full
3+
braced_initialisers.rel: delete
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
category: feature
3+
---
4+
* An `isBraced` predicate was added to the `Initializer` class which holds when a C++ braced initializer was used in the initialization.

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,7 @@ class Initializer extends ControlFlowNode, @initialiser {
5151
override Function getControlFlowScope() { result = this.getExpr().getEnclosingFunction() }
5252

5353
override Stmt getEnclosingStmt() { result = this.getExpr().getEnclosingStmt() }
54+
55+
/** Holds if the initializer used the C++ braced initializer notation. */
56+
predicate isBraced() { braced_initialisers(underlyingElement(this)) }
5457
}

cpp/ql/lib/semmlecode.cpp.dbscheme

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1436,6 +1436,10 @@ initialisers(
14361436
int location: @location_expr ref
14371437
);
14381438

1439+
braced_initialisers(
1440+
int init: @initialiser ref
1441+
);
1442+
14391443
/**
14401444
* An ancestor for the expression, for cases in which we cannot
14411445
* otherwise find the expression's parent.

0 commit comments

Comments
 (0)