C++: Support C++20 range-based for initializers

This commit is contained in:
Jeroen Ketema
2024-02-16 15:03:52 +01:00
parent da3ff4813f
commit dd39fa0bde
31 changed files with 9498 additions and 195 deletions

View File

@@ -0,0 +1,19 @@
class Element extends @element {
string toString() { none() }
}
class Expr extends @expr {
string toString() { none() }
}
class Stmt extends @stmt {
string toString() { none() }
}
predicate isStmtWithInitializer(Stmt stmt) { exists(int kind | stmts(stmt, kind, _) | kind = 29) }
from Expr child, int index, int index_new, Element parent
where
exprparents(child, index, parent) and
if isStmtWithInitializer(parent) then index_new = index - 1 else index_new = index
select child, index_new, parent

View File

@@ -0,0 +1,9 @@
class Stmt extends @stmt {
string toString() { none() }
}
from Stmt f, Stmt i
where
for_initialization(f, i) and
f instanceof @stmt_for
select f, i

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,20 @@
class Element extends @element {
string toString() { none() }
}
class Stmt extends @stmt {
string toString() { none() }
}
predicate isStmtWithInitializer(Stmt stmt) { exists(int kind | stmts(stmt, kind, _) | kind = 29) }
from Stmt child, int index, int index_new, Element parent
where
stmtparents(child, index, parent) and
(
not isStmtWithInitializer(parent)
or
index > 0
) and
if isStmtWithInitializer(parent) then index_new = index - 1 else index_new = index
select child, index_new, parent

View File

@@ -0,0 +1,5 @@
description: Support C++20 range-based for initializers
compatibility: partial
exprparents.rel: run exprparents.qlo
stmtparents.rel: run stmtparents.qlo
for_initialization.rel: run for_initialization.qlo

View File

@@ -0,0 +1,4 @@
---
category: feature
---
* A `getInitialization` predicate was added to the `RangeBasedForStmt` class that yields the C++20-style initializer of the range-based `for` statement when it exists.

View File

@@ -735,7 +735,9 @@ private predicate namedStmtChildPredicates(Locatable s, Element e, string pred)
or
s.(ForStmt).getStmt() = e and pred = "getStmt()"
or
s.(RangeBasedForStmt).getChild(0) = e and pred = "getChild(0)"
s.(RangeBasedForStmt).getInitialization() = e and pred = "getInitialization()"
or
s.(RangeBasedForStmt).getChild(1) = e and pred = "getChild(1)"
or
s.(RangeBasedForStmt).getBeginEndDeclaration() = e and pred = "getBeginEndDeclaration()"
or
@@ -743,7 +745,7 @@ private predicate namedStmtChildPredicates(Locatable s, Element e, string pred)
or
s.(RangeBasedForStmt).getUpdate() = e and pred = "getUpdate()"
or
s.(RangeBasedForStmt).getChild(4) = e and pred = "getChild(4)"
s.(RangeBasedForStmt).getChild(5) = e and pred = "getChild(5)"
or
s.(RangeBasedForStmt).getStmt() = e and pred = "getStmt()"
or

View File

