Merge pull request #4684 from criemen/cleanup-api

C++: Clean up Type.qll, getSpecifierString() API.
This commit is contained in:
Mathias Vorreiter Pedersen
2020-11-18 13:07:51 +01:00
committed by GitHub
2 changed files with 6 additions and 4 deletions

View File

@@ -304,7 +304,7 @@ private class SpecifiedDumpType extends DerivedDumpType, SpecifiedType {
basePrefix = getBaseType().(DumpType).getDeclaratorPrefix() and
if getBaseType().getUnspecifiedType() instanceof RoutineType
then result = basePrefix
else result = basePrefix + " " + getSpecifierString().trim()
else result = basePrefix + " " + getSpecifierString()
)
}
@@ -312,7 +312,7 @@ private class SpecifiedDumpType extends DerivedDumpType, SpecifiedType {
exists(string baseSuffix |
baseSuffix = getBaseType().(DumpType).getDeclaratorSuffixBeforeQualifiers() and
if getBaseType().getUnspecifiedType() instanceof RoutineType
then result = baseSuffix + " " + getSpecifierString().trim()
then result = baseSuffix + " " + getSpecifierString()
else result = baseSuffix
)
}

View File

@@ -1304,14 +1304,16 @@ class SpecifiedType extends DerivedType {
}
/**
* INTERNAL: Do not use.
*
* Gets all the specifiers of this type as a string in a fixed order (the order
* only depends on the specifiers, not on the source program). This is intended
* for debugging queries only and is an expensive operation.
*/
string getSpecifierString() { result = concat(this.getASpecifier().getName(), " ") + " " }
string getSpecifierString() { result = concat(this.getASpecifier().getName(), " ") }
override string explain() {
result = this.getSpecifierString() + "{" + this.getBaseType().explain() + "}"
result = this.getSpecifierString() + " {" + this.getBaseType().explain() + "}"
}
override predicate isDeeplyConst() {