From badfa1a5c5995af9cdefb87a00eb394607eddef8 Mon Sep 17 00:00:00 2001 From: Owen Mansel-Chan Date: Wed, 4 Mar 2026 11:40:58 +0000 Subject: [PATCH] C++: Inline expectation should have space after $ This was a regex-find-replace from `// \$(?! )` (using a negative lookahead) to `// $ `. --- .../test/library-tests/dataflow/fields/A.cpp | 2 +- .../test/library-tests/dataflow/fields/C.cpp | 4 ++-- .../test/library-tests/dataflow/fields/D.cpp | 2 +- .../dataflow/fields/by_reference.cpp | 10 ++++----- .../SimpleRangeAnalysis_tests.cpp | 22 +++++++++---------- 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/cpp/ql/test/library-tests/dataflow/fields/A.cpp b/cpp/ql/test/library-tests/dataflow/fields/A.cpp index a3a151576e5..d65fa7c543d 100644 --- a/cpp/ql/test/library-tests/dataflow/fields/A.cpp +++ b/cpp/ql/test/library-tests/dataflow/fields/A.cpp @@ -46,7 +46,7 @@ public: { C *c = new C(); B *b = B::make(c); - sink(b->c); // $ast,ir + sink(b->c); // $ ast,ir } void f2() diff --git a/cpp/ql/test/library-tests/dataflow/fields/C.cpp b/cpp/ql/test/library-tests/dataflow/fields/C.cpp index 96bbb25a3b6..6e5165caa9a 100644 --- a/cpp/ql/test/library-tests/dataflow/fields/C.cpp +++ b/cpp/ql/test/library-tests/dataflow/fields/C.cpp @@ -26,9 +26,9 @@ public: void func() { - sink(s1); // $ast,ir + sink(s1); // $ ast,ir sink(s2); // $ MISSING: ast,ir - sink(s3); // $ast,ir + sink(s3); // $ ast,ir sink(s4); // $ MISSING: ast,ir } }; diff --git a/cpp/ql/test/library-tests/dataflow/fields/D.cpp b/cpp/ql/test/library-tests/dataflow/fields/D.cpp index ee51e6e5428..b2c882a6982 100644 --- a/cpp/ql/test/library-tests/dataflow/fields/D.cpp +++ b/cpp/ql/test/library-tests/dataflow/fields/D.cpp @@ -19,7 +19,7 @@ public: }; static void sinkWrap(Box2* b2) { - sink(b2->getBox1()->getElem()); // $ast,ir=28:15 ast,ir=35:15 ast,ir=42:15 ast,ir=49:15 + sink(b2->getBox1()->getElem()); // $ ast,ir=28:15 ast,ir=35:15 ast,ir=42:15 ast,ir=49:15 } Box2* boxfield; diff --git a/cpp/ql/test/library-tests/dataflow/fields/by_reference.cpp b/cpp/ql/test/library-tests/dataflow/fields/by_reference.cpp index d8c6a194151..680b1489228 100644 --- a/cpp/ql/test/library-tests/dataflow/fields/by_reference.cpp +++ b/cpp/ql/test/library-tests/dataflow/fields/by_reference.cpp @@ -48,25 +48,25 @@ struct S { void test_setDirectly() { S s; s.setDirectly(user_input()); - sink(s.getDirectly()); // $ast ir + sink(s.getDirectly()); // $ ast ir } void test_setIndirectly() { S s; s.setIndirectly(user_input()); - sink(s.getIndirectly()); // $ast ir + sink(s.getIndirectly()); // $ ast ir } void test_setThroughNonMember() { S s; s.setThroughNonMember(user_input()); - sink(s.getThroughNonMember()); // $ast ir + sink(s.getThroughNonMember()); // $ ast ir } void test_nonMemberSetA() { S s; nonMemberSetA(&s, user_input()); - sink(nonMemberGetA(&s)); // $ast,ir + sink(nonMemberGetA(&s)); // $ ast,ir } //////////////////// @@ -112,7 +112,7 @@ void test_outer_with_ptr(Outer *pouter) { sink(outer.a); // $ ast,ir sink(pouter->inner_nested.a); // $ ast,ir - sink(pouter->inner_ptr->a); // $ast,ir + sink(pouter->inner_ptr->a); // $ ast,ir sink(pouter->a); // $ ast,ir } diff --git a/cpp/ql/test/library-tests/ir/range-analysis/SimpleRangeAnalysis_tests.cpp b/cpp/ql/test/library-tests/ir/range-analysis/SimpleRangeAnalysis_tests.cpp index 649d99a7575..05b11b793c3 100644 --- a/cpp/ql/test/library-tests/ir/range-analysis/SimpleRangeAnalysis_tests.cpp +++ b/cpp/ql/test/library-tests/ir/range-analysis/SimpleRangeAnalysis_tests.cpp @@ -46,7 +46,7 @@ int test4() { } range(total); // $ MISSING: range=>=0 range(i); // $ range===2 - range(total + i); // $ range="<=Phi: i+2" MISSING: range===i+2 range=>=2 range=>=i+0 + range(total + i); // $ range="<=Phi: i+2" MISSING: range===i+2 range=>=2 range=>=i+0 return total + i; } @@ -210,7 +210,7 @@ int test14(int x) { int x3 = (int)(unsigned int)x; range(x3); char c0 = x; - range(c0); + range(c0); unsigned short s0 = x; range(s0); range(x0 + x1 + x2 + x3 + c0 + s0); // $ overflow=+ overflow=+- @@ -218,7 +218,7 @@ int test14(int x) { } long long test15(long long x) { - return (x > 0 && (range(x), x == (int)x)) ? // $ range=>=1 + return (x > 0 && (range(x), x == (int)x)) ? // $ range=>=1 (range(x), x) : // $ range=>=1 (range(x), -1); } @@ -228,7 +228,7 @@ int test_unary(int a) { int total = 0; if (3 <= a && a <= 11) { - range(a); // $ range=<=11 range=>=3 + range(a); // $ range=<=11 range=>=3 int b = +a; range(b); // $ range=<=11 range=>=3 int c = -a; @@ -384,7 +384,7 @@ int test_mult02(int a, int b) { total += r; range(total); // $ range=">=Phi: 0-143" range=">=Phi: 0-286" } - range(total); // $range=">=Phi: 0-143" range=">=Phi: 0-286" + range(total); // $ range=">=Phi: 0-143" range=">=Phi: 0-286" return total; } @@ -467,7 +467,7 @@ int test_mult04(int a, int b) { range(a); // $ range=<=0 range=>=-17 range(b); // $ range=<=0 range=>=-13 int r = a*b; // 0 .. 221 - range(r); // $ range=<=221 range=>=0 + range(r); // $ range=<=221 range=>=0 total += r; range(total); // $ range="<=Phi: - ...+221" } @@ -1030,7 +1030,7 @@ void test_negate_signed(int s) { } } -// By setting the guard after the use in another guard we +// By setting the guard after the use in another guard we // don't get the useful information void test_guard_after_use(int pos, int size, int offset) { if (pos + offset >= size) { // $ overflow=+- @@ -1040,12 +1040,12 @@ void test_guard_after_use(int pos, int size, int offset) { return; } range(pos + 1); // $ overflow=+ range="==InitializeParameter: pos+1" MISSING: range="<=InitializeParameter: size-1" -} +} int cond(); -// This is basically what we get when we have a loop that calls +// This is basically what we get when we have a loop that calls // realloc in some iterations void alloc_in_loop(int origLen) { if (origLen <= 10) { @@ -1066,12 +1066,12 @@ void alloc_in_loop(int origLen) { } } -// This came from a case where it handled the leftovers before an unrolled loop +// This came from a case where it handled the leftovers before an unrolled loop void mask_at_start(int len) { if (len < 0) { return; } - int leftOver = len & 63; + int leftOver = len & 63; for (int i = 0; i < leftOver; i++) { range(i); // $ range=<=62 range=>=0 range="<=Store: ... & ... | Store: leftOver-1" range="<=InitializeParameter: len-1" }