mirror of
https://github.com/github/codeql.git
synced 2025-12-24 04:36:35 +01:00
C++: Fix flow from this by ref.
This commit is contained in:
@@ -19,6 +19,12 @@ private newtype TNode =
|
||||
TInstanceParameterNode(MemberFunction f) { exists(f.getBlock()) and not f.isStatic() } or
|
||||
TPreConstructorInitThis(ConstructorFieldInit cfi) or
|
||||
TPostConstructorInitThis(ConstructorFieldInit cfi) or
|
||||
TThisArgumentPostUpdate(ThisExpr ta) {
|
||||
exists(Call c, int i |
|
||||
ta = c.getArgument(i) and
|
||||
not c.getTarget().getParameter(i).getUnderlyingType().(PointerType).getBaseType().isConst()
|
||||
)
|
||||
} or
|
||||
TUninitializedNode(LocalVariable v) { not v.hasInitializer() }
|
||||
|
||||
/**
|
||||
@@ -282,6 +288,16 @@ private class PartialDefinitionNode extends PostUpdateNode, TPartialDefinitionNo
|
||||
override string toString() { result = getPreUpdateNode().toString() + " [post update]" }
|
||||
}
|
||||
|
||||
private class ThisArgumentPostUpdateNode extends PostUpdateNode, TThisArgumentPostUpdate {
|
||||
ThisExpr thisExpr;
|
||||
|
||||
ThisArgumentPostUpdateNode() { this = TThisArgumentPostUpdate(thisExpr) }
|
||||
|
||||
override Node getPreUpdateNode() { result.asExpr() = thisExpr }
|
||||
|
||||
override string toString() { result = "ref arg this" }
|
||||
}
|
||||
|
||||
/**
|
||||
* A node representing the temporary value of an object that was just
|
||||
* constructed by a constructor call or an aggregate initializer. This is only
|
||||
|
||||
Reference in New Issue
Block a user