Skip to content

Commit d5c7905

Browse files
authored
Merge pull request #19907 from github/idrissrio/no-string-representation
C++: fix `(no string representation)` for `ConstructorInit`
2 parents 1772193 + 62e55ed commit d5c7905

File tree

4 files changed

+9
-4
lines changed

4 files changed

+9
-4
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,8 @@ class VacuousDestructorCall extends Expr, @vacuous_destructor_call {
504504
*/
505505
class ConstructorInit extends Expr, @ctorinit {
506506
override string getAPrimaryQlClass() { result = "ConstructorInit" }
507+
508+
override string toString() { result = "constructor init" }
507509
}
508510

509511
/**
@@ -512,6 +514,8 @@ class ConstructorInit extends Expr, @ctorinit {
512514
*/
513515
class ConstructorBaseInit extends ConstructorInit, ConstructorCall {
514516
override string getAPrimaryQlClass() { result = "ConstructorBaseInit" }
517+
518+
override string toString() { result = "call to " + this.getTarget().getName() }
515519
}
516520

517521
/**

cpp/ql/test/library-tests/dataflow/taint-tests/localTaint.expected

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4717,7 +4717,7 @@ WARNING: module 'TaintTracking' has been deprecated and may be removed in future
47174717
| stl.h:292:30:292:40 | call to allocator | stl.h:292:21:292:41 | noexcept(...) | TAINT |
47184718
| stl.h:292:30:292:40 | call to allocator | stl.h:292:21:292:41 | noexcept(...) | TAINT |
47194719
| stl.h:292:30:292:40 | call to allocator | stl.h:292:21:292:41 | noexcept(...) | TAINT |
4720-
| stl.h:292:53:292:63 | 0 | stl.h:292:46:292:64 | (no string representation) | TAINT |
4720+
| stl.h:292:53:292:63 | 0 | stl.h:292:46:292:64 | constructor init | TAINT |
47214721
| stl.h:396:3:396:3 | this | stl.h:396:36:396:43 | constructor init of field first [pre-this] | |
47224722
| stl.h:396:3:396:3 | this | stl.h:396:36:396:43 | constructor init of field first [pre-this] | |
47234723
| stl.h:396:3:396:3 | this | stl.h:396:36:396:43 | constructor init of field first [pre-this] | |

cpp/ql/test/library-tests/ir/ir/PrintAST.expected

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15134,7 +15134,7 @@ ir.cpp:
1513415134
# 1506| [Constructor] void Inheritance_Test_A::Inheritance_Test_A()
1513515135
# 1506| <params>:
1513615136
# 1506| <initializations>:
15137-
# 1506| getInitializer(0): (no string representation)
15137+
# 1506| getInitializer(0): [ConstructorInit] constructor init
1513815138
# 1506| Type = [Struct] Inheritance_Test_B
1513915139
# 1506| ValueCategory = prvalue
1514015140
# 1506| getInitializer(1): [ConstructorFieldInit] constructor init of field x
@@ -17205,7 +17205,7 @@ ir.cpp:
1720517205
# 1785| getExpr(): [ReferenceDereferenceExpr] (reference dereference)
1720617206
# 1785| Type = [SpecifiedType] const CopyConstructorTestNonVirtualClass
1720717207
# 1785| ValueCategory = lvalue
17208-
# 1785| getInitializer(1): (no string representation)
17208+
# 1785| getInitializer(1): [ConstructorInit] constructor init
1720917209
# 1785| Type = [VirtualBaseClass] CopyConstructorWithBitwiseCopyClass
1721017210
# 1785| ValueCategory = prvalue
1721117211
# 1785| getEntryPoint(): [BlockStmt] { ... }
@@ -17254,7 +17254,7 @@ ir.cpp:
1725417254
# 1792| getExpr(): [ReferenceDereferenceExpr] (reference dereference)
1725517255
# 1792| Type = [SpecifiedType] const CopyConstructorTestVirtualClass
1725617256
# 1792| ValueCategory = lvalue
17257-
# 1792| getInitializer(1): (no string representation)
17257+
# 1792| getInitializer(1): [ConstructorInit] constructor init
1725817258
# 1792| Type = [VirtualBaseClass] CopyConstructorWithBitwiseCopyClass
1725917259
# 1792| ValueCategory = prvalue
1726017260
# 1792| getEntryPoint(): [BlockStmt] { ... }

cpp/ql/test/library-tests/ptr_to_member/segfault/exprs.expected

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
| file://:0:0:0:0 | uls | file://:0:0:0:0 | unsigned long |
55
| segfault.cpp:25:46:25:65 | call to S | file://:0:0:0:0 | void |
66
| segfault.cpp:25:46:25:65 | call to S | file://:0:0:0:0 | void |
7+
| segfault.cpp:25:46:25:65 | constructor init | segfault.cpp:22:8:22:8 | S<T> |
78
| segfault.cpp:25:48:25:55 | __second | segfault.cpp:15:7:15:11 | tuple |
89
| segfault.cpp:25:48:25:55 | __second | segfault.cpp:15:7:15:11 | tuple |
910
| segfault.cpp:25:48:25:55 | __second | segfault.cpp:15:7:15:11 | tuple |

0 commit comments

Comments
 (0)