C++: Introduce relation for tracking braced initializers

This commit is contained in:
Jeroen Ketema
2022-05-30 11:24:47 +02:00
parent b6cc438390
commit 38be04461e
9 changed files with 8468 additions and 0 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,3 @@
description: Add relation for tracking C++ braced initializers
compatibility: full
braced_initialisers.rel: delete

View File

@@ -0,0 +1,4 @@
---
category: feature
---
* An `isBraced` predicate was added to the `Initializer`class which holds when a C++ braced initializer was used in the initialization.

View File

@@ -51,4 +51,7 @@ class Initializer extends ControlFlowNode, @initialiser {
override Function getControlFlowScope() { result = this.getExpr().getEnclosingFunction() } override Function getControlFlowScope() { result = this.getExpr().getEnclosingFunction() }
override Stmt getEnclosingStmt() { result = this.getExpr().getEnclosingStmt() } override Stmt getEnclosingStmt() { result = this.getExpr().getEnclosingStmt() }
/** Holds if the initializer used the C++ braced initializer notation. */
predicate isBraced() { braced_initialisers(underlyingElement(this)) }
} }

View File

@@ -1436,6 +1436,10 @@ initialisers(
int location: @location_expr ref int location: @location_expr ref
); );
braced_initialisers(
int init: @initialiser ref
);
/** /**
* An ancestor for the expression, for cases in which we cannot * An ancestor for the expression, for cases in which we cannot
* otherwise find the expression's parent. * otherwise find the expression's parent.

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,2 @@
description: dd relation for tracking C++ braced initializers
compatibility: backwards