mirror of
https://github.com/github/codeql.git
synced 2026-04-30 11:15:13 +02:00
C++: Improve PrintAST performance.
Co-authored-by: Jonas Jensen <jbj@github.com>
This commit is contained in:
@@ -1308,7 +1308,7 @@ class SpecifiedType extends DerivedType {
|
||||
* only depends on the specifiers, not on the source program). This is intended
|
||||
* for debugging queries only and is an expensive operation.
|
||||
*/
|
||||
string getSpecifierString() { internalSpecString(this, result, 1) }
|
||||
string getSpecifierString() { result = concat(this.getASpecifier().getName(), " ") }
|
||||
|
||||
override string explain() {
|
||||
result = this.getSpecifierString() + "{" + this.getBaseType().explain() + "}"
|
||||
@@ -1710,28 +1710,6 @@ class AutoType extends TemplateParameter {
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Internal implementation predicates
|
||||
//
|
||||
private predicate allSpecifiers(int i, string s) { s = rank[i](string t | specifiers(_, t) | t) }
|
||||
|
||||
private predicate internalSpecString(Type t, string res, int i) {
|
||||
(
|
||||
if allSpecifiers(i, t.getASpecifier().getName())
|
||||
then
|
||||
exists(string spec, string rest |
|
||||
allSpecifiers(i, spec) and
|
||||
res = spec + " " + rest and
|
||||
internalSpecString(t, rest, i + 1)
|
||||
)
|
||||
else (
|
||||
allSpecifiers(i, _) and internalSpecString(t, res, i + 1)
|
||||
)
|
||||
)
|
||||
or
|
||||
i = count(Specifier s) + 1 and res = ""
|
||||
}
|
||||
|
||||
private predicate suppressUnusedThis(Type t) { any() }
|
||||
|
||||
/** A source code location referring to a type */
|
||||
|
||||
Reference in New Issue
Block a user