Skip to content

Commit e2bc4c8

Browse files
committed
C++: Expose is_structured_binding as a member of Variable
1 parent f875d72 commit e2bc4c8

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,12 @@ class Variable extends Declaration, @variable {
169169
variable_instantiation(underlyingElement(this), unresolveElement(v))
170170
}
171171

172+
/**
173+
* Holds if this variable is declated as part of a structured binding
174+
* declaration. For example, `x` in `auto [x, y] = ...`.
175+
*/
176+
predicate isStructuredBinding() { is_structured_binding(unresolveElement(this)) }
177+
172178
/**
173179
* Holds if this is a compiler-generated variable. For example, a
174180
* [range-based for loop](http://en.cppreference.com/w/cpp/language/range-for)

0 commit comments

Comments
 (0)