@@ -637,8 +637,10 @@ private predicate straightLineSparse(Node scope, int i, Node ni, Spec spec) {
any(RangeBasedForStmt for |
i = -1 and ni = for and spec.isAt()
or
i = 0 and ni = for.getInitialization() and spec.isAround()
or
exists(DeclStmt s | s.getADeclaration() = for.getRangeVariable() |
i = 0 and ni = s and spec.isAround()
i = 1 and ni = s and spec.isAround()
)
or
exists(DeclStmt s |
@@ -649,22 +651,22 @@ private predicate straightLineSparse(Node scope, int i, Node ni, Spec spec) {
// DeclStmt in that case.
exists(s.getADeclaration())
|
i = 1 and ni = s and spec.isAround()
i = 2 and ni = s and spec.isAround()
)
or
i = 2 and ni = for.getCondition() and spec.isBefore()
i = 3 and ni = for.getCondition() and spec.isBefore()
or
i = 3 and /* BARRIER */ ni = for and spec.isBarrier()
i = 4 and /* BARRIER */ ni = for and spec.isBarrier()
or
exists(DeclStmt declStmt | declStmt.getADeclaration() = for.getVariable() |
i = 4 and ni = declStmt and spec.isAfter()
i = 5 and ni = declStmt and spec.isAfter()
)
or
i = 5 and ni = for.getStmt() and spec.isAround()
i = 6 and ni = for.getStmt() and spec.isAround()
or
i = 6 and ni = for.getUpdate() and spec.isAround()
i = 7 and ni = for.getUpdate() and spec.isAround()
or
i = 7 and ni = for.getCondition() and spec.isBefore()
i = 8 and ni = for.getCondition() and spec.isBefore()
)
or
scope =

View File

@@ -960,25 +960,38 @@ class TranslatedRangeBasedForStmt extends TranslatedStmt, ConditionContext {
override RangeBasedForStmt stmt;
override TranslatedElement getChild(int id) {
id = 0 and result = this.getRangeVariableDeclStmt()
id = 0 and result = this.getInitialization()
or
id = 1 and result = this.getRangeVariableDeclStmt()
or
// Note: `__begin` and `__end` are declared by the same `DeclStmt`
id = 1 and result = this.getBeginEndVariableDeclStmt()
id = 2 and result = this.getBeginEndVariableDeclStmt()
or
id = 2 and result = this.getCondition()
id = 3 and result = this.getCondition()
or
id = 3 and result = this.getUpdate()
id = 4 and result = this.getUpdate()
or
id = 4 and result = this.getVariableDeclStmt()
id = 5 and result = this.getVariableDeclStmt()
or
id = 5 and result = this.getBody()
id = 6 and result = this.getBody()
}
private predicate hasInitialization() { exists(stmt.getInitialization()) }
private TranslatedStmt getInitialization() {
result = getTranslatedStmt(stmt.getInitialization())
}
override Instruction getFirstInstruction(EdgeKind kind) {
result = this.getRangeVariableDeclStmt().getFirstInstruction(kind)
if this.hasInitialization()
then result = this.getInitialization().getFirstInstruction(kind)
else result = this.getFirstRangeVariableDeclStmtInstruction(kind)
}
override Instruction getChildSuccessor(TranslatedElement child, EdgeKind kind) {
child = this.getInitialization() and
result = this.getFirstRangeVariableDeclStmtInstruction(kind)
or
child = this.getRangeVariableDeclStmt() and
result = this.getBeginEndVariableDeclStmt().getFirstInstruction(kind)
or
@@ -1018,6 +1031,10 @@ class TranslatedRangeBasedForStmt extends TranslatedStmt, ConditionContext {
)
}
private Instruction getFirstRangeVariableDeclStmtInstruction(EdgeKind kind) {
result = this.getRangeVariableDeclStmt().getFirstInstruction(kind)
}
private TranslatedDeclStmt getBeginEndVariableDeclStmt() {
exists(IRVariableDeclarationEntry entry |
entry.getStmt() = stmt.getBeginEndDeclaration() and

View File

@@ -892,6 +892,26 @@ class DoStmt extends Loop, @stmt_end_test_while {
class RangeBasedForStmt extends Loop, @stmt_range_based_for {
override string getAPrimaryQlClass() { result = "RangeBasedForStmt" }
/**
* Gets the initialization statement of this 'for' statement, if any.
*
* For example, for
* ```
* for (int x = y; auto z : ... ) { }
* ```
* the result is `int x = y;`.
*
* Does not hold if the initialization statement is missing or an empty statement, as in
* ```
* for (auto z : ...) { }
* ```
* or
* ```
* for (; auto z : ) { }
* ```
*/
Stmt getInitialization() { for_initialization(underlyingElement(this), unresolveElement(result)) }
/**
* Gets the 'body' statement of this range-based 'for' statement.
*
@@ -901,7 +921,7 @@ class RangeBasedForStmt extends Loop, @stmt_range_based_for {
* ```
* the result is the `BlockStmt` `{ y += x; }`.
*/
override Stmt getStmt() { result = this.getChild(5) }
override Stmt getStmt() { result = this.getChild(6) }
override string toString() { result = "for(...:...) ..." }
@@ -914,7 +934,7 @@ class RangeBasedForStmt extends Loop, @stmt_range_based_for {
* ```
* the result is `int x`.
*/
LocalVariable getVariable() { result = this.getChild(4).(DeclStmt).getADeclaration() }
LocalVariable getVariable() { result = this.getChild(5).(DeclStmt).getADeclaration() }
/**
* Gets the expression giving the range to iterate over.
@@ -928,7 +948,7 @@ class RangeBasedForStmt extends Loop, @stmt_range_based_for {
Expr getRange() { result = this.getRangeVariable().getInitializer().getExpr() }
/** Gets the compiler-generated `__range` variable after desugaring. */
LocalVariable getRangeVariable() { result = this.getChild(0).(DeclStmt).getADeclaration() }
LocalVariable getRangeVariable() { result = this.getChild(1).(DeclStmt).getADeclaration() }
/**
* Gets the compiler-generated `__begin != __end` which is the
@@ -936,7 +956,7 @@ class RangeBasedForStmt extends Loop, @stmt_range_based_for {
* It will be either an `NEExpr` or a call to a user-defined
* `operator!=`.
*/
override Expr getCondition() { result = this.getChild(2) }
override Expr getCondition() { result = this.getChild(3) }
override Expr getControllingExpr() { result = this.getCondition() }
@@ -945,7 +965,7 @@ class RangeBasedForStmt extends Loop, @stmt_range_based_for {
* `__end`, initializing them to the values they have before entering the
* desugared loop.
*/
DeclStmt getBeginEndDeclaration() { result = this.getChild(1) }
DeclStmt getBeginEndDeclaration() { result = this.getChild(2) }
/** Gets the compiler-generated `__begin` variable after desugaring. */
LocalVariable getBeginVariable() { result = this.getBeginEndDeclaration().getDeclaration(0) }
@@ -959,7 +979,7 @@ class RangeBasedForStmt extends Loop, @stmt_range_based_for {
* be either a `PrefixIncrExpr` or a call to a user-defined
* `operator++`.
*/
Expr getUpdate() { result = this.getChild(3) }
Expr getUpdate() { result = this.getChild(4) }
/** Gets the compiler-generated `__begin` variable after desugaring. */
LocalVariable getAnIterationVariable() { result = this.getBeginVariable() }

View File

@@ -2050,8 +2050,11 @@ switch_body(
int body_id: @stmt ref
);
@stmt_for_or_range_based_for = @stmt_for
| @stmt_range_based_for;
for_initialization(
unique int for_stmt: @stmt_for ref,
unique int for_stmt: @stmt_for_or_range_based_for ref,
int init_id: @stmt ref
);

View File

@@ -0,0 +1,19 @@
class Element extends @element {
string toString() { none() }
}
class Expr extends @expr {
string toString() { none() }
}
class Stmt extends @stmt {
string toString() { none() }
}
predicate isStmtWithInitializer(Stmt stmt) { exists(int kind | stmts(stmt, kind, _) | kind = 29) }
from Expr child, int index, int index_new, Element parent
where
exprparents(child, index, parent) and
if isStmtWithInitializer(parent) then index_new = index + 1 else index_new = index
select child, index_new, parent

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,15 @@
class Element extends @element {
string toString() { none() }
}
class Stmt extends @stmt {
string toString() { none() }
}
predicate isStmtWithInitializer(Stmt stmt) { exists(int kind | stmts(stmt, kind, _) | kind = 29) }
from Stmt child, int index, int index_new, Element parent
where
stmtparents(child, index, parent) and
if isStmtWithInitializer(parent) then index_new = index + 1 else index_new = index
select child, index_new, parent

View File

@@ -0,0 +1,4 @@
description: Support C++20 range-based for initializers
compatibility: partial
exprparents.rel: run exprparents.qlo
stmtparents.rel: run stmtparents.qlo

View File

@@ -9478,7 +9478,7 @@ ir.cpp:
# 1079| Type = [LValueReferenceType] const vector<int> &
# 1079| getEntryPoint(): [BlockStmt] { ... }
# 1080| getStmt(0): [RangeBasedForStmt] for(...:...) ...
# 1080| getChild(0): [DeclStmt] declaration
# 1080| getChild(1): [DeclStmt] declaration
# 1080| getDeclarationEntry(0): [VariableDeclarationEntry] declaration of (__range)
# 1080| Type = [LValueReferenceType] const vector<int> &
#-----| getVariable().getInitializer(): [Initializer] initializer for (__range)
@@ -9535,7 +9535,7 @@ ir.cpp:
# 1080| getQualifier(): [VariableAccess] (__begin)
# 1080| Type = [NestedStruct] iterator
# 1080| ValueCategory = lvalue
# 1080| getChild(4): [DeclStmt] declaration
# 1080| getChild(5): [DeclStmt] declaration
# 1080| getDeclarationEntry(0): [VariableDeclarationEntry] definition of e
# 1080| Type = [IntType] int
# 1080| getVariable().getInitializer(): [Initializer] initializer for e
@@ -9571,7 +9571,7 @@ ir.cpp:
# 1080| Type = [NestedStruct] iterator
# 1080| ValueCategory = lvalue
# 1086| getStmt(1): [RangeBasedForStmt] for(...:...) ...
# 1086| getChild(0): [DeclStmt] declaration
# 1086| getChild(1): [DeclStmt] declaration
# 1086| getDeclarationEntry(0): [VariableDeclarationEntry] declaration of (__range)
# 1086| Type = [LValueReferenceType] const vector<int> &
#-----| getVariable().getInitializer(): [Initializer] initializer for (__range)
@@ -9628,7 +9628,7 @@ ir.cpp:
# 1086| getQualifier(): [VariableAccess] (__begin)
# 1086| Type = [NestedStruct] iterator
# 1086| ValueCategory = lvalue
# 1086| getChild(4): [DeclStmt] declaration
# 1086| getChild(5): [DeclStmt] declaration
# 1086| getDeclarationEntry(0): [VariableDeclarationEntry] definition of e
# 1086| Type = [LValueReferenceType] const int &
# 1086| getVariable().getInitializer(): [Initializer] initializer for e
@@ -16520,7 +16520,20 @@ ir.cpp:
# 2152| Type = [VoidType] void
# 2152| ValueCategory = prvalue
# 2153| getStmt(5): [RangeBasedForStmt] for(...:...) ...
# 2153| getChild(0): [DeclStmt] declaration
# 2153| getInitialization(): [DeclStmt] declaration
# 2153| getDeclarationEntry(0): [VariableDeclarationEntry] definition of ys
# 2153| Type = [ClassTemplateInstantiation,Struct] vector<ClassWithDestructor>
# 2153| getVariable().getInitializer(): [Initializer] initializer for ys
# 2153| getExpr(): [ConstructorCall] call to vector
# 2153| Type = [VoidType] void
# 2153| ValueCategory = prvalue
# 2153| getArgument(0): [VariableAccess] x
# 2153| Type = [Class] ClassWithDestructor
# 2153| ValueCategory = prvalue(load)
# 2153| getArgument(0).getFullyConverted(): [TemporaryObjectExpr] temporary object
# 2153| Type = [Class] ClassWithDestructor
# 2153| ValueCategory = lvalue
# 2153| getChild(1): [DeclStmt] declaration
# 2153| getDeclarationEntry(0): [VariableDeclarationEntry] declaration of (__range)
# 2153| Type = [LValueReferenceType] vector<ClassWithDestructor> &
#-----| getVariable().getInitializer(): [Initializer] initializer for (__range)
@@ -16582,7 +16595,7 @@ ir.cpp:
# 2153| getQualifier(): [VariableAccess] (__begin)
# 2153| Type = [NestedStruct] iterator
# 2153| ValueCategory = lvalue
# 2153| getChild(4): [DeclStmt] declaration
# 2153| getChild(5): [DeclStmt] declaration
# 2153| getDeclarationEntry(0): [VariableDeclarationEntry] definition of y
# 2153| Type = [Class] ClassWithDestructor
# 2153| getVariable().getInitializer(): [Initializer] initializer for y

View File

@@ -12708,85 +12708,98 @@ ir.cpp:
# 2152| m2152_6(unknown) = Chi : total:m2150_1, partial:m2152_5
# 2152| m2152_7(ClassWithDestructor) = ^IndirectMayWriteSideEffect[-1] : &:r2152_1
# 2152| m2152_8(ClassWithDestructor) = Chi : total:m2152_2, partial:m2152_7
# 2153| r2153_1(glval<vector<ClassWithDestructor> &>) = VariableAddress[(__range)] :
# 2153| r2153_2(glval<vector<ClassWithDestructor>>) = VariableAddress :
# 2153| r2153_3(vector<ClassWithDestructor> &) = CopyValue : r2153_2
# 2153| m2153_4(vector<ClassWithDestructor> &) = Store[(__range)] : &:r2153_1, r2153_3
# 2153| r2153_5(glval<iterator>) = VariableAddress[(__begin)] :
# 2153| r2153_6(glval<vector<ClassWithDestructor> &>) = VariableAddress[(__range)] :
# 2153| r2153_7(vector<ClassWithDestructor> &) = Load[(__range)] : &:r2153_6, m2153_4
#-----| r0_1(glval<vector<ClassWithDestructor>>) = CopyValue : r2153_7
#-----| r0_2(glval<vector<ClassWithDestructor>>) = Convert : r0_1
# 2153| r2153_8(glval<unknown>) = FunctionAddress[begin] :
# 2153| r2153_9(iterator) = Call[begin] : func:r2153_8, this:r0_2
# 2153| r2153_1(glval<vector<ClassWithDestructor>>) = VariableAddress[ys] :
# 2153| m2153_2(vector<ClassWithDestructor>) = Uninitialized[ys] : &:r2153_1
# 2153| r2153_3(glval<unknown>) = FunctionAddress[vector] :
# 2153| r2153_4(glval<ClassWithDestructor>) = VariableAddress[#temp2153:40] :
# 2153| r2153_5(glval<ClassWithDestructor>) = VariableAddress[x] :
# 2153| r2153_6(ClassWithDestructor) = Load[x] : &:r2153_5, m2152_8
# 2153| m2153_7(ClassWithDestructor) = Store[#temp2153:40] : &:r2153_4, r2153_6
# 2153| r2153_8(ClassWithDestructor) = Load[#temp2153:40] : &:r2153_4, m2153_7
# 2153| v2153_9(void) = Call[vector] : func:r2153_3, this:r2153_1, 0:r2153_8
# 2153| m2153_10(unknown) = ^CallSideEffect : ~m2152_6
# 2153| m2153_11(unknown) = Chi : total:m2152_6, partial:m2153_10
#-----| v0_3(void) = ^IndirectReadSideEffect[-1] : &:r0_2, ~m2153_11
# 2153| m2153_12(iterator) = Store[(__begin)] : &:r2153_5, r2153_9
# 2153| r2153_13(glval<iterator>) = VariableAddress[(__end)] :
# 2153| m2153_12(vector<ClassWithDestructor>) = ^IndirectMayWriteSideEffect[-1] : &:r2153_1
# 2153| m2153_13(vector<ClassWithDestructor>) = Chi : total:m2153_2, partial:m2153_12
# 2153| r2153_14(glval<vector<ClassWithDestructor> &>) = VariableAddress[(__range)] :
# 2153| r2153_15(vector<ClassWithDestructor> &) = Load[(__range)] : &:r2153_14, m2153_4
#-----| r0_4(glval<vector<ClassWithDestructor>>) = CopyValue : r2153_15
# 2153| r2153_15(glval<vector<ClassWithDestructor>>) = VariableAddress[ys] :
# 2153| r2153_16(vector<ClassWithDestructor> &) = CopyValue : r2153_15
# 2153| m2153_17(vector<ClassWithDestructor> &) = Store[(__range)] : &:r2153_14, r2153_16
# 2153| r2153_18(glval<iterator>) = VariableAddress[(__begin)] :
# 2153| r2153_19(glval<vector<ClassWithDestructor> &>) = VariableAddress[(__range)] :
# 2153| r2153_20(vector<ClassWithDestructor> &) = Load[(__range)] : &:r2153_19, m2153_17
#-----| r0_1(glval<vector<ClassWithDestructor>>) = CopyValue : r2153_20
#-----| r0_2(glval<vector<ClassWithDestructor>>) = Convert : r0_1
# 2153| r2153_21(glval<unknown>) = FunctionAddress[begin] :
# 2153| r2153_22(iterator) = Call[begin] : func:r2153_21, this:r0_2
# 2153| m2153_23(unknown) = ^CallSideEffect : ~m2153_11
# 2153| m2153_24(unknown) = Chi : total:m2153_11, partial:m2153_23
#-----| v0_3(void) = ^IndirectReadSideEffect[-1] : &:r0_2, m2153_13
# 2153| m2153_25(iterator) = Store[(__begin)] : &:r2153_18, r2153_22
# 2153| r2153_26(glval<iterator>) = VariableAddress[(__end)] :
# 2153| r2153_27(glval<vector<ClassWithDestructor> &>) = VariableAddress[(__range)] :
# 2153| r2153_28(vector<ClassWithDestructor> &) = Load[(__range)] : &:r2153_27, m2153_17
#-----| r0_4(glval<vector<ClassWithDestructor>>) = CopyValue : r2153_28
#-----| r0_5(glval<vector<ClassWithDestructor>>) = Convert : r0_4
# 2153| r2153_16(glval<unknown>) = FunctionAddress[end] :
# 2153| r2153_17(iterator) = Call[end] : func:r2153_16, this:r0_5
# 2153| m2153_18(unknown) = ^CallSideEffect : ~m2153_11
# 2153| m2153_19(unknown) = Chi : total:m2153_11, partial:m2153_18
#-----| v0_6(void) = ^IndirectReadSideEffect[-1] : &:r0_5, ~m2153_19
# 2153| m2153_20(iterator) = Store[(__end)] : &:r2153_13, r2153_17
# 2153| r2153_29(glval<unknown>) = FunctionAddress[end] :
# 2153| r2153_30(iterator) = Call[end] : func:r2153_29, this:r0_5
# 2153| m2153_31(unknown) = ^CallSideEffect : ~m2153_24
# 2153| m2153_32(unknown) = Chi : total:m2153_24, partial:m2153_31
#-----| v0_6(void) = ^IndirectReadSideEffect[-1] : &:r0_5, m2153_13
# 2153| m2153_33(iterator) = Store[(__end)] : &:r2153_26, r2153_30
#-----| Goto -> Block 7
# 2153| Block 7
# 2153| m2153_21(iterator) = Phi : from 6:m2153_12, from 8:m2153_46
# 2153| m2153_22(unknown) = Phi : from 6:~m2153_19, from 8:~m2153_43
# 2153| r2153_23(glval<iterator>) = VariableAddress[(__begin)] :
#-----| r0_7(glval<iterator>) = Convert : r2153_23
# 2153| r2153_24(glval<unknown>) = FunctionAddress[operator!=] :
# 2153| r2153_25(glval<iterator>) = VariableAddress[(__end)] :
# 2153| r2153_26(iterator) = Load[(__end)] : &:r2153_25, m2153_20
# 2153| r2153_27(bool) = Call[operator!=] : func:r2153_24, this:r0_7, 0:r2153_26
# 2153| m2153_28(unknown) = ^CallSideEffect : ~m2153_22
# 2153| m2153_29(unknown) = Chi : total:m2153_22, partial:m2153_28
#-----| v0_8(void) = ^IndirectReadSideEffect[-1] : &:r0_7, m2153_21
# 2153| v2153_30(void) = ConditionalBranch : r2153_27
# 2153| m2153_34(iterator) = Phi : from 6:m2153_25, from 8:m2153_59
# 2153| m2153_35(unknown) = Phi : from 6:~m2153_32, from 8:~m2153_56
# 2153| r2153_36(glval<iterator>) = VariableAddress[(__begin)] :
#-----| r0_7(glval<iterator>) = Convert : r2153_36
# 2153| r2153_37(glval<unknown>) = FunctionAddress[operator!=] :
# 2153| r2153_38(glval<iterator>) = VariableAddress[(__end)] :
# 2153| r2153_39(iterator) = Load[(__end)] : &:r2153_38, m2153_33
# 2153| r2153_40(bool) = Call[operator!=] : func:r2153_37, this:r0_7, 0:r2153_39
# 2153| m2153_41(unknown) = ^CallSideEffect : ~m2153_35
# 2153| m2153_42(unknown) = Chi : total:m2153_35, partial:m2153_41
#-----| v0_8(void) = ^IndirectReadSideEffect[-1] : &:r0_7, m2153_34
# 2153| v2153_43(void) = ConditionalBranch : r2153_40
#-----| False -> Block 9
#-----| True -> Block 8
# 2153| Block 8
# 2153| r2153_31(glval<ClassWithDestructor>) = VariableAddress[y] :
# 2153| r2153_32(glval<iterator>) = VariableAddress[(__begin)] :
#-----| r0_9(glval<iterator>) = Convert : r2153_32
# 2153| r2153_33(glval<unknown>) = FunctionAddress[operator*] :
# 2153| r2153_34(ClassWithDestructor &) = Call[operator*] : func:r2153_33, this:r0_9
# 2153| m2153_35(unknown) = ^CallSideEffect : ~m2153_29
# 2153| m2153_36(unknown) = Chi : total:m2153_29, partial:m2153_35
#-----| v0_10(void) = ^IndirectReadSideEffect[-1] : &:r0_9, m2153_21
# 2153| r2153_37(ClassWithDestructor) = Load[?] : &:r2153_34, ~m2153_36
# 2153| m2153_38(ClassWithDestructor) = Store[y] : &:r2153_31, r2153_37
# 2153| r2153_44(glval<ClassWithDestructor>) = VariableAddress[y] :
# 2153| r2153_45(glval<iterator>) = VariableAddress[(__begin)] :
#-----| r0_9(glval<iterator>) = Convert : r2153_45
# 2153| r2153_46(glval<unknown>) = FunctionAddress[operator*] :
# 2153| r2153_47(ClassWithDestructor &) = Call[operator*] : func:r2153_46, this:r0_9
# 2153| m2153_48(unknown) = ^CallSideEffect : ~m2153_42
# 2153| m2153_49(unknown) = Chi : total:m2153_42, partial:m2153_48
#-----| v0_10(void) = ^IndirectReadSideEffect[-1] : &:r0_9, m2153_34
# 2153| r2153_50(ClassWithDestructor) = Load[?] : &:r2153_47, ~m2153_49
# 2153| m2153_51(ClassWithDestructor) = Store[y] : &:r2153_44, r2153_50
# 2154| r2154_1(glval<ClassWithDestructor>) = VariableAddress[y] :
# 2154| r2154_2(glval<unknown>) = FunctionAddress[set_x] :
# 2154| r2154_3(char) = Constant[97] :
# 2154| v2154_4(void) = Call[set_x] : func:r2154_2, this:r2154_1, 0:r2154_3
# 2154| m2154_5(unknown) = ^CallSideEffect : ~m2153_36
# 2154| m2154_6(unknown) = Chi : total:m2153_36, partial:m2154_5
# 2154| v2154_7(void) = ^IndirectReadSideEffect[-1] : &:r2154_1, m2153_38
# 2154| m2154_5(unknown) = ^CallSideEffect : ~m2153_49
# 2154| m2154_6(unknown) = Chi : total:m2153_49, partial:m2154_5
# 2154| v2154_7(void) = ^IndirectReadSideEffect[-1] : &:r2154_1, m2153_51
# 2154| m2154_8(ClassWithDestructor) = ^IndirectMayWriteSideEffect[-1] : &:r2154_1
# 2154| m2154_9(ClassWithDestructor) = Chi : total:m2153_38, partial:m2154_8
# 2153| r2153_39(glval<iterator>) = VariableAddress[(__begin)] :
# 2153| r2153_40(glval<unknown>) = FunctionAddress[operator++] :
# 2153| r2153_41(iterator &) = Call[operator++] : func:r2153_40, this:r2153_39
# 2153| m2153_42(unknown) = ^CallSideEffect : ~m2154_6
# 2153| m2153_43(unknown) = Chi : total:m2154_6, partial:m2153_42
# 2153| v2153_44(void) = ^IndirectReadSideEffect[-1] : &:r2153_39, m2153_21
# 2153| m2153_45(iterator) = ^IndirectMayWriteSideEffect[-1] : &:r2153_39
# 2153| m2153_46(iterator) = Chi : total:m2153_21, partial:m2153_45
# 2153| r2153_47(glval<iterator>) = CopyValue : r2153_41
# 2154| m2154_9(ClassWithDestructor) = Chi : total:m2153_51, partial:m2154_8
# 2153| r2153_52(glval<iterator>) = VariableAddress[(__begin)] :
# 2153| r2153_53(glval<unknown>) = FunctionAddress[operator++] :
# 2153| r2153_54(iterator &) = Call[operator++] : func:r2153_53, this:r2153_52
# 2153| m2153_55(unknown) = ^CallSideEffect : ~m2154_6
# 2153| m2153_56(unknown) = Chi : total:m2154_6, partial:m2153_55
# 2153| v2153_57(void) = ^IndirectReadSideEffect[-1] : &:r2153_52, m2153_34
# 2153| m2153_58(iterator) = ^IndirectMayWriteSideEffect[-1] : &:r2153_52
# 2153| m2153_59(iterator) = Chi : total:m2153_34, partial:m2153_58
# 2153| r2153_60(glval<iterator>) = CopyValue : r2153_54
#-----| Goto (back edge) -> Block 7
# 2155| Block 9
# 2155| v2155_1(void) = NoOp :
# 2136| v2136_9(void) = ReturnVoid :
# 2136| v2136_10(void) = AliasedUse : ~m2153_29
# 2136| v2136_10(void) = AliasedUse : ~m2153_42
# 2136| v2136_11(void) = ExitFunction :
# 2136| Block 10

View File

@@ -28,5 +28,4 @@ nonUniqueEnclosingIRFunction
fieldAddressOnNonPointer
thisArgumentIsNonPointer
nonUniqueIRVariable
| ir.cpp:2153:68:2153:69 | VariableAddress: ys | Variable address instruction 'VariableAddress: ys' has no associated variable, in function '$@'. | ir.cpp:2136:6:2136:35 | void initialization_with_destructor(bool, char) | void initialization_with_destructor(bool, char) |
missingCppType

View File

@@ -28,5 +28,4 @@ nonUniqueEnclosingIRFunction
fieldAddressOnNonPointer
thisArgumentIsNonPointer
nonUniqueIRVariable
| ir.cpp:2153:68:2153:69 | VariableAddress: ys | Variable address instruction 'VariableAddress: ys' has no associated variable, in function '$@'. | ir.cpp:2136:6:2136:35 | void initialization_with_destructor(bool, char) | void initialization_with_destructor(bool, char) |
missingCppType

View File

@@ -874,8 +874,10 @@
| file://:0:0:0:0 | SideEffect | m1080_23 |
| file://:0:0:0:0 | SideEffect | m1086_23 |
| file://:0:0:0:0 | SideEffect | m1086_23 |
| file://:0:0:0:0 | SideEffect | m2153_21 |
| file://:0:0:0:0 | SideEffect | m2153_21 |
| file://:0:0:0:0 | SideEffect | m2153_13 |
| file://:0:0:0:0 | SideEffect | m2153_13 |
| file://:0:0:0:0 | SideEffect | m2153_34 |
| file://:0:0:0:0 | SideEffect | m2153_34 |
| file://:0:0:0:0 | SideEffect | ~m0_4 |
| file://:0:0:0:0 | SideEffect | ~m0_4 |
| file://:0:0:0:0 | SideEffect | ~m0_4 |
@@ -892,8 +894,6 @@
| file://:0:0:0:0 | SideEffect | ~m1242_4 |
| file://:0:0:0:0 | SideEffect | ~m1449_6 |
| file://:0:0:0:0 | SideEffect | ~m1841_8 |
| file://:0:0:0:0 | SideEffect | ~m2153_11 |
| file://:0:0:0:0 | SideEffect | ~m2153_19 |
| file://:0:0:0:0 | StoreValue | r0_1 |
| file://:0:0:0:0 | StoreValue | r0_1 |
| file://:0:0:0:0 | StoreValue | r0_1 |
@@ -10194,7 +10194,7 @@
| ir.cpp:2134:54:2134:57 | StoreValue | r2134_4 |
| ir.cpp:2136:6:2136:35 | ChiPartial | partial:m2136_3 |
| ir.cpp:2136:6:2136:35 | ChiTotal | total:m2136_2 |
| ir.cpp:2136:6:2136:35 | SideEffect | ~m2153_29 |
| ir.cpp:2136:6:2136:35 | SideEffect | ~m2153_42 |
| ir.cpp:2136:42:2136:42 | Address | &:r2136_5 |
| ir.cpp:2136:50:2136:50 | Address | &:r2136_7 |
| ir.cpp:2137:29:2137:29 | Address | &:r2137_1 |
@@ -10289,74 +10289,90 @@
| ir.cpp:2152:25:2152:25 | ChiTotal | total:m2150_1 |
| ir.cpp:2152:25:2152:25 | ChiTotal | total:m2152_2 |
| ir.cpp:2152:25:2152:25 | SideEffect | ~m2150_1 |
| ir.cpp:2153:5:2153:5 | Address | &:r2153_1 |
| ir.cpp:2153:5:2153:5 | Address | &:r2153_5 |
| ir.cpp:2153:5:2153:5 | Address | &:r2153_13 |
| ir.cpp:2153:64:2153:64 | Address | &:r2153_31 |
| ir.cpp:2153:68:2153:68 | Address | &:r2153_6 |
| ir.cpp:2153:68:2153:68 | Address | &:r2153_14 |
| ir.cpp:2153:68:2153:68 | Address | &:r2153_25 |
| ir.cpp:2153:68:2153:68 | Address | &:r2153_34 |
| ir.cpp:2153:68:2153:68 | Address | &:r2153_39 |
| ir.cpp:2153:68:2153:68 | Address | &:r2153_39 |
| ir.cpp:2153:68:2153:68 | Arg(0) | 0:r2153_26 |
| ir.cpp:2153:5:2153:5 | Address | &:r2153_14 |
| ir.cpp:2153:5:2153:5 | Address | &:r2153_18 |
| ir.cpp:2153:5:2153:5 | Address | &:r2153_26 |
| ir.cpp:2153:37:2153:38 | Address | &:r2153_1 |
| ir.cpp:2153:37:2153:38 | Address | &:r2153_1 |
| ir.cpp:2153:37:2153:38 | Arg(this) | this:r2153_1 |
| ir.cpp:2153:40:2153:40 | Address | &:r2153_4 |
| ir.cpp:2153:40:2153:40 | Address | &:r2153_4 |
| ir.cpp:2153:40:2153:40 | Address | &:r2153_5 |
| ir.cpp:2153:40:2153:40 | Arg(0) | 0:r2153_8 |
| ir.cpp:2153:40:2153:40 | Load | m2152_8 |
| ir.cpp:2153:40:2153:40 | Load | m2153_7 |
| ir.cpp:2153:40:2153:40 | StoreValue | r2153_6 |
| ir.cpp:2153:40:2153:41 | CallTarget | func:r2153_3 |
| ir.cpp:2153:40:2153:41 | ChiPartial | partial:m2153_10 |
| ir.cpp:2153:40:2153:41 | ChiPartial | partial:m2153_12 |
| ir.cpp:2153:40:2153:41 | ChiTotal | total:m2152_6 |
| ir.cpp:2153:40:2153:41 | ChiTotal | total:m2153_2 |
| ir.cpp:2153:40:2153:41 | SideEffect | ~m2152_6 |
| ir.cpp:2153:64:2153:64 | Address | &:r2153_44 |
| ir.cpp:2153:68:2153:68 | Address | &:r2153_19 |
| ir.cpp:2153:68:2153:68 | Address | &:r2153_27 |
| ir.cpp:2153:68:2153:68 | Address | &:r2153_38 |
| ir.cpp:2153:68:2153:68 | Address | &:r2153_47 |
| ir.cpp:2153:68:2153:68 | Address | &:r2153_52 |
| ir.cpp:2153:68:2153:68 | Address | &:r2153_52 |
| ir.cpp:2153:68:2153:68 | Arg(0) | 0:r2153_39 |
| ir.cpp:2153:68:2153:68 | Arg(this) | this:r0_2 |
| ir.cpp:2153:68:2153:68 | Arg(this) | this:r0_5 |
| ir.cpp:2153:68:2153:68 | Arg(this) | this:r0_7 |
| ir.cpp:2153:68:2153:68 | Arg(this) | this:r0_9 |
| ir.cpp:2153:68:2153:68 | Arg(this) | this:r2153_39 |
| ir.cpp:2153:68:2153:68 | CallTarget | func:r2153_8 |
| ir.cpp:2153:68:2153:68 | CallTarget | func:r2153_16 |
| ir.cpp:2153:68:2153:68 | CallTarget | func:r2153_24 |
| ir.cpp:2153:68:2153:68 | CallTarget | func:r2153_33 |
| ir.cpp:2153:68:2153:68 | CallTarget | func:r2153_40 |
| ir.cpp:2153:68:2153:68 | ChiPartial | partial:m2153_10 |
| ir.cpp:2153:68:2153:68 | ChiPartial | partial:m2153_18 |
| ir.cpp:2153:68:2153:68 | ChiPartial | partial:m2153_28 |
| ir.cpp:2153:68:2153:68 | ChiPartial | partial:m2153_35 |
| ir.cpp:2153:68:2153:68 | ChiPartial | partial:m2153_42 |
| ir.cpp:2153:68:2153:68 | ChiPartial | partial:m2153_45 |
| ir.cpp:2153:68:2153:68 | ChiTotal | total:m2152_6 |
| ir.cpp:2153:68:2153:68 | Arg(this) | this:r2153_52 |
| ir.cpp:2153:68:2153:68 | CallTarget | func:r2153_21 |
| ir.cpp:2153:68:2153:68 | CallTarget | func:r2153_29 |
| ir.cpp:2153:68:2153:68 | CallTarget | func:r2153_37 |
| ir.cpp:2153:68:2153:68 | CallTarget | func:r2153_46 |
| ir.cpp:2153:68:2153:68 | CallTarget | func:r2153_53 |
| ir.cpp:2153:68:2153:68 | ChiPartial | partial:m2153_23 |
| ir.cpp:2153:68:2153:68 | ChiPartial | partial:m2153_31 |
| ir.cpp:2153:68:2153:68 | ChiPartial | partial:m2153_41 |
| ir.cpp:2153:68:2153:68 | ChiPartial | partial:m2153_48 |
| ir.cpp:2153:68:2153:68 | ChiPartial | partial:m2153_55 |
| ir.cpp:2153:68:2153:68 | ChiPartial | partial:m2153_58 |
| ir.cpp:2153:68:2153:68 | ChiTotal | total:m2153_11 |
| ir.cpp:2153:68:2153:68 | ChiTotal | total:m2153_21 |
| ir.cpp:2153:68:2153:68 | ChiTotal | total:m2153_22 |
| ir.cpp:2153:68:2153:68 | ChiTotal | total:m2153_29 |
| ir.cpp:2153:68:2153:68 | ChiTotal | total:m2153_24 |
| ir.cpp:2153:68:2153:68 | ChiTotal | total:m2153_34 |
| ir.cpp:2153:68:2153:68 | ChiTotal | total:m2153_35 |
| ir.cpp:2153:68:2153:68 | ChiTotal | total:m2153_42 |
| ir.cpp:2153:68:2153:68 | ChiTotal | total:m2154_6 |
| ir.cpp:2153:68:2153:68 | Condition | r2153_27 |
| ir.cpp:2153:68:2153:68 | Load | m2153_4 |
| ir.cpp:2153:68:2153:68 | Load | m2153_4 |
| ir.cpp:2153:68:2153:68 | Load | m2153_20 |
| ir.cpp:2153:68:2153:68 | Phi | from 6:m2153_12 |
| ir.cpp:2153:68:2153:68 | Phi | from 6:~m2153_19 |
| ir.cpp:2153:68:2153:68 | Phi | from 8:m2153_46 |
| ir.cpp:2153:68:2153:68 | Phi | from 8:~m2153_43 |
| ir.cpp:2153:68:2153:68 | SideEffect | m2153_21 |
| ir.cpp:2153:68:2153:68 | SideEffect | ~m2152_6 |
| ir.cpp:2153:68:2153:68 | Condition | r2153_40 |
| ir.cpp:2153:68:2153:68 | Load | m2153_17 |
| ir.cpp:2153:68:2153:68 | Load | m2153_17 |
| ir.cpp:2153:68:2153:68 | Load | m2153_33 |
| ir.cpp:2153:68:2153:68 | Phi | from 6:m2153_25 |
| ir.cpp:2153:68:2153:68 | Phi | from 6:~m2153_32 |
| ir.cpp:2153:68:2153:68 | Phi | from 8:m2153_59 |
| ir.cpp:2153:68:2153:68 | Phi | from 8:~m2153_56 |
| ir.cpp:2153:68:2153:68 | SideEffect | m2153_34 |
| ir.cpp:2153:68:2153:68 | SideEffect | ~m2153_11 |
| ir.cpp:2153:68:2153:68 | SideEffect | ~m2153_22 |
| ir.cpp:2153:68:2153:68 | SideEffect | ~m2153_29 |
| ir.cpp:2153:68:2153:68 | SideEffect | ~m2153_24 |
| ir.cpp:2153:68:2153:68 | SideEffect | ~m2153_35 |
| ir.cpp:2153:68:2153:68 | SideEffect | ~m2153_42 |
| ir.cpp:2153:68:2153:68 | SideEffect | ~m2154_6 |
| ir.cpp:2153:68:2153:68 | StoreValue | r2153_9 |
| ir.cpp:2153:68:2153:68 | StoreValue | r2153_17 |
| ir.cpp:2153:68:2153:68 | Unary | r2153_7 |
| ir.cpp:2153:68:2153:68 | Unary | r2153_15 |
| ir.cpp:2153:68:2153:68 | Unary | r2153_23 |
| ir.cpp:2153:68:2153:68 | Unary | r2153_32 |
| ir.cpp:2153:68:2153:68 | Unary | r2153_41 |
| ir.cpp:2153:68:2153:69 | StoreValue | r2153_3 |
| ir.cpp:2153:68:2153:69 | Unary | r2153_2 |
| ir.cpp:2153:68:2153:70 | Load | ~m2153_36 |
| ir.cpp:2153:68:2153:70 | StoreValue | r2153_37 |
| ir.cpp:2153:68:2153:68 | StoreValue | r2153_22 |
| ir.cpp:2153:68:2153:68 | StoreValue | r2153_30 |
| ir.cpp:2153:68:2153:68 | Unary | r2153_20 |
| ir.cpp:2153:68:2153:68 | Unary | r2153_28 |
| ir.cpp:2153:68:2153:68 | Unary | r2153_36 |
| ir.cpp:2153:68:2153:68 | Unary | r2153_45 |
| ir.cpp:2153:68:2153:68 | Unary | r2153_54 |
| ir.cpp:2153:68:2153:69 | StoreValue | r2153_16 |
| ir.cpp:2153:68:2153:69 | Unary | r2153_15 |
| ir.cpp:2153:68:2153:70 | Load | ~m2153_49 |
| ir.cpp:2153:68:2153:70 | StoreValue | r2153_50 |
| ir.cpp:2154:7:2154:7 | Address | &:r2154_1 |
| ir.cpp:2154:7:2154:7 | Address | &:r2154_1 |
| ir.cpp:2154:7:2154:7 | Arg(this) | this:r2154_1 |
| ir.cpp:2154:7:2154:7 | ChiPartial | partial:m2154_8 |
| ir.cpp:2154:7:2154:7 | ChiTotal | total:m2153_38 |
| ir.cpp:2154:7:2154:7 | SideEffect | m2153_38 |
| ir.cpp:2154:7:2154:7 | ChiTotal | total:m2153_51 |
| ir.cpp:2154:7:2154:7 | SideEffect | m2153_51 |
| ir.cpp:2154:9:2154:13 | CallTarget | func:r2154_2 |
| ir.cpp:2154:9:2154:13 | ChiPartial | partial:m2154_5 |
| ir.cpp:2154:9:2154:13 | ChiTotal | total:m2153_36 |
| ir.cpp:2154:9:2154:13 | SideEffect | ~m2153_36 |
| ir.cpp:2154:9:2154:13 | ChiTotal | total:m2153_49 |
| ir.cpp:2154:9:2154:13 | SideEffect | ~m2153_49 |
| ir.cpp:2154:15:2154:17 | Arg(0) | 0:r2154_3 |
| perf-regression.cpp:6:3:6:5 | Address | &:r6_5 |
| perf-regression.cpp:6:3:6:5 | Address | &:r6_5 |

View File

@@ -37,5 +37,4 @@ nonUniqueEnclosingIRFunction
fieldAddressOnNonPointer
thisArgumentIsNonPointer
nonUniqueIRVariable
| ir.cpp:2153:68:2153:69 | VariableAddress: ys | Variable address instruction 'VariableAddress: ys' has no associated variable, in function '$@'. | ir.cpp:2136:6:2136:35 | void initialization_with_destructor(bool, char) | void initialization_with_destructor(bool, char) |
missingCppType

View File

@@ -11885,55 +11885,66 @@ ir.cpp:
# 2152| v2152_4(void) = Call[ClassWithDestructor] : func:r2152_3, this:r2152_1
# 2152| mu2152_5(unknown) = ^CallSideEffect : ~m?
# 2152| mu2152_6(ClassWithDestructor) = ^IndirectMayWriteSideEffect[-1] : &:r2152_1
# 2153| r2153_1(glval<vector<ClassWithDestructor> &>) = VariableAddress[(__range)] :
# 2153| r2153_2(glval<vector<ClassWithDestructor>>) = VariableAddress :
# 2153| r2153_3(vector<ClassWithDestructor> &) = CopyValue : r2153_2
# 2153| mu2153_4(vector<ClassWithDestructor> &) = Store[(__range)] : &:r2153_1, r2153_3
# 2153| r2153_5(glval<iterator>) = VariableAddress[(__begin)] :
# 2153| r2153_6(glval<vector<ClassWithDestructor> &>) = VariableAddress[(__range)] :
# 2153| r2153_7(vector<ClassWithDestructor> &) = Load[(__range)] : &:r2153_6, ~m?
#-----| r0_1(glval<vector<ClassWithDestructor>>) = CopyValue : r2153_7
#-----| r0_2(glval<vector<ClassWithDestructor>>) = Convert : r0_1
# 2153| r2153_8(glval<unknown>) = FunctionAddress[begin] :
# 2153| r2153_9(iterator) = Call[begin] : func:r2153_8, this:r0_2
# 2153| r2153_1(glval<vector<ClassWithDestructor>>) = VariableAddress[ys] :
# 2153| mu2153_2(vector<ClassWithDestructor>) = Uninitialized[ys] : &:r2153_1
# 2153| r2153_3(glval<unknown>) = FunctionAddress[vector] :
# 2153| r2153_4(glval<ClassWithDestructor>) = VariableAddress[#temp2153:40] :
# 2153| r2153_5(glval<ClassWithDestructor>) = VariableAddress[x] :
# 2153| r2153_6(ClassWithDestructor) = Load[x] : &:r2153_5, ~m?
# 2153| mu2153_7(ClassWithDestructor) = Store[#temp2153:40] : &:r2153_4, r2153_6
# 2153| r2153_8(ClassWithDestructor) = Load[#temp2153:40] : &:r2153_4, ~m?
# 2153| v2153_9(void) = Call[vector] : func:r2153_3, this:r2153_1, 0:r2153_8
# 2153| mu2153_10(unknown) = ^CallSideEffect : ~m?
# 2153| mu2153_11(vector<ClassWithDestructor>) = ^IndirectMayWriteSideEffect[-1] : &:r2153_1
# 2153| r2153_12(glval<vector<ClassWithDestructor> &>) = VariableAddress[(__range)] :
# 2153| r2153_13(glval<vector<ClassWithDestructor>>) = VariableAddress[ys] :
# 2153| r2153_14(vector<ClassWithDestructor> &) = CopyValue : r2153_13
# 2153| mu2153_15(vector<ClassWithDestructor> &) = Store[(__range)] : &:r2153_12, r2153_14
# 2153| r2153_16(glval<iterator>) = VariableAddress[(__begin)] :
# 2153| r2153_17(glval<vector<ClassWithDestructor> &>) = VariableAddress[(__range)] :
# 2153| r2153_18(vector<ClassWithDestructor> &) = Load[(__range)] : &:r2153_17, ~m?
#-----| r0_1(glval<vector<ClassWithDestructor>>) = CopyValue : r2153_18
#-----| r0_2(glval<vector<ClassWithDestructor>>) = Convert : r0_1
# 2153| r2153_19(glval<unknown>) = FunctionAddress[begin] :
# 2153| r2153_20(iterator) = Call[begin] : func:r2153_19, this:r0_2
# 2153| mu2153_21(unknown) = ^CallSideEffect : ~m?
#-----| v0_3(void) = ^IndirectReadSideEffect[-1] : &:r0_2, ~m?
# 2153| mu2153_11(iterator) = Store[(__begin)] : &:r2153_5, r2153_9
# 2153| r2153_12(glval<iterator>) = VariableAddress[(__end)] :
# 2153| r2153_13(glval<vector<ClassWithDestructor> &>) = VariableAddress[(__range)] :
# 2153| r2153_14(vector<ClassWithDestructor> &) = Load[(__range)] : &:r2153_13, ~m?
#-----| r0_4(glval<vector<ClassWithDestructor>>) = CopyValue : r2153_14
# 2153| mu2153_22(iterator) = Store[(__begin)] : &:r2153_16, r2153_20
# 2153| r2153_23(glval<iterator>) = VariableAddress[(__end)] :
# 2153| r2153_24(glval<vector<ClassWithDestructor> &>) = VariableAddress[(__range)] :
# 2153| r2153_25(vector<ClassWithDestructor> &) = Load[(__range)] : &:r2153_24, ~m?
#-----| r0_4(glval<vector<ClassWithDestructor>>) = CopyValue : r2153_25
#-----| r0_5(glval<vector<ClassWithDestructor>>) = Convert : r0_4
# 2153| r2153_15(glval<unknown>) = FunctionAddress[end] :
# 2153| r2153_16(iterator) = Call[end] : func:r2153_15, this:r0_5
# 2153| mu2153_17(unknown) = ^CallSideEffect : ~m?
# 2153| r2153_26(glval<unknown>) = FunctionAddress[end] :
# 2153| r2153_27(iterator) = Call[end] : func:r2153_26, this:r0_5
# 2153| mu2153_28(unknown) = ^CallSideEffect : ~m?
#-----| v0_6(void) = ^IndirectReadSideEffect[-1] : &:r0_5, ~m?
# 2153| mu2153_18(iterator) = Store[(__end)] : &:r2153_12, r2153_16
# 2153| mu2153_29(iterator) = Store[(__end)] : &:r2153_23, r2153_27
#-----| Goto -> Block 8
# 2153| Block 8
# 2153| r2153_19(glval<iterator>) = VariableAddress[(__begin)] :
#-----| r0_7(glval<iterator>) = Convert : r2153_19
# 2153| r2153_20(glval<unknown>) = FunctionAddress[operator!=] :
# 2153| r2153_21(glval<iterator>) = VariableAddress[(__end)] :
# 2153| r2153_22(iterator) = Load[(__end)] : &:r2153_21, ~m?
# 2153| r2153_23(bool) = Call[operator!=] : func:r2153_20, this:r0_7, 0:r2153_22
# 2153| mu2153_24(unknown) = ^CallSideEffect : ~m?
# 2153| r2153_30(glval<iterator>) = VariableAddress[(__begin)] :
#-----| r0_7(glval<iterator>) = Convert : r2153_30
# 2153| r2153_31(glval<unknown>) = FunctionAddress[operator!=] :
# 2153| r2153_32(glval<iterator>) = VariableAddress[(__end)] :
# 2153| r2153_33(iterator) = Load[(__end)] : &:r2153_32, ~m?
# 2153| r2153_34(bool) = Call[operator!=] : func:r2153_31, this:r0_7, 0:r2153_33
# 2153| mu2153_35(unknown) = ^CallSideEffect : ~m?
#-----| v0_8(void) = ^IndirectReadSideEffect[-1] : &:r0_7, ~m?
# 2153| v2153_25(void) = ConditionalBranch : r2153_23
# 2153| v2153_36(void) = ConditionalBranch : r2153_34
#-----| False -> Block 10
#-----| True -> Block 9
# 2153| Block 9
# 2153| r2153_26(glval<ClassWithDestructor>) = VariableAddress[y] :
# 2153| r2153_27(glval<iterator>) = VariableAddress[(__begin)] :
#-----| r0_9(glval<iterator>) = Convert : r2153_27
# 2153| r2153_28(glval<unknown>) = FunctionAddress[operator*] :
# 2153| r2153_29(ClassWithDestructor &) = Call[operator*] : func:r2153_28, this:r0_9
# 2153| mu2153_30(unknown) = ^CallSideEffect : ~m?
# 2153| r2153_37(glval<ClassWithDestructor>) = VariableAddress[y] :
# 2153| r2153_38(glval<iterator>) = VariableAddress[(__begin)] :
#-----| r0_9(glval<iterator>) = Convert : r2153_38
# 2153| r2153_39(glval<unknown>) = FunctionAddress[operator*] :
# 2153| r2153_40(ClassWithDestructor &) = Call[operator*] : func:r2153_39, this:r0_9
# 2153| mu2153_41(unknown) = ^CallSideEffect : ~m?
#-----| v0_10(void) = ^IndirectReadSideEffect[-1] : &:r0_9, ~m?
# 2153| r2153_31(ClassWithDestructor) = Load[?] : &:r2153_29, ~m?
# 2153| mu2153_32(ClassWithDestructor) = Store[y] : &:r2153_26, r2153_31
# 2153| r2153_42(ClassWithDestructor) = Load[?] : &:r2153_40, ~m?
# 2153| mu2153_43(ClassWithDestructor) = Store[y] : &:r2153_37, r2153_42
# 2154| r2154_1(glval<ClassWithDestructor>) = VariableAddress[y] :
# 2154| r2154_2(glval<unknown>) = FunctionAddress[set_x] :
# 2154| r2154_3(char) = Constant[97] :
@@ -11941,13 +11952,13 @@ ir.cpp:
# 2154| mu2154_5(unknown) = ^CallSideEffect : ~m?
# 2154| v2154_6(void) = ^IndirectReadSideEffect[-1] : &:r2154_1, ~m?
# 2154| mu2154_7(ClassWithDestructor) = ^IndirectMayWriteSideEffect[-1] : &:r2154_1
# 2153| r2153_33(glval<iterator>) = VariableAddress[(__begin)] :
# 2153| r2153_34(glval<unknown>) = FunctionAddress[operator++] :
# 2153| r2153_35(iterator &) = Call[operator++] : func:r2153_34, this:r2153_33
# 2153| mu2153_36(unknown) = ^CallSideEffect : ~m?
# 2153| v2153_37(void) = ^IndirectReadSideEffect[-1] : &:r2153_33, ~m?
# 2153| mu2153_38(iterator) = ^IndirectMayWriteSideEffect[-1] : &:r2153_33
# 2153| r2153_39(glval<iterator>) = CopyValue : r2153_35
# 2153| r2153_44(glval<iterator>) = VariableAddress[(__begin)] :
# 2153| r2153_45(glval<unknown>) = FunctionAddress[operator++] :
# 2153| r2153_46(iterator &) = Call[operator++] : func:r2153_45, this:r2153_44
# 2153| mu2153_47(unknown) = ^CallSideEffect : ~m?
# 2153| v2153_48(void) = ^IndirectReadSideEffect[-1] : &:r2153_44, ~m?
# 2153| mu2153_49(iterator) = ^IndirectMayWriteSideEffect[-1] : &:r2153_44
# 2153| r2153_50(glval<iterator>) = CopyValue : r2153_46
#-----| Goto (back edge) -> Block 8
# 2155| Block 10

View File

@@ -28,5 +28,4 @@ nonUniqueEnclosingIRFunction
fieldAddressOnNonPointer
thisArgumentIsNonPointer
nonUniqueIRVariable
| ir.cpp:2153:68:2153:69 | VariableAddress: ys | Variable address instruction 'VariableAddress: ys' has no associated variable, in function '$@'. | ir.cpp:2136:6:2136:35 | void initialization_with_destructor(bool, char) | void initialization_with_destructor(bool, char) |
missingCppType

View File

@@ -28,5 +28,4 @@ nonUniqueEnclosingIRFunction
fieldAddressOnNonPointer
thisArgumentIsNonPointer
nonUniqueIRVariable
| ir.cpp:2153:68:2153:69 | VariableAddress: ys | Variable address instruction 'VariableAddress: ys' has no associated variable, in function '$@'. | ir.cpp:2136:6:2136:35 | void initialization_with_destructor(bool, char) | void initialization_with_destructor(bool, char) |
missingCppType

View File

@@ -0,0 +1,85 @@
| | forstmt01.cpp:3:6:3:14 | for_loop1 | 0 | 1 | file://:0:0:0:0 | file://:0:0:0:0 | file://:0:0:0:0 | (const iterator)... | <none> |
| | forstmt01.cpp:3:6:3:14 | for_loop1 | 0 | 1 | file://:0:0:0:0 | file://:0:0:0:0 | file://:0:0:0:0 | (const iterator)... | <none> |
| | forstmt01.cpp:3:6:3:14 | for_loop1 | 0 | 1 | file://:0:0:0:0 | file://:0:0:0:0 | file://:0:0:0:0 | (const vector<int>)... | <none> |
| | forstmt01.cpp:3:6:3:14 | for_loop1 | 0 | 1 | file://:0:0:0:0 | file://:0:0:0:0 | file://:0:0:0:0 | (const vector<int>)... | <none> |
| | forstmt01.cpp:3:6:3:14 | for_loop1 | 0 | 1 | file://:0:0:0:0 | file://:0:0:0:0 | file://:0:0:0:0 | (reference dereference) | <none> |
| | forstmt01.cpp:3:6:3:14 | for_loop1 | 0 | 1 | file://:0:0:0:0 | file://:0:0:0:0 | file://:0:0:0:0 | (reference dereference) | <none> |
| | forstmt01.cpp:3:6:3:14 | for_loop1 | 0 | 5 | file://:0:0:0:0 | file://:0:0:0:0 | file://:0:0:0:0 | initializer for (__range) | 4: declaration |
| | forstmt01.cpp:3:6:3:14 | for_loop1 | 0 | 9 | file://:0:0:0:0 | file://:0:0:0:0 | file://:0:0:0:0 | initializer for (__begin) | 5: (__range) |
| | forstmt01.cpp:3:6:3:14 | for_loop1 | 0 | 12 | file://:0:0:0:0 | file://:0:0:0:0 | file://:0:0:0:0 | initializer for (__end) | 5: (__end) |
| | forstmt02.cpp:3:6:3:14 | for_loop2 | 0 | 1 | file://:0:0:0:0 | file://:0:0:0:0 | file://:0:0:0:0 | (const iterator)... | <none> |
| | forstmt02.cpp:3:6:3:14 | for_loop2 | 0 | 1 | file://:0:0:0:0 | file://:0:0:0:0 | file://:0:0:0:0 | (const iterator)... | <none> |
| | forstmt02.cpp:3:6:3:14 | for_loop2 | 0 | 1 | file://:0:0:0:0 | file://:0:0:0:0 | file://:0:0:0:0 | (const vector<int>)... | <none> |
| | forstmt02.cpp:3:6:3:14 | for_loop2 | 0 | 1 | file://:0:0:0:0 | file://:0:0:0:0 | file://:0:0:0:0 | (const vector<int>)... | <none> |
| | forstmt02.cpp:3:6:3:14 | for_loop2 | 0 | 1 | file://:0:0:0:0 | file://:0:0:0:0 | file://:0:0:0:0 | (reference dereference) | <none> |
| | forstmt02.cpp:3:6:3:14 | for_loop2 | 0 | 1 | file://:0:0:0:0 | file://:0:0:0:0 | file://:0:0:0:0 | (reference dereference) | <none> |
| | forstmt02.cpp:3:6:3:14 | for_loop2 | 0 | 8 | file://:0:0:0:0 | file://:0:0:0:0 | file://:0:0:0:0 | initializer for (__range) | 4: declaration |
| | forstmt02.cpp:3:6:3:14 | for_loop2 | 0 | 12 | file://:0:0:0:0 | file://:0:0:0:0 | file://:0:0:0:0 | initializer for (__begin) | 6: (__range) |
| | forstmt02.cpp:3:6:3:14 | for_loop2 | 0 | 15 | file://:0:0:0:0 | file://:0:0:0:0 | file://:0:0:0:0 | initializer for (__end) | 6: (__end) |
| forstmt | forstmt.h:2:8:2:8 | operator= | 2 | 1 | forstmt.h:2:8:2:8 | forstmt.h:2:8:2:8 | forstmt.h:2:8:2:8 | operator= | <none> |
| forstmt | forstmt.h:2:8:2:8 | operator= | 2 | 1 | forstmt.h:2:8:2:8 | forstmt.h:2:8:2:8 | forstmt.h:2:8:2:8 | operator= | <none> |
| forstmt | forstmt.h:3:12:3:12 | operator= | 3 | 1 | forstmt.h:3:12:3:12 | forstmt.h:3:12:3:12 | forstmt.h:3:12:3:12 | operator= | <none> |
| forstmt | forstmt.h:3:12:3:12 | operator= | 3 | 1 | forstmt.h:3:12:3:12 | forstmt.h:3:12:3:12 | forstmt.h:3:12:3:12 | operator= | <none> |
| forstmt | forstmt.h:4:19:4:28 | operator++ | 4 | 1 | forstmt.h:4:19:4:28 | forstmt.h:4:19:4:28 | forstmt.h:4:19:4:28 | operator++ | <none> |
| forstmt | forstmt.h:4:19:4:28 | operator++ | 4 | 1 | forstmt.h:4:19:4:28 | forstmt.h:4:19:4:28 | forstmt.h:4:19:4:28 | operator++ | <none> |
| forstmt | forstmt.h:5:12:5:20 | operator* | 5 | 1 | forstmt.h:5:12:5:20 | forstmt.h:5:12:5:20 | forstmt.h:5:12:5:20 | operator* | <none> |
| forstmt | forstmt.h:5:12:5:20 | operator* | 5 | 1 | forstmt.h:5:12:5:20 | forstmt.h:5:12:5:20 | forstmt.h:5:12:5:20 | operator* | <none> |
| forstmt | forstmt.h:7:14:7:23 | operator!= | 7 | 1 | forstmt.h:7:14:7:23 | forstmt.h:7:14:7:23 | forstmt.h:7:14:7:23 | operator!= | <none> |
| forstmt | forstmt.h:7:14:7:23 | operator!= | 7 | 1 | forstmt.h:7:14:7:23 | forstmt.h:7:14:7:23 | forstmt.h:7:14:7:23 | operator!= | <none> |
| forstmt | forstmt.h:10:14:10:18 | begin | 10 | 1 | forstmt.h:10:14:10:18 | forstmt.h:10:14:10:18 | forstmt.h:10:14:10:18 | begin | <none> |
| forstmt | forstmt.h:10:14:10:18 | begin | 10 | 1 | forstmt.h:10:14:10:18 | forstmt.h:10:14:10:18 | forstmt.h:10:14:10:18 | begin | <none> |
| forstmt | forstmt.h:11:14:11:16 | end | 11 | 1 | forstmt.h:11:14:11:16 | forstmt.h:11:14:11:16 | forstmt.h:11:14:11:16 | end | <none> |
| forstmt | forstmt.h:11:14:11:16 | end | 11 | 1 | forstmt.h:11:14:11:16 | forstmt.h:11:14:11:16 | forstmt.h:11:14:11:16 | end | <none> |
| forstmt01 | forstmt01.cpp:3:6:3:14 | for_loop1 | 3 | 1 | forstmt01.cpp:3:39:9:1 | forstmt01.cpp:3:39:9:1 | forstmt01.cpp:3:39:9:1 | { ... } | 4: for(...:...) ... |
| forstmt01 | forstmt01.cpp:3:6:3:14 | for_loop1 | 4 | 2 | forstmt01.cpp:4:5:8:9 | forstmt01.cpp:4:5:8:9 | forstmt01.cpp:4:5:8:9 | for(...:...) ... | 4: declaration |
| forstmt01 | forstmt01.cpp:3:6:3:14 | for_loop1 | 4 | 3 | forstmt01.cpp:4:5:8:9 | forstmt01.cpp:4:5:8:9 | forstmt01.cpp:4:5:8:9 | declaration | 5: zs |
| forstmt01 | forstmt01.cpp:3:6:3:14 | for_loop1 | 4 | 6 | forstmt01.cpp:4:5:8:9 | forstmt01.cpp:4:5:8:9 | forstmt01.cpp:4:5:8:9 | declaration | 5: (__range) |
| forstmt01 | forstmt01.cpp:3:6:3:14 | for_loop1 | 4 | 22 | forstmt01.cpp:4:5:8:9 | forstmt01.cpp:4:5:8:9 | forstmt01.cpp:4:5:8:9 | declaration | 5: (__begin) |
| forstmt01 | forstmt01.cpp:3:6:3:14 | for_loop1 | 5 | 1 | forstmt01.cpp:5:18:5:19 | forstmt01.cpp:5:18:5:19 | forstmt01.cpp:5:18:5:19 | (reference to) | <none> |
| forstmt01 | forstmt01.cpp:3:6:3:14 | for_loop1 | 5 | 1 | forstmt01.cpp:5:18:6:9 | forstmt01.cpp:5:18:6:9 | forstmt01.cpp:5:18:6:9 | (reference dereference) | <none> |
| forstmt01 | forstmt01.cpp:3:6:3:14 | for_loop1 | 5 | 1 | forstmt01.cpp:5:18:6:9 | forstmt01.cpp:5:18:6:9 | forstmt01.cpp:5:18:6:9 | (reference dereference) | <none> |
| forstmt01 | forstmt01.cpp:3:6:3:14 | for_loop1 | 5 | 4 | forstmt01.cpp:5:18:5:19 | forstmt01.cpp:5:18:5:19 | forstmt01.cpp:5:18:5:19 | zs | 0: initializer for (__range) |
| forstmt01 | forstmt01.cpp:3:6:3:14 | for_loop1 | 5 | 7 | forstmt01.cpp:5:18:5:18 | forstmt01.cpp:5:18:5:18 | forstmt01.cpp:5:18:5:18 | (__range) | 5: call to begin |
| forstmt01 | forstmt01.cpp:3:6:3:14 | for_loop1 | 5 | 8 | forstmt01.cpp:5:18:5:18 | forstmt01.cpp:5:18:5:18 | forstmt01.cpp:5:18:5:18 | call to begin | 0: initializer for (__begin) |
| forstmt01 | forstmt01.cpp:3:6:3:14 | for_loop1 | 5 | 10 | forstmt01.cpp:5:18:5:18 | forstmt01.cpp:5:18:5:18 | forstmt01.cpp:5:18:5:18 | (__range) | 5: call to end |
| forstmt01 | forstmt01.cpp:3:6:3:14 | for_loop1 | 5 | 11 | forstmt01.cpp:5:18:5:18 | forstmt01.cpp:5:18:5:18 | forstmt01.cpp:5:18:5:18 | call to end | 0: initializer for (__end) |
| forstmt01 | forstmt01.cpp:3:6:3:14 | for_loop1 | 5 | 22 | forstmt01.cpp:5:14:5:14 | forstmt01.cpp:5:14:5:14 | forstmt01.cpp:5:14:5:14 | initializer for z | 7: { ... } |
| forstmt01 | forstmt01.cpp:3:6:3:14 | for_loop1 | 5 | 22 | forstmt01.cpp:5:18:5:18 | forstmt01.cpp:5:18:5:18 | forstmt01.cpp:5:18:5:18 | (__begin) | 5: call to operator!= |
| forstmt01 | forstmt01.cpp:3:6:3:14 | for_loop1 | 5 | 22 | forstmt01.cpp:5:18:5:18 | forstmt01.cpp:5:18:5:18 | forstmt01.cpp:5:18:5:18 | (__begin) | 5: call to operator* |
| forstmt01 | forstmt01.cpp:3:6:3:14 | for_loop1 | 5 | 22 | forstmt01.cpp:5:18:5:18 | forstmt01.cpp:5:18:5:18 | forstmt01.cpp:5:18:5:18 | (__begin) | 5: call to operator++ |
| forstmt01 | forstmt01.cpp:3:6:3:14 | for_loop1 | 5 | 22 | forstmt01.cpp:5:18:5:18 | forstmt01.cpp:5:18:5:18 | forstmt01.cpp:5:18:5:18 | (__end) | 5: (__begin) |
| forstmt01 | forstmt01.cpp:3:6:3:14 | for_loop1 | 5 | 22 | forstmt01.cpp:5:18:5:18 | forstmt01.cpp:5:18:5:18 | forstmt01.cpp:5:18:5:18 | call to operator!= | <false> 9: return ... |
| forstmt01 | forstmt01.cpp:3:6:3:14 | for_loop1 | 5 | 22 | forstmt01.cpp:5:18:5:18 | forstmt01.cpp:5:18:5:18 | forstmt01.cpp:5:18:5:18 | call to operator!= | <true> 4: declaration |
| forstmt01 | forstmt01.cpp:3:6:3:14 | for_loop1 | 5 | 22 | forstmt01.cpp:5:18:5:18 | forstmt01.cpp:5:18:5:18 | forstmt01.cpp:5:18:5:18 | call to operator* | 5: initializer for z |
| forstmt01 | forstmt01.cpp:3:6:3:14 | for_loop1 | 5 | 22 | forstmt01.cpp:5:18:5:18 | forstmt01.cpp:5:18:5:18 | forstmt01.cpp:5:18:5:18 | call to operator++ | 5: (__end) |
| forstmt01 | forstmt01.cpp:3:6:3:14 | for_loop1 | 7 | 22 | forstmt01.cpp:7:9:8:9 | forstmt01.cpp:7:9:8:9 | forstmt01.cpp:7:9:8:9 | { ... } | 5: (__begin) |
| forstmt01 | forstmt01.cpp:3:6:3:14 | for_loop1 | 9 | 23 | forstmt01.cpp:9:1:9:1 | forstmt01.cpp:9:1:9:1 | forstmt01.cpp:9:1:9:1 | return ... | 9: for_loop1 |
| forstmt01 | forstmt01.cpp:3:6:3:14 | for_loop1 | 9 | 24 | forstmt01.cpp:3:6:3:14 | forstmt01.cpp:3:6:3:14 | forstmt01.cpp:3:6:3:14 | for_loop1 | <none> |
| forstmt02 | forstmt02.cpp:3:6:3:14 | for_loop2 | 3 | 1 | forstmt02.cpp:3:39:10:1 | forstmt02.cpp:3:39:10:1 | forstmt02.cpp:3:39:10:1 | { ... } | 4: for(...:...) ... |
| forstmt02 | forstmt02.cpp:3:6:3:14 | for_loop2 | 4 | 2 | forstmt02.cpp:4:5:9:9 | forstmt02.cpp:4:5:9:9 | forstmt02.cpp:4:5:9:9 | for(...:...) ... | 5: declaration |
| forstmt02 | forstmt02.cpp:3:6:3:14 | for_loop2 | 4 | 6 | forstmt02.cpp:4:5:9:9 | forstmt02.cpp:4:5:9:9 | forstmt02.cpp:4:5:9:9 | declaration | 6: zs |
| forstmt02 | forstmt02.cpp:3:6:3:14 | for_loop2 | 4 | 9 | forstmt02.cpp:4:5:9:9 | forstmt02.cpp:4:5:9:9 | forstmt02.cpp:4:5:9:9 | declaration | 6: (__range) |
| forstmt02 | forstmt02.cpp:3:6:3:14 | for_loop2 | 4 | 25 | forstmt02.cpp:4:5:9:9 | forstmt02.cpp:4:5:9:9 | forstmt02.cpp:4:5:9:9 | declaration | 6: (__begin) |
| forstmt02 | forstmt02.cpp:3:6:3:14 | for_loop2 | 5 | 3 | forstmt02.cpp:5:9:5:18 | forstmt02.cpp:5:9:5:18 | forstmt02.cpp:5:9:5:18 | declaration | 5: initializer for y |
| forstmt02 | forstmt02.cpp:3:6:3:14 | for_loop2 | 5 | 4 | forstmt02.cpp:5:16:5:17 | forstmt02.cpp:5:16:5:17 | forstmt02.cpp:5:16:5:17 | initializer for y | 5: x |
| forstmt02 | forstmt02.cpp:3:6:3:14 | for_loop2 | 5 | 5 | forstmt02.cpp:5:17:5:17 | forstmt02.cpp:5:17:5:17 | forstmt02.cpp:5:17:5:17 | x | 4: declaration |
| forstmt02 | forstmt02.cpp:3:6:3:14 | for_loop2 | 6 | 1 | forstmt02.cpp:6:18:6:19 | forstmt02.cpp:6:18:6:19 | forstmt02.cpp:6:18:6:19 | (reference to) | <none> |
| forstmt02 | forstmt02.cpp:3:6:3:14 | for_loop2 | 6 | 1 | forstmt02.cpp:6:18:7:9 | forstmt02.cpp:6:18:7:9 | forstmt02.cpp:6:18:7:9 | (reference dereference) | <none> |
| forstmt02 | forstmt02.cpp:3:6:3:14 | for_loop2 | 6 | 1 | forstmt02.cpp:6:18:7:9 | forstmt02.cpp:6:18:7:9 | forstmt02.cpp:6:18:7:9 | (reference dereference) | <none> |
| forstmt02 | forstmt02.cpp:3:6:3:14 | for_loop2 | 6 | 7 | forstmt02.cpp:6:18:6:19 | forstmt02.cpp:6:18:6:19 | forstmt02.cpp:6:18:6:19 | zs | 0: initializer for (__range) |
| forstmt02 | forstmt02.cpp:3:6:3:14 | for_loop2 | 6 | 10 | forstmt02.cpp:6:18:6:18 | forstmt02.cpp:6:18:6:18 | forstmt02.cpp:6:18:6:18 | (__range) | 6: call to begin |
| forstmt02 | forstmt02.cpp:3:6:3:14 | for_loop2 | 6 | 11 | forstmt02.cpp:6:18:6:18 | forstmt02.cpp:6:18:6:18 | forstmt02.cpp:6:18:6:18 | call to begin | 0: initializer for (__begin) |
| forstmt02 | forstmt02.cpp:3:6:3:14 | for_loop2 | 6 | 13 | forstmt02.cpp:6:18:6:18 | forstmt02.cpp:6:18:6:18 | forstmt02.cpp:6:18:6:18 | (__range) | 6: call to end |
| forstmt02 | forstmt02.cpp:3:6:3:14 | for_loop2 | 6 | 14 | forstmt02.cpp:6:18:6:18 | forstmt02.cpp:6:18:6:18 | forstmt02.cpp:6:18:6:18 | call to end | 0: initializer for (__end) |
| forstmt02 | forstmt02.cpp:3:6:3:14 | for_loop2 | 6 | 25 | forstmt02.cpp:6:14:6:14 | forstmt02.cpp:6:14:6:14 | forstmt02.cpp:6:14:6:14 | initializer for z | 8: { ... } |
| forstmt02 | forstmt02.cpp:3:6:3:14 | for_loop2 | 6 | 25 | forstmt02.cpp:6:18:6:18 | forstmt02.cpp:6:18:6:18 | forstmt02.cpp:6:18:6:18 | (__begin) | 6: call to operator!= |
| forstmt02 | forstmt02.cpp:3:6:3:14 | for_loop2 | 6 | 25 | forstmt02.cpp:6:18:6:18 | forstmt02.cpp:6:18:6:18 | forstmt02.cpp:6:18:6:18 | (__begin) | 6: call to operator* |
| forstmt02 | forstmt02.cpp:3:6:3:14 | for_loop2 | 6 | 25 | forstmt02.cpp:6:18:6:18 | forstmt02.cpp:6:18:6:18 | forstmt02.cpp:6:18:6:18 | (__begin) | 6: call to operator++ |
| forstmt02 | forstmt02.cpp:3:6:3:14 | for_loop2 | 6 | 25 | forstmt02.cpp:6:18:6:18 | forstmt02.cpp:6:18:6:18 | forstmt02.cpp:6:18:6:18 | (__end) | 6: (__begin) |
| forstmt02 | forstmt02.cpp:3:6:3:14 | for_loop2 | 6 | 25 | forstmt02.cpp:6:18:6:18 | forstmt02.cpp:6:18:6:18 | forstmt02.cpp:6:18:6:18 | call to operator!= | <false> 10: return ... |
| forstmt02 | forstmt02.cpp:3:6:3:14 | for_loop2 | 6 | 25 | forstmt02.cpp:6:18:6:18 | forstmt02.cpp:6:18:6:18 | forstmt02.cpp:6:18:6:18 | call to operator!= | <true> 4: declaration |
| forstmt02 | forstmt02.cpp:3:6:3:14 | for_loop2 | 6 | 25 | forstmt02.cpp:6:18:6:18 | forstmt02.cpp:6:18:6:18 | forstmt02.cpp:6:18:6:18 | call to operator* | 6: initializer for z |
| forstmt02 | forstmt02.cpp:3:6:3:14 | for_loop2 | 6 | 25 | forstmt02.cpp:6:18:6:18 | forstmt02.cpp:6:18:6:18 | forstmt02.cpp:6:18:6:18 | call to operator++ | 6: (__end) |
| forstmt02 | forstmt02.cpp:3:6:3:14 | for_loop2 | 8 | 25 | forstmt02.cpp:8:9:9:9 | forstmt02.cpp:8:9:9:9 | forstmt02.cpp:8:9:9:9 | { ... } | 6: (__begin) |
| forstmt02 | forstmt02.cpp:3:6:3:14 | for_loop2 | 10 | 26 | forstmt02.cpp:10:1:10:1 | forstmt02.cpp:10:1:10:1 | forstmt02.cpp:10:1:10:1 | return ... | 10: for_loop2 |
| forstmt02 | forstmt02.cpp:3:6:3:14 | for_loop2 | 10 | 27 | forstmt02.cpp:3:6:3:14 | forstmt02.cpp:3:6:3:14 | forstmt02.cpp:3:6:3:14 | for_loop2 | <none> |

View File

@@ -0,0 +1,28 @@
import cpp
int getCFLine(ControlFlowNode n) {
if n instanceof Function
then
// Functions appear at the end of the control flow, so we get
// nicer results if we take the last position in the function,
// rather than the function's position (which is the start).
result = max(ControlFlowNode c | c.getControlFlowScope() = n | c.getLocation().getStartLine())
else result = n.getLocation().getStartLine()
}
string getASuccessorOrNone(ControlFlowNode n) {
if exists(n.getASuccessor())
then
exists(ControlFlowNode s, string trueSucc, string falseSucc |
s = n.getASuccessor() and
(if s = n.getATrueSuccessor() then trueSucc = "<true> " else trueSucc = "") and
(if s = n.getAFalseSuccessor() then falseSucc = "<false> " else falseSucc = "") and
result = trueSucc + falseSucc + getCFLine(s) + ": " + s.toString()
)
else result = "<none>"
}
from ControlFlowNode n
select n.getLocation().getFile().getShortName(), n.getControlFlowScope(), getCFLine(n),
count(n.getAPredecessor*()), // This helps order things sensibly
n.getLocation(), n, getASuccessorOrNone(n)

View File

@@ -0,0 +1,12 @@
template<typename T>
struct vector {
struct iterator {
iterator& operator++();
T& operator*() const;
bool operator!=(iterator right) const;
};
iterator begin() const;
iterator end() const;
};

View File

@@ -0,0 +1,9 @@
#include "forstmt.h"
void for_loop1(int x, vector<int> zs) {
for (
auto z : zs
)
{
}
}

View File

@@ -0,0 +1,12 @@
#include "forstmt.h"
void for_loop2(int x, vector<int> zs) {
for (
int y = x;
auto z : zs
)
{
}
}
// semmle-extractor-options: -std=c++20