Skip to content

Commit c1dac08

Browse files
committed
Augment A15-4-4
1 parent 5fcb20a commit c1dac08

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

cpp/autosar/src/rules/A15-4-4/MissingNoExcept.ql

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,7 @@ where
3131
// Not compiler generated
3232
not f.isCompilerGenerated() and
3333
// The function is defined in this database
34-
f.hasDefinition()
34+
f.hasDefinition() and
35+
// This function is not an overriden call operator of lambda expression
36+
not exists(LambdaExpression lambda | lambda.getLambdaFunction() = f)
3537
select f, "Function " + f.getName() + " could be declared noexcept(true)."

cpp/autosar/test/rules/A15-4-4/test.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,10 @@ void test_indirect_throw() { // COMPLIANT - throws an exception indirectly
2424
class A {
2525
public:
2626
A() = delete; // COMPLIANT - deleted functions imply `noexcept(true)`.
27-
};
27+
};
28+
29+
/* Added for testing FP of embedded operator inside lambdas being reported */
30+
void lambda_example() noexcept {
31+
auto with_capture = [=]() {};
32+
auto empty_capture = []() {};
33+
}

0 commit comments

Comments
 (0)