Skip to content

Commit b150aed

Browse files
committed
Removed partOfUnevaluatedContexts predicate
1 parent 07a78fe commit b150aed

File tree

1 file changed

+4
-16
lines changed

1 file changed

+4
-16
lines changed

cpp/autosar/src/rules/A0-1-3/UnusedLocalFunction.ql

+4-16
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,6 @@ predicate overloadedFunctionIsCalled(Function unusedFunction) {
4141
)
4242
}
4343

44-
/** Checks if a Function is part of an unevaluated context. */
45-
predicate partOfUnevalutedContexts(Function unusedFunction) {
46-
exists (Expr e, FunctionCall f | ((e instanceof TypeidOperator or
47-
e instanceof SizeofOperator or
48-
e instanceof NoExceptExpr) and
49-
e.getAChild*() = f and f.getTarget() = unusedFunction
50-
)
51-
)
52-
}
5344

5445
/** Checks if a Function's address was taken. */
5546
predicate addressBeenTaken(Function unusedFunction)
@@ -121,13 +112,10 @@ where
121112
// - It's part of an overloaded set and any one of the overloaded instance
122113
// is called.
123114
// - It's an operand of an expression in an unevaluated context.
124-
(
125-
not unusedLocalFunction.isDeleted() and
126-
not unusedLocalFunction.getAnAttribute().getName() = "maybe_unused" and
127-
not overloadedFunctionIsCalled(unusedLocalFunction) and
128-
not addressBeenTaken(unusedLocalFunction) and
129-
not partOfUnevalutedContexts(unusedLocalFunction)
130-
)
115+
not unusedLocalFunction.isDeleted() and
116+
not unusedLocalFunction.getAnAttribute().getName() = "maybe_unused" and
117+
not overloadedFunctionIsCalled(unusedLocalFunction) and
118+
not addressBeenTaken(unusedLocalFunction)
131119
and
132120
// Get a printable name
133121
(

0 commit comments

Comments
 (0)