From 8035a7cd4018b1a875314c5a6ee01f9e483008bb Mon Sep 17 00:00:00 2001 From: Calum Grant Date: Fri, 1 Nov 2024 16:55:48 +0000 Subject: [PATCH] C++: Minor edits --- cpp/ql/src/Telemetry/Metrics.qll | 2 +- .../extraction_errors/ExtractionMetrics.expected | 2 +- .../extraction_errors/PrintAst.expected | 16 ++++++++-------- .../library-tests/extraction_errors/diags.ql | 2 +- .../extraction_errors/error_fn_returns.expected | 1 - .../extraction_errors/error_fn_returns.ql | 5 ----- .../extraction_errors/error_types.expected | 1 - .../extraction_errors/error_types.ql | 6 ------ .../extraction_errors/functions.expected | 4 ++-- .../library-tests/extraction_errors/functions.ql | 2 +- .../test/library-tests/extraction_errors/test.h | 2 -- 11 files changed, 14 insertions(+), 29 deletions(-) delete mode 100644 cpp/ql/test/library-tests/extraction_errors/error_fn_returns.expected delete mode 100644 cpp/ql/test/library-tests/extraction_errors/error_fn_returns.ql delete mode 100644 cpp/ql/test/library-tests/extraction_errors/error_types.expected delete mode 100644 cpp/ql/test/library-tests/extraction_errors/error_types.ql diff --git a/cpp/ql/src/Telemetry/Metrics.qll b/cpp/ql/src/Telemetry/Metrics.qll index 5f30dc86c894..59936330e285 100644 --- a/cpp/ql/src/Telemetry/Metrics.qll +++ b/cpp/ql/src/Telemetry/Metrics.qll @@ -215,7 +215,7 @@ module CppMetrics { SucceededIncludeCount() { exists(Include i | i.getIncludeText() = include_text and - exists(i.getFile().getRelativePath()) // Only report includes from the repo + exists(i.getFile().getRelativePath()) // Only report includes from the repo ) and this = "Successfully included " + include_text } diff --git a/cpp/ql/test/library-tests/extraction_errors/ExtractionMetrics.expected b/cpp/ql/test/library-tests/extraction_errors/ExtractionMetrics.expected index dcba2f000876..7fb84fc291ee 100644 --- a/cpp/ql/test/library-tests/extraction_errors/ExtractionMetrics.expected +++ b/cpp/ql/test/library-tests/extraction_errors/ExtractionMetrics.expected @@ -10,7 +10,7 @@ | functions without errors | 6.0 | | lines of code | 19.0 | | lines of code without errors | 12.0 | -| lines of text | 26.0 | +| lines of text | 24.0 | | non-error expressions | 3.0 | | source files | 3.0 | | source files without errors | 2.0 | diff --git a/cpp/ql/test/library-tests/extraction_errors/PrintAst.expected b/cpp/ql/test/library-tests/extraction_errors/PrintAst.expected index 7ff9a5405651..ce2b59b6a086 100644 --- a/cpp/ql/test/library-tests/extraction_errors/PrintAst.expected +++ b/cpp/ql/test/library-tests/extraction_errors/PrintAst.expected @@ -69,11 +69,11 @@ test.cpp: #-----| ValueCategory = prvalue # 17| getStmt(2): [ReturnStmt] return ... test.h: -# 4| [TopLevelFunction] int f(int) -# 4| : -# 4| getParameter(0): [Parameter] (unnamed parameter 0) -# 4| Type = [IntType] int -# 4| [TopLevelFunction] int f(int) -# 4| : -# 4| getParameter(0): [Parameter] (unnamed parameter 0) -# 4| Type = [IntType] int +# 2| [TopLevelFunction] int f(int) +# 2| : +# 2| getParameter(0): [Parameter] (unnamed parameter 0) +# 2| Type = [IntType] int +# 2| [TopLevelFunction] int f(int) +# 2| : +# 2| getParameter(0): [Parameter] (unnamed parameter 0) +# 2| Type = [IntType] int diff --git a/cpp/ql/test/library-tests/extraction_errors/diags.ql b/cpp/ql/test/library-tests/extraction_errors/diags.ql index 9e7db729265e..3fa864748e16 100644 --- a/cpp/ql/test/library-tests/extraction_errors/diags.ql +++ b/cpp/ql/test/library-tests/extraction_errors/diags.ql @@ -1,4 +1,4 @@ import cpp from Diagnostic d -select d \ No newline at end of file +select d diff --git a/cpp/ql/test/library-tests/extraction_errors/error_fn_returns.expected b/cpp/ql/test/library-tests/extraction_errors/error_fn_returns.expected deleted file mode 100644 index a06ba8bf672a..000000000000 --- a/cpp/ql/test/library-tests/extraction_errors/error_fn_returns.expected +++ /dev/null @@ -1 +0,0 @@ -| test.cpp:14:10:14:12 | fn2 | diff --git a/cpp/ql/test/library-tests/extraction_errors/error_fn_returns.ql b/cpp/ql/test/library-tests/extraction_errors/error_fn_returns.ql deleted file mode 100644 index 28fe33cb2a6c..000000000000 --- a/cpp/ql/test/library-tests/extraction_errors/error_fn_returns.ql +++ /dev/null @@ -1,5 +0,0 @@ -import cpp - -from Function fn -where fn.getType() instanceof ErroneousType or not exists(fn.getType()) -select fn diff --git a/cpp/ql/test/library-tests/extraction_errors/error_types.expected b/cpp/ql/test/library-tests/extraction_errors/error_types.expected deleted file mode 100644 index d15915d4f7ac..000000000000 --- a/cpp/ql/test/library-tests/extraction_errors/error_types.expected +++ /dev/null @@ -1 +0,0 @@ -| test.cpp:6:13:6:31 | | diff --git a/cpp/ql/test/library-tests/extraction_errors/error_types.ql b/cpp/ql/test/library-tests/extraction_errors/error_types.ql deleted file mode 100644 index 3b754dffa656..000000000000 --- a/cpp/ql/test/library-tests/extraction_errors/error_types.ql +++ /dev/null @@ -1,6 +0,0 @@ -import cpp - -from Expr e -where e.getType() instanceof ErroneousType -and e.fromSource() -select e diff --git a/cpp/ql/test/library-tests/extraction_errors/functions.expected b/cpp/ql/test/library-tests/extraction_errors/functions.expected index e1c62fd7e49b..db80ede06555 100644 --- a/cpp/ql/test/library-tests/extraction_errors/functions.expected +++ b/cpp/ql/test/library-tests/extraction_errors/functions.expected @@ -2,5 +2,5 @@ | test.c:4:13:4:13 | no_such_function | | test.cpp:5:6:5:25 | function_with_errors | | test.cpp:14:10:14:12 | fn2 | -| test.h:4:5:4:5 | f | -| test.h:4:5:4:5 | f | +| test.h:2:5:2:5 | f | +| test.h:2:5:2:5 | f | diff --git a/cpp/ql/test/library-tests/extraction_errors/functions.ql b/cpp/ql/test/library-tests/extraction_errors/functions.ql index 1c0ddd3fd455..ac52eec7309d 100644 --- a/cpp/ql/test/library-tests/extraction_errors/functions.ql +++ b/cpp/ql/test/library-tests/extraction_errors/functions.ql @@ -2,4 +2,4 @@ import cpp from Function fn where fn.fromSource() -select fn \ No newline at end of file +select fn diff --git a/cpp/ql/test/library-tests/extraction_errors/test.h b/cpp/ql/test/library-tests/extraction_errors/test.h index 6957e49d8c92..a3941657c0e3 100644 --- a/cpp/ql/test/library-tests/extraction_errors/test.h +++ b/cpp/ql/test/library-tests/extraction_errors/test.h @@ -1,4 +1,2 @@ - #define ADD(A,B) ((A)+(B)) - int f(int);