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."