From c3cf4250790ffb7d23eb766dec91147f3472b752 Mon Sep 17 00:00:00 2001 From: Mathias Vorreiter Pedersen Date: Tue, 16 Apr 2024 16:24:08 +0100 Subject: [PATCH] C++: Use interpolation to avoid a bad join order. --- cpp/ql/src/Critical/GlobalUseBeforeInit.ql | 5 ++--- .../GlobalUseBeforeInit/GlobalUseBeforeInit.expected | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/cpp/ql/src/Critical/GlobalUseBeforeInit.ql b/cpp/ql/src/Critical/GlobalUseBeforeInit.ql index 7b27a8529ce9..e9a637bd7d73 100644 --- a/cpp/ql/src/Critical/GlobalUseBeforeInit.ql +++ b/cpp/ql/src/Critical/GlobalUseBeforeInit.ql @@ -110,6 +110,5 @@ from GlobalVariable v, Function f where uninitialisedBefore(v, f) and useFunc(v, f) -select f, - "The variable '" + v.getName() + "'" + - " is used in this function but may not be initialized when it is called." +select f, "The variable $@ is used in this function but may not be initialized when it is called.", + v, v.getName() diff --git a/cpp/ql/test/query-tests/Critical/GlobalUseBeforeInit/GlobalUseBeforeInit.expected b/cpp/ql/test/query-tests/Critical/GlobalUseBeforeInit/GlobalUseBeforeInit.expected index 789c03f902b3..c7c2d1ffad49 100644 --- a/cpp/ql/test/query-tests/Critical/GlobalUseBeforeInit/GlobalUseBeforeInit.expected +++ b/cpp/ql/test/query-tests/Critical/GlobalUseBeforeInit/GlobalUseBeforeInit.expected @@ -1 +1 @@ -| test.cpp:27:5:27:6 | f1 | The variable 'b' is used in this function but may not be initialized when it is called. | +| test.cpp:27:5:27:6 | f1 | The variable $@ is used in this function but may not be initialized when it is called. | test.cpp:14:5:14:5 | b | b |