Skip to content

Commit defd27e

Browse files
committed
A13-3-1: improve alert message
1 parent 117c942 commit defd27e

File tree

3 files changed

+17
-12
lines changed

3 files changed

+17
-12
lines changed

cpp/autosar/src/rules/A13-3-1/FunctionThatContainsForwardingReferenceAsItsArgumentOverloaded.ql

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ class Candidate extends TemplateFunction {
2121
}
2222
}
2323

24-
from Candidate c, Function f, Function overload, Function overloaded, string msg
24+
from
25+
Candidate c, Function f, Function overload, Function overloaded, string msg,
26+
string firstMsgSegment
2527
where
2628
not isExcluded(f,
2729
OperatorsPackage::functionThatContainsForwardingReferenceAsItsArgumentOverloadedQuery()) and
@@ -36,11 +38,13 @@ where
3638
f.isCompilerGenerated()
3739
then (
3840
msg = "implicit constructor" and
41+
firstMsgSegment = " with a forwarding reference parameter " and
3942
overloaded = f and
4043
overload = c
4144
) else (
42-
msg = "function" and
45+
msg = "function with a forwarding reference parameter" and
46+
firstMsgSegment = " " and
4347
overloaded = c and
4448
overload = f
4549
)
46-
select overload, "Function overloads a $@ with a forwarding reference parameter.", overloaded, msg
50+
select overload, "Function" + firstMsgSegment + "overloads a $@.", overloaded, msg
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
| test.cpp:24:6:24:7 | F1 | Function overloads a $@ with a forwarding reference parameter. | test.cpp:27:25:27:26 | F1 | function |
2-
| test.cpp:49:3:49:3 | A | Function overloads a $@ with a forwarding reference parameter. | test.cpp:47:3:47:3 | A | function |
3-
| test.cpp:50:3:50:3 | A | Function overloads a $@ with a forwarding reference parameter. | test.cpp:47:3:47:3 | A | function |
4-
| test.cpp:63:8:63:8 | B | Function overloads a $@ with a forwarding reference parameter. | test.cpp:66:3:66:3 | B | function |
5-
| test.cpp:63:8:63:8 | B | Function overloads a $@ with a forwarding reference parameter. | test.cpp:66:3:66:3 | B | function |
6-
| test.cpp:71:7:71:7 | C | Function overloads a $@ with a forwarding reference parameter. | test.cpp:74:25:74:25 | C | function |
7-
| test.cpp:71:7:71:7 | C | Function overloads a $@ with a forwarding reference parameter. | test.cpp:74:25:74:25 | C | function |
1+
| test.cpp:24:6:24:7 | F1 | Function overloads a $@. | test.cpp:27:25:27:26 | F1 | function with a forwarding reference parameter |
2+
| test.cpp:50:3:50:3 | A | Function overloads a $@. | test.cpp:48:3:48:3 | A | function with a forwarding reference parameter |
3+
| test.cpp:51:3:51:3 | A | Function overloads a $@. | test.cpp:48:3:48:3 | A | function with a forwarding reference parameter |
4+
| test.cpp:69:3:69:3 | B | Function with a forwarding reference parameter overloads a $@. | test.cpp:64:8:64:8 | B | implicit constructor |
5+
| test.cpp:69:3:69:3 | B | Function with a forwarding reference parameter overloads a $@. | test.cpp:64:8:64:8 | B | implicit constructor |
6+
| test.cpp:77:25:77:25 | C | Function with a forwarding reference parameter overloads a $@. | test.cpp:74:7:74:7 | C | implicit constructor |
7+
| test.cpp:77:25:77:25 | C | Function with a forwarding reference parameter overloads a $@. | test.cpp:74:7:74:7 | C | implicit constructor |

cpp/autosar/test/rules/A13-3-1/test.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ template <class T> void F1(T &&x) {} //
3939

4040
class A {
4141
public:
42-
// COMPLIANT by exception, constrained to not match copy/move ctors
42+
// COMPLIANT[FALSE_POSITIVE] - by exception, constrained to not match
43+
// copy/move ctors
4344
template <
4445
typename T,
4546
std::enable_if_t<!std::is_same<
@@ -65,7 +66,7 @@ struct B {
6566
typename T,
6667
std::enable_if_t<!std::is_same<
6768
std::remove_cv_t<std::remove_reference_t<T>>, A>::value> * = nullptr>
68-
B(T &&value) {} // COMPLIANT by exception
69+
B(T &&value) {} // COMPLIANT[FALSE_POSITIVE] - by exception
6970
};
7071

7172
int main() {}

0 commit comments

Comments
 (0)