Skip to content

Commit 628c215

Browse files
committed
A18-9-1: Use shared library StdNamespace
1 parent 707f168 commit 628c215

File tree

3 files changed

+7
-11
lines changed

3 files changed

+7
-11
lines changed

cpp/autosar/src/rules/A18-9-1/BindUsed.ql

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,15 @@
1515

1616
import cpp
1717
import codingstandards.cpp.autosar
18+
import codingstandards.cpp.StdNamespace
1819

1920
predicate isBind(FunctionCall fc) {
20-
fc.getTarget().getQualifiedName() in [
21-
["std::bind", "std::bind1st", "std::bind2nd",],
22-
["std::__1::bind", "std::__1::bind1st", "std::__1::bind2nd"]
23-
]
21+
fc.getTarget().getNamespace() instanceof StdNS and
22+
fc.getTarget().getName() in ["bind", "bind1st", "bind2nd"]
2423
}
2524

2625
from FunctionCall fc
2726
where
2827
isBind(fc) and
2928
not isExcluded(fc, BannedFunctionsPackage::bindUsedQuery())
30-
select fc, "Prefer lambdas to using " + fc.getTarget().getQualifiedName() + "."
29+
select fc, "Prefer lambdas to using `" + fc.getTarget().getName() + "`."
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
| test.cpp:9:13:9:21 | call to bind | Prefer lambdas to using std::bind. |
2-
| test.cpp:10:13:10:24 | call to bind1st | Prefer lambdas to using std::bind1st. |
3-
| test.cpp:11:13:11:24 | call to bind2nd | Prefer lambdas to using std::bind2nd. |
1+
| test.cpp:9:13:9:21 | call to bind | Prefer lambdas to using `bind`. |
2+
| test.cpp:10:13:10:24 | call to bind1st | Prefer lambdas to using `bind1st`. |
3+
| test.cpp:11:13:11:24 | call to bind2nd | Prefer lambdas to using `bind2nd`. |

cpp/autosar/test/rules/A18-9-1/BindUsed.expected.qcc

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)