We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
ResolvesTo
1 parent 45a7ecc commit d4231c3Copy full SHA for d4231c3
1 file changed
cpp/misra/src/rules/RULE-28-6-1/StdMoveWithNonConstLvalue.ql
@@ -17,12 +17,20 @@
17
import cpp
18
import codingstandards.cpp.standardlibrary.Utility
19
import codingstandards.cpp.ast.ValueCategory
20
-import codingstandards.cpp.types.Resolve
21
-import codingstandards.cpp.types.Specifiers
+
+predicate resolvesToConstOrConstRef(Type t) {
22
+ t.isConst()
23
+ or
24
+ resolvesToConstOrConstRef(t.(ReferenceType).getBaseType())
25
26
+ resolvesToConstOrConstRef(t.(TypedefType).getBaseType())
27
28
+ resolvesToConstOrConstRef(t.(Decltype).getBaseType())
29
+}
30
31
predicate isConstLvalue(Expr arg) {
32
getValueCategory(arg).isLValue() and
- arg.getType() instanceof ResolvesTo<RawConstType>::ExactlyOrRef
33
+ resolvesToConstOrConstRef(arg.getType())
34
}
35
36
Type typeOfArgument(Expr e) {
0 commit comments