Skip to content

Commit ce71b45

Browse files
zlaski-semmlejbj
authored andcommitted
Zlaski/cpp386a (#1753)
* [CPP-386] Cumulative patch. * Restore dataflow libraries clobbered by my last commit.
1 parent 8cada4b commit ce71b45

File tree

16 files changed

+349
-208
lines changed

16 files changed

+349
-208
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -802,6 +802,8 @@ class ClassDerivation extends Locatable, @derivation {
802802
Class getBaseClass() {
803803
result = getBaseType().getUnderlyingType()
804804
}
805+
806+
override string getCanonicalQLClass() { result = "ClassDerivation" }
805807

806808
/**
807809
* Gets the type from which we are deriving, without resolving any

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,8 @@ class Folder extends Container, @folder {
187187
result.hasLocationInfo(_, 0, 0, 0, 0)
188188
}
189189

190+
override string getCanonicalQLClass() { result = "Folder" }
191+
190192
/**
191193
* DEPRECATED: Use `getLocation` instead.
192194
* Gets the URL of this folder.
@@ -259,6 +261,8 @@ class File extends Container, @file {
259261
result = Container.super.toString()
260262
}
261263

264+
override string getCanonicalQLClass() { result = "File" }
265+
262266
override Location getLocation() {
263267
result.getContainer() = this and
264268
result.hasLocationInfo(_, 0, 0, 0, 0)
@@ -458,6 +462,8 @@ class HeaderFile extends File {
458462
exists(Include i | i.getIncludedFile() = this)
459463
}
460464

465+
override string getCanonicalQLClass() { result = "HeaderFile" }
466+
461467
/**
462468
* Holds if this header file does not contain any declaration entries or top level
463469
* declarations. For example it might be:
@@ -488,6 +494,7 @@ class CFile extends File {
488494
)
489495
}
490496

497+
override string getCanonicalQLClass() { result = "CFile" }
491498
}
492499

493500
/**
@@ -507,6 +514,7 @@ class CppFile extends File {
507514
)
508515
}
509516

517+
override string getCanonicalQLClass() { result = "CppFile" }
510518
}
511519

512520
/**

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ class FriendDecl extends Declaration, @frienddecl {
2121
* use `getFriend`.
2222
*/
2323
override Location getADeclarationLocation() { result = this.getLocation() }
24+
25+
override string getCanonicalQLClass() { result = "FriendDecl" }
2426

2527
/**
2628
* Implements the abstract method `Declaration.getDefinitionLocation`. A

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ class MacroAccess extends Locatable, @macroinvocation {
8282
result = this.getOutermostMacroAccess().getActualLocation()
8383
}
8484

85+
override string getCanonicalQLClass() { result = "MacroAccess" }
86+
8587
/**
8688
* Gets the location of this macro access. For a nested access, where
8789
* `exists(this.getParentInvocation())`, this yields a location either inside
@@ -158,6 +160,8 @@ class MacroInvocation extends MacroAccess {
158160
macroinvocations(underlyingElement(this),_,_,1)
159161
}
160162

163+
override string getCanonicalQLClass() { result = "MacroInvocation" }
164+
161165
/**
162166
* Gets an element that occurs in this macro invocation or a nested macro
163167
* invocation.

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,8 @@ class NamespaceDeclarationEntry extends Locatable, @namespace_decl {
132132
* example: the "{ ... }" in "namespace N { ... }".
133133
*/
134134
Location getBodyLocation() { namespace_decls(underlyingElement(this),_,_,result) }
135+
136+
override string getCanonicalQLClass() { result = "NamespaceDeclarationEntry" }
135137
}
136138

137139
/**

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,8 @@ class PreprocessorIf extends PreprocessorBranch, @ppd_if {
158158
*/
159159
class PreprocessorIfdef extends PreprocessorBranch, @ppd_ifdef {
160160
override string toString() { result = "#ifdef " + this.getHead() }
161+
162+
override string getCanonicalQLClass() { result = "PreprocessorIfdef" }
161163
}
162164

163165
/**

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ class Specifier extends Element, @specifier {
1313
result instanceof UnknownDefaultLocation
1414
}
1515

16+
override string getCanonicalQLClass() { result = "Specifier" }
17+
1618
/** Gets the name of this specifier. */
1719
string getName() { specifiers(underlyingElement(this),result) }
1820

@@ -31,6 +33,7 @@ class FunctionSpecifier extends Specifier {
3133
this.hasName("virtual") or
3234
this.hasName("explicit")
3335
}
36+
override string getCanonicalQLClass() { result = "FunctionSpecifier)" }
3437
}
3538

3639
/**
@@ -45,6 +48,7 @@ class StorageClassSpecifier extends Specifier {
4548
this.hasName("extern") or
4649
this.hasName("mutable")
4750
}
51+
override string getCanonicalQLClass() { result = "StorageClassSpecifier" }
4852
}
4953

5054
/**
@@ -96,6 +100,7 @@ class AccessSpecifier extends Specifier {
96100
baseAccess.getName() >= this.getName() and result = this
97101
)
98102
}
103+
override string getCanonicalQLClass() { result = "AccessSpecifier" }
99104
}
100105

101106
/**
@@ -237,6 +242,7 @@ class FormatAttribute extends GnuAttribute {
237242
not val = 0 // indicates a `vprintf` style format function with arguments not directly available.
238243
)
239244
}
245+
override string getCanonicalQLClass() { result = "FormatAttribute" }
240246
}
241247

242248
/**

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -798,6 +798,8 @@ class Decltype extends Type, @decltype {
798798
decltypes(underlyingElement(this), _, unresolveElement(result), _)
799799
}
800800

801+
override string getCanonicalQLClass() { result = "Decltype" }
802+
801803
/**
802804
* Whether an extra pair of parentheses around the expression would change the semantics of this decltype.
803805
*
@@ -1064,6 +1066,8 @@ class GNUVectorType extends DerivedType {
10641066
*/
10651067
int getNumElements() { arraysizes(underlyingElement(this),result,_,_) }
10661068

1069+
override string getCanonicalQLClass() { result = "GNUVectorType" }
1070+
10671071
/**
10681072
* Gets the size, in bytes, of this vector type.
10691073
*

cpp/ql/src/semmle/code/cpp/controlflow/Nullness.qll

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ abstract class NullValue extends Expr
1414
class Zero extends NullValue
1515
{
1616
Zero() { this.(Literal).getValue() = "0" }
17-
18-
override string getCanonicalQLClass() { result = "Zero" }
1917
}
2018

2119
/**

cpp/ql/src/semmle/code/cpp/exprs/Access.qll

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ class FieldAccess extends VariableAccess {
150150
* so this is equivalent to `(*obj).field`.
151151
*/
152152
class PointerFieldAccess extends FieldAccess {
153+
override string getCanonicalQLClass() { result = "PointerFieldAccess" }
153154
PointerFieldAccess() {
154155
exists (PointerType t
155156
| t = getQualifier().getFullyConverted().getUnspecifiedType() and
@@ -164,6 +165,7 @@ class PointerFieldAccess extends FieldAccess {
164165
* distinguish whether or not the type of `obj` is a reference type.
165166
*/
166167
class DotFieldAccess extends FieldAccess {
168+
override string getCanonicalQLClass() { result = "DotFieldAccess" }
167169
DotFieldAccess() {
168170
exists (Class c
169171
| c = getQualifier().getFullyConverted().getUnspecifiedType())
@@ -175,6 +177,7 @@ class DotFieldAccess extends FieldAccess {
175177
* reference to a class/struct/union.
176178
*/
177179
class ReferenceFieldAccess extends DotFieldAccess {
180+
override string getCanonicalQLClass() { result = "ReferenceFieldAccess" }
178181
ReferenceFieldAccess() {
179182
exprHasReferenceConversion(this.getQualifier())
180183
}
@@ -185,6 +188,7 @@ class ReferenceFieldAccess extends DotFieldAccess {
185188
* class/struct/union (and not a reference).
186189
*/
187190
class ValueFieldAccess extends DotFieldAccess {
191+
override string getCanonicalQLClass() { result = "ValueFieldAccess" }
188192
ValueFieldAccess() {
189193
not exprHasReferenceConversion(this.getQualifier())
190194
}
@@ -226,6 +230,7 @@ private predicate exprHasReferenceConversion(Expr e) {
226230
* `ImplicitThisFieldAccess`.
227231
*/
228232
class ImplicitThisFieldAccess extends FieldAccess {
233+
override string getCanonicalQLClass() { result = "ImplicitThisFieldAccess" }
229234
ImplicitThisFieldAccess() {
230235
not exists (this.getQualifier())
231236
}
@@ -277,6 +282,7 @@ class ParamAccessForType extends Expr, @param_ref {
277282
* works on types directly rather than variables, expressions etc.
278283
*/
279284
class TypeName extends Expr, @type_operand {
285+
override string getCanonicalQLClass() { result = "TypeName" }
280286
override string toString() {
281287
result = this.getType().getName()
282288
}

0 commit comments

Comments
 (0)