diff --git a/cpp/ql/test/library-tests/functions/functions/Functions2.expected b/cpp/ql/test/library-tests/functions/functions/Functions2.expected index 7dbd0c5de8b..5db2b61ec94 100644 --- a/cpp/ql/test/library-tests/functions/functions/Functions2.expected +++ b/cpp/ql/test/library-tests/functions/functions/Functions2.expected @@ -1,23 +1,20 @@ -| ODASA-5186.cpp:4:8:4:14 | MyClass | Class | ODASA-5186.cpp:5:8:5:17 | operator== | member function | -| ODASA-5186.cpp:4:8:4:14 | MyClass | Struct | ODASA-5186.cpp:4:8:4:8 | operator= | member function | -| ODASA-5186.cpp:4:8:4:14 | MyClass | Struct | ODASA-5186.cpp:4:8:4:8 | operator= | member function | -| ODASA-5186.cpp:4:8:4:14 | MyClass | Struct | ODASA-5186.cpp:5:8:5:8 | operator== | member function | -| ODASA-5186.hpp:2:8:2:17 | NEQ_helper> | Struct | ODASA-5186.hpp:2:8:2:8 | operator= | member function | -| ODASA-5186.hpp:2:8:2:17 | NEQ_helper> | Struct | ODASA-5186.hpp:2:8:2:8 | operator= | member function | -| file://:0:0:0:0 | __va_list_tag | Struct | file://:0:0:0:0 | operator= | member function | -| file://:0:0:0:0 | __va_list_tag | Struct | file://:0:0:0:0 | operator= | member function | -| functions.cpp:7:8:7:8 | A | Struct | functions.cpp:7:8:7:8 | operator= | member function | -| functions.cpp:7:8:7:8 | A | Struct | functions.cpp:7:8:7:8 | operator= | member function | -| functions.cpp:7:8:7:8 | A | Struct | functions.cpp:8:7:8:8 | af | member function | -| functions.cpp:7:8:7:8 | A | Struct | functions.cpp:11:7:11:8 | ag | member function | -| functions.cpp:19:7:19:10 | Name | Class | functions.cpp:19:7:19:7 | operator= | member function | -| functions.cpp:19:7:19:10 | Name | Class | functions.cpp:19:7:19:7 | operator= | member function | -| functions.cpp:23:7:23:11 | Table | Class | functions.cpp:23:7:23:7 | Table | constructor | -| functions.cpp:23:7:23:11 | Table | Class | functions.cpp:23:7:23:7 | Table | member function | -| functions.cpp:23:7:23:11 | Table | Class | functions.cpp:23:7:23:7 | operator= | member function | -| functions.cpp:23:7:23:11 | Table | Class | functions.cpp:27:3:27:7 | Table | constructor | -| functions.cpp:23:7:23:11 | Table | Class | functions.cpp:27:3:27:7 | Table | member function | -| functions.cpp:23:7:23:11 | Table | Class | functions.cpp:28:3:28:8 | ~Table | destructor | -| functions.cpp:23:7:23:11 | Table | Class | functions.cpp:28:3:28:8 | ~Table | member function | -| functions.cpp:23:7:23:11 | Table | Class | functions.cpp:29:9:29:14 | lookup | member function | -| functions.cpp:23:7:23:11 | Table | Class | functions.cpp:30:8:30:13 | insert | member function | +| ODASA-5186.cpp:4:8:4:14 | MyClass | Class | ODASA-5186.cpp:5:8:5:17 | operator== | | +| ODASA-5186.cpp:4:8:4:14 | MyClass | Struct | ODASA-5186.cpp:4:8:4:8 | operator= | | +| ODASA-5186.cpp:4:8:4:14 | MyClass | Struct | ODASA-5186.cpp:4:8:4:8 | operator= | | +| ODASA-5186.cpp:4:8:4:14 | MyClass | Struct | ODASA-5186.cpp:5:8:5:8 | operator== | | +| ODASA-5186.hpp:2:8:2:17 | NEQ_helper> | Struct | ODASA-5186.hpp:2:8:2:8 | operator= | | +| ODASA-5186.hpp:2:8:2:17 | NEQ_helper> | Struct | ODASA-5186.hpp:2:8:2:8 | operator= | | +| file://:0:0:0:0 | __va_list_tag | Struct | file://:0:0:0:0 | operator= | | +| file://:0:0:0:0 | __va_list_tag | Struct | file://:0:0:0:0 | operator= | | +| functions.cpp:7:8:7:8 | A | Struct | functions.cpp:7:8:7:8 | operator= | | +| functions.cpp:7:8:7:8 | A | Struct | functions.cpp:7:8:7:8 | operator= | | +| functions.cpp:7:8:7:8 | A | Struct | functions.cpp:8:7:8:8 | af | | +| functions.cpp:7:8:7:8 | A | Struct | functions.cpp:11:7:11:8 | ag | | +| functions.cpp:19:7:19:10 | Name | Class | functions.cpp:19:7:19:7 | operator= | | +| functions.cpp:19:7:19:10 | Name | Class | functions.cpp:19:7:19:7 | operator= | | +| functions.cpp:23:7:23:11 | Table | Class | functions.cpp:23:7:23:7 | Table | Constructor, CopyConstructor, getAConstructor() | +| functions.cpp:23:7:23:11 | Table | Class | functions.cpp:23:7:23:7 | operator= | | +| functions.cpp:23:7:23:11 | Table | Class | functions.cpp:27:3:27:7 | Table | Constructor, getAConstructor() | +| functions.cpp:23:7:23:11 | Table | Class | functions.cpp:28:3:28:8 | ~Table | Destructor, getDestructor() | +| functions.cpp:23:7:23:11 | Table | Class | functions.cpp:29:9:29:14 | lookup | | +| functions.cpp:23:7:23:11 | Table | Class | functions.cpp:30:8:30:13 | insert | | diff --git a/cpp/ql/test/library-tests/functions/functions/Functions2.ql b/cpp/ql/test/library-tests/functions/functions/Functions2.ql index 1907f1b6733..86d9d6e9f1a 100644 --- a/cpp/ql/test/library-tests/functions/functions/Functions2.ql +++ b/cpp/ql/test/library-tests/functions/functions/Functions2.ql @@ -4,12 +4,41 @@ */ import cpp -from Class c, string ctype, MemberFunction f, string ftype -where - if c instanceof Struct then ctype = "Struct" else ctype = "Class" and +bindingset[c, f] string describe(Class c, MemberFunction f) +{ ( - (f = c.getAConstructor() and ftype = "constructor") or - (f = c.getDestructor() and ftype = "destructor") or - (f.getDeclaringType() = c and ftype = "member function") + f = c.getAConstructor() and + result = "getAConstructor()" + ) or ( + f = c.getDestructor() and + result = "getDestructor()" + ) or ( + f instanceof Constructor and + result = "Constructor" + ) or ( + f instanceof Destructor and + result = "Destructor" + ) or ( + f instanceof ConversionConstructor and + result = "ConversionConstructor" + ) or ( + f instanceof CopyConstructor and + result = "CopyConstructor" + ) or ( + f instanceof MoveConstructor and + result = "MoveConstructor" + ) or ( + f instanceof NoArgConstructor and + result = "NoArgConstructor" + ) or ( + f instanceof ConversionOperator and + result = "ConversionOperator" ) -select c, ctype, f, ftype +} + +from Class c, string ctype, MemberFunction f +where + f.getDeclaringType() = c and + if c instanceof Struct then ctype = "Struct" else ctype = "Class" +select + c, ctype, f, concat(describe(c, f), ", ")