Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- `RULE-6-4-2` - `InheritedOverridableMemberFunction.ql`:
Comment thread
mbaluda marked this conversation as resolved.
- Improved evaluation performance.
- `RULE-7-0-4` - `InappropriateBitwiseOrShiftOperands.ql`:
- Improved evaluation performance.
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,24 @@ abstract class HiddenInheritedOverridableMemberFunctionSharedQuery extends Query

Query getQuery() { result instanceof HiddenInheritedOverridableMemberFunctionSharedQuery }

class OverridingDeclaration extends FunctionDeclarationEntry {
OverridingDeclaration() { this.getDeclaration().hasDefinition() implies not this.isDefinition() }
}

class HiddenDeclaration extends OverridingDeclaration {
HiddenDeclaration() {
// Check if we are overriding a virtual inherited member function
this.getDeclaration().isVirtual() and
// Exclude private member functions, which cannot be inherited.
Comment thread
mbaluda marked this conversation as resolved.
not this.getDeclaration().(MemberFunction).isPrivate()
}
Comment thread
mbaluda marked this conversation as resolved.
Outdated
}

query predicate problems(
FunctionDeclarationEntry overridingDecl, string message, FunctionDeclarationEntry hiddenDecl,
OverridingDeclaration overridingDecl, string message, HiddenDeclaration hiddenDecl,
string hiddenDecl_string
) {
not isExcluded(overridingDecl, getQuery()) and
// Check if we are overriding a virtual inherited member function
hiddenDecl.getDeclaration().isVirtual() and
// Exclude private member functions, which cannot be inherited.
not hiddenDecl.getDeclaration().(MemberFunction).isPrivate() and
// The overriding declaration hides the hidden declaration if:
(
// 1. the overriding declaration overrides a function in a base class that is an overload of the hidden declaration
Expand All @@ -46,9 +55,6 @@ query predicate problems(
overridingDecl.getDeclaration().getDeclaringType().getABaseClass() =
hiddenDecl.getDeclaration().getDeclaringType()
) and
// Limit the results to the declarations and not the definitions, if any.
(overridingDecl.getDeclaration().hasDefinition() implies not overridingDecl.isDefinition()) and
(hiddenDecl.getDeclaration().hasDefinition() implies not hiddenDecl.isDefinition()) and
message =
"Declaration for member '" + overridingDecl.getName() +
"' hides overridable inherited member function $@" and
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ predicate isConstantExpression(Expr e) {
e.isConstant()
}

bindingset[right, leftType]
pragma[inline_late]
Comment thread
mbaluda marked this conversation as resolved.
predicate isValidShiftConstantRange(Expr right, Type leftType) {
Comment thread
mbaluda marked this conversation as resolved.
Outdated
exists(int value |
value = right.getValue().toInt() and
Expand Down
Loading