mirror of
https://github.com/github/codeql.git
synced 2025-12-24 04:36:35 +01:00
Merge pull request #13095 from yoff/python/interpret-summary-content
Python: Interpret summary content
This commit is contained in:
@@ -28,6 +28,27 @@ module SummaryComponent {
|
|||||||
/** Gets a summary component that represents a list element. */
|
/** Gets a summary component that represents a list element. */
|
||||||
SummaryComponent listElement() { result = content(any(ListElementContent c)) }
|
SummaryComponent listElement() { result = content(any(ListElementContent c)) }
|
||||||
|
|
||||||
|
/** Gets a summary component that represents a set element. */
|
||||||
|
SummaryComponent setElement() { result = content(any(SetElementContent c)) }
|
||||||
|
|
||||||
|
/** Gets a summary component that represents a tuple element. */
|
||||||
|
SummaryComponent tupleElement(int index) {
|
||||||
|
exists(TupleElementContent c | c.getIndex() = index and result = content(c))
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Gets a summary component that represents a dictionary element. */
|
||||||
|
SummaryComponent dictionaryElement(string key) {
|
||||||
|
exists(DictionaryElementContent c | c.getKey() = key and result = content(c))
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Gets a summary component that represents a dictionary element at any key. */
|
||||||
|
SummaryComponent dictionaryElementAny() { result = content(any(DictionaryElementAnyContent c)) }
|
||||||
|
|
||||||
|
/** Gets a summary component that represents an attribute element. */
|
||||||
|
SummaryComponent attribute(string attr) {
|
||||||
|
exists(AttributeContent c | c.getAttribute() = attr and result = content(c))
|
||||||
|
}
|
||||||
|
|
||||||
/** Gets a summary component that represents the return value of a call. */
|
/** Gets a summary component that represents the return value of a call. */
|
||||||
SummaryComponent return() { result = SC::return(any(ReturnKind rk)) }
|
SummaryComponent return() { result = SC::return(any(ReturnKind rk)) }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -105,6 +105,27 @@ predicate neutralSummaryElement(FlowSummary::SummarizedCallable c, string proven
|
|||||||
SummaryComponent interpretComponentSpecific(AccessPathToken c) {
|
SummaryComponent interpretComponentSpecific(AccessPathToken c) {
|
||||||
c = "ListElement" and
|
c = "ListElement" and
|
||||||
result = FlowSummary::SummaryComponent::listElement()
|
result = FlowSummary::SummaryComponent::listElement()
|
||||||
|
or
|
||||||
|
c = "SetElement" and
|
||||||
|
result = FlowSummary::SummaryComponent::setElement()
|
||||||
|
or
|
||||||
|
exists(int index |
|
||||||
|
c.getAnArgument("TupleElement") = index.toString() and
|
||||||
|
result = FlowSummary::SummaryComponent::tupleElement(index)
|
||||||
|
)
|
||||||
|
or
|
||||||
|
exists(string key |
|
||||||
|
c.getAnArgument("DictionaryElement") = key and
|
||||||
|
result = FlowSummary::SummaryComponent::dictionaryElement(key)
|
||||||
|
)
|
||||||
|
or
|
||||||
|
c = "DictionaryElementAny" and
|
||||||
|
result = FlowSummary::SummaryComponent::dictionaryElementAny()
|
||||||
|
or
|
||||||
|
exists(string attr |
|
||||||
|
c.getAnArgument("Attribute") = attr and
|
||||||
|
result = FlowSummary::SummaryComponent::attribute(attr)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Gets the textual representation of a summary component in the format used for flow summaries. */
|
/** Gets the textual representation of a summary component in the format used for flow summaries. */
|
||||||
|
|||||||
Reference in New Issue
Block a user