From 72d03e40606018181c3e8bb2b986ffb6e59bd47e Mon Sep 17 00:00:00 2001 From: Jeroen Ketema Date: Mon, 6 Mar 2023 09:07:52 +0100 Subject: [PATCH] C++: Fix test that used deprecated function --- .../library-tests/CPP-205/elements.expected | 28 +++++++++---------- cpp/ql/test/library-tests/CPP-205/elements.ql | 10 ++++--- 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/cpp/ql/test/library-tests/CPP-205/elements.expected b/cpp/ql/test/library-tests/CPP-205/elements.expected index 8fbe5a0734f..f64b9d4e08b 100644 --- a/cpp/ql/test/library-tests/CPP-205/elements.expected +++ b/cpp/ql/test/library-tests/CPP-205/elements.expected @@ -1,14 +1,14 @@ | CPP-205.cpp:0:0:0:0 | CPP-205.cpp | | | CPP-205.cpp:1:20:1:20 | T | | | CPP-205.cpp:1:20:1:20 | definition of T | | -| CPP-205.cpp:2:5:2:5 | definition of fn | function declaration entry for fn(int) -> int | -| CPP-205.cpp:2:5:2:5 | fn | function fn(int) -> int | -| CPP-205.cpp:2:5:2:6 | definition of fn | function declaration entry for fn(T) -> int | -| CPP-205.cpp:2:5:2:6 | fn | function fn(T) -> int | -| CPP-205.cpp:2:10:2:12 | definition of out | parameter declaration entry for fn(T) -> int | -| CPP-205.cpp:2:10:2:12 | definition of out | parameter declaration entry for fn(int) -> int | -| CPP-205.cpp:2:10:2:12 | out | parameter for fn(T) -> int | -| CPP-205.cpp:2:10:2:12 | out | parameter for fn(int) -> int | +| CPP-205.cpp:2:5:2:5 | definition of fn | function declaration entry for int fn(int) | +| CPP-205.cpp:2:5:2:5 | fn | function int fn(int) | +| CPP-205.cpp:2:5:2:6 | definition of fn | function declaration entry for int fn(T) | +| CPP-205.cpp:2:5:2:6 | fn | function int fn(T) | +| CPP-205.cpp:2:10:2:12 | definition of out | parameter declaration entry for int fn(T) | +| CPP-205.cpp:2:10:2:12 | definition of out | parameter declaration entry for int fn(int) | +| CPP-205.cpp:2:10:2:12 | out | parameter for int fn(T) | +| CPP-205.cpp:2:10:2:12 | out | parameter for int fn(int) | | CPP-205.cpp:2:15:5:1 | { ... } | | | CPP-205.cpp:2:15:5:1 | { ... } | | | CPP-205.cpp:3:3:3:33 | declaration | | @@ -20,16 +20,16 @@ | CPP-205.cpp:4:3:4:11 | return ... | | | CPP-205.cpp:4:10:4:10 | 0 | | | CPP-205.cpp:4:10:4:10 | 0 | | -| CPP-205.cpp:7:5:7:8 | definition of main | function declaration entry for main() -> int | -| CPP-205.cpp:7:5:7:8 | main | function main() -> int | +| CPP-205.cpp:7:5:7:8 | definition of main | function declaration entry for int main() | +| CPP-205.cpp:7:5:7:8 | main | function int main() | | CPP-205.cpp:7:12:9:1 | { ... } | | | CPP-205.cpp:8:3:8:15 | return ... | | | CPP-205.cpp:8:10:8:11 | call to fn | | | CPP-205.cpp:8:13:8:13 | 0 | | -| file://:0:0:0:0 | (unnamed parameter 0) | parameter for __va_list_tag::operator=(__va_list_tag &&) -> __va_list_tag & | -| file://:0:0:0:0 | (unnamed parameter 0) | parameter for __va_list_tag::operator=(const __va_list_tag &) -> __va_list_tag & | +| file://:0:0:0:0 | (unnamed parameter 0) | parameter for __va_list_tag& __va_list_tag::operator=(__va_list_tag const&) | +| file://:0:0:0:0 | (unnamed parameter 0) | parameter for __va_list_tag& __va_list_tag::operator=(__va_list_tag&&) | | file://:0:0:0:0 | __super | | | file://:0:0:0:0 | __va_list_tag | | -| file://:0:0:0:0 | operator= | function __va_list_tag::operator=(__va_list_tag &&) -> __va_list_tag & | -| file://:0:0:0:0 | operator= | function __va_list_tag::operator=(const __va_list_tag &) -> __va_list_tag & | +| file://:0:0:0:0 | operator= | function __va_list_tag& __va_list_tag::operator=(__va_list_tag const&) | +| file://:0:0:0:0 | operator= | function __va_list_tag& __va_list_tag::operator=(__va_list_tag&&) | | file://:0:0:0:0 | y | | diff --git a/cpp/ql/test/library-tests/CPP-205/elements.ql b/cpp/ql/test/library-tests/CPP-205/elements.ql index 0b75bca9bb2..9388a799dbc 100644 --- a/cpp/ql/test/library-tests/CPP-205/elements.ql +++ b/cpp/ql/test/library-tests/CPP-205/elements.ql @@ -1,17 +1,19 @@ import cpp +import semmle.code.cpp.Print string describe(Element e) { - result = "function " + e.(Function).getFullSignature() + e instanceof Function and + result = "function " + getIdentityString(e) or result = "function declaration entry for " + - e.(FunctionDeclarationEntry).getFunction().getFullSignature() + getIdentityString(e.(FunctionDeclarationEntry).getFunction()) or - result = "parameter for " + e.(Parameter).getFunction().getFullSignature() + result = "parameter for " + getIdentityString(e.(Parameter).getFunction()) or result = "parameter declaration entry for " + - e.(ParameterDeclarationEntry).getFunctionDeclarationEntry().getFunction().getFullSignature() + getIdentityString(e.(ParameterDeclarationEntry).getFunctionDeclarationEntry().getFunction()) } from Element e