Skip to content

Commit 4746320

Browse files
authored
Merge pull request github#4684 from criemen/cleanup-api
C++: Clean up Type.qll, getSpecifierString() API.
2 parents decbb08 + 959b8f3 commit 4746320

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

cpp/ql/src/semmle/code/cpp/Print.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,15 +304,15 @@ private class SpecifiedDumpType extends DerivedDumpType, SpecifiedType {
304304
basePrefix = getBaseType().(DumpType).getDeclaratorPrefix() and
305305
if getBaseType().getUnspecifiedType() instanceof RoutineType
306306
then result = basePrefix
307-
else result = basePrefix + " " + getSpecifierString().trim()
307+
else result = basePrefix + " " + getSpecifierString()
308308
)
309309
}
310310

311311
override string getDeclaratorSuffixBeforeQualifiers() {
312312
exists(string baseSuffix |
313313
baseSuffix = getBaseType().(DumpType).getDeclaratorSuffixBeforeQualifiers() and
314314
if getBaseType().getUnspecifiedType() instanceof RoutineType
315-
then result = baseSuffix + " " + getSpecifierString().trim()
315+
then result = baseSuffix + " " + getSpecifierString()
316316
else result = baseSuffix
317317
)
318318
}

cpp/ql/src/semmle/code/cpp/Type.qll

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1304,14 +1304,16 @@ class SpecifiedType extends DerivedType {
13041304
}
13051305

13061306
/**
1307+
* INTERNAL: Do not use.
1308+
*
13071309
* Gets all the specifiers of this type as a string in a fixed order (the order
13081310
* only depends on the specifiers, not on the source program). This is intended
13091311
* for debugging queries only and is an expensive operation.
13101312
*/
1311-
string getSpecifierString() { result = concat(this.getASpecifier().getName(), " ") + " " }
1313+
string getSpecifierString() { result = concat(this.getASpecifier().getName(), " ") }
13121314

13131315
override string explain() {
1314-
result = this.getSpecifierString() + "{" + this.getBaseType().explain() + "}"
1316+
result = this.getSpecifierString() + " {" + this.getBaseType().explain() + "}"
13151317
}
13161318

13171319
override predicate isDeeplyConst() {

0 commit comments

Comments
 (0)