Skip to content

Commit 908e32b

Browse files
committed
C++: Respond to Copilot comments.
1 parent db2a462 commit 908e32b

1 file changed

Lines changed: 23 additions & 13 deletions

File tree

‎cpp/ql/lib/semmle/code/cpp/dataflow/ExternalFlow.qll‎

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1075,20 +1075,25 @@ private module Cached {
10751075
import Cached
10761076

10771077
/** Gets the constructor type selected by `constructorType` in a forwarding model. */
1078-
bindingset[forwarder, type, name, constructorType]
10791078
private Type getForwardedConstructorType(
1080-
Function forwarder, string type, string name, string constructorType
1079+
Function forwarder, string namespace, string type, boolean subtypes, string name,
1080+
string signature, string ext, string constructorType
10811081
) {
1082-
exists(string typeArguments, int index |
1083-
parseAngles(type, _, typeArguments, "") and
1084-
constructorType = getAtIndex(typeArguments, index) and
1085-
result = forwarder.getDeclaringType().getTemplateArgument(index)
1086-
)
1087-
or
1088-
exists(string nameArguments, int index |
1089-
parseAngles(name, _, nameArguments, "") and
1090-
constructorType = getAtIndex(nameArguments, index) and
1091-
result = forwarder.getTemplateArgument(index)
1082+
exists(int index |
1083+
forwardsModel(namespace, type, subtypes, name, signature, ext, _, constructorType, _, _, _) and
1084+
forwarder = interpretElement(namespace, type, subtypes, name, signature, ext)
1085+
|
1086+
exists(string typeArguments |
1087+
parseAngles(type, _, typeArguments, "") and
1088+
constructorType = getAtIndex(typeArguments, index) and
1089+
result = forwarder.getDeclaringType().getTemplateArgument(index)
1090+
)
1091+
or
1092+
exists(string nameArguments |
1093+
parseAngles(name, _, nameArguments, "") and
1094+
constructorType = getAtIndex(nameArguments, index) and
1095+
result = forwarder.getTemplateArgument(index)
1096+
)
10921097
)
10931098
}
10941099

@@ -1110,9 +1115,14 @@ private predicate interpretForwardsModel(
11101115
// function template, in which case we need to resolve that from the type
11111116
// or function name.
11121117
constructor.getDeclaringType() =
1113-
getForwardedConstructorType(forwarder, type, name, constructorType).getUnspecifiedType()
1118+
getForwardedConstructorType(forwarder, namespace, type, subtypes, name, signature, ext,
1119+
constructorType).getUnspecifiedType()
11141120
or
11151121
// Or the row specifies forwarding to a specific type.
1122+
not exists(
1123+
getForwardedConstructorType(forwarder, namespace, type, subtypes, name, signature, ext,
1124+
constructorType)
1125+
) and
11161126
classHasQualifiedName(constructor.getDeclaringType(), namespace, constructorType)
11171127
)
11181128
}

0 commit comments

Comments
 (0)