Skip to content

Commit d4231c3

Browse files
Remove usage of ResolvesTo.
1 parent 45a7ecc commit d4231c3

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

cpp/misra/src/rules/RULE-28-6-1/StdMoveWithNonConstLvalue.ql

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,20 @@
1717
import cpp
1818
import codingstandards.cpp.standardlibrary.Utility
1919
import codingstandards.cpp.ast.ValueCategory
20-
import codingstandards.cpp.types.Resolve
21-
import codingstandards.cpp.types.Specifiers
20+
21+
predicate resolvesToConstOrConstRef(Type t) {
22+
t.isConst()
23+
or
24+
resolvesToConstOrConstRef(t.(ReferenceType).getBaseType())
25+
or
26+
resolvesToConstOrConstRef(t.(TypedefType).getBaseType())
27+
or
28+
resolvesToConstOrConstRef(t.(Decltype).getBaseType())
29+
}
2230

2331
predicate isConstLvalue(Expr arg) {
2432
getValueCategory(arg).isLValue() and
25-
arg.getType() instanceof ResolvesTo<RawConstType>::ExactlyOrRef
33+
resolvesToConstOrConstRef(arg.getType())
2634
}
2735

2836
Type typeOfArgument(Expr e) {

0 commit comments

Comments
 (0)