From a6f24b627d5d24ccba68e59864a31cb91e4bd3a0 Mon Sep 17 00:00:00 2001 From: Remco Vermeulen Date: Thu, 1 Feb 2024 13:14:46 -0800 Subject: [PATCH] Fix FP reported in #372 --- change_notes/2024-02-01-fix-fp-reported-for-a7-1-1.md | 2 ++ .../A7-1-1/DeclarationUnmodifiedObjectMissingConstSpecifier.ql | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 change_notes/2024-02-01-fix-fp-reported-for-a7-1-1.md diff --git a/change_notes/2024-02-01-fix-fp-reported-for-a7-1-1.md b/change_notes/2024-02-01-fix-fp-reported-for-a7-1-1.md new file mode 100644 index 0000000000..346d7a0182 --- /dev/null +++ b/change_notes/2024-02-01-fix-fp-reported-for-a7-1-1.md @@ -0,0 +1,2 @@ +`A7-1-1` - `DeclarationUnmodifiedObjectMissingConstSpecifier.ql` + - Fix FP reported in #372. Exclude compiler generated variables. \ No newline at end of file diff --git a/cpp/autosar/src/rules/A7-1-1/DeclarationUnmodifiedObjectMissingConstSpecifier.ql b/cpp/autosar/src/rules/A7-1-1/DeclarationUnmodifiedObjectMissingConstSpecifier.ql index d85a638530..ff7d7e4e27 100644 --- a/cpp/autosar/src/rules/A7-1-1/DeclarationUnmodifiedObjectMissingConstSpecifier.ql +++ b/cpp/autosar/src/rules/A7-1-1/DeclarationUnmodifiedObjectMissingConstSpecifier.ql @@ -36,5 +36,6 @@ where else cond = " is used for an object" ) and not exists(LambdaExpression lc | lc.getACapture().getField() = v) and - not v.isFromUninstantiatedTemplate(_) + not v.isFromUninstantiatedTemplate(_) and + not v.isCompilerGenerated() select v, "Non-constant variable " + v.getName() + cond + " and is not modified."