Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cb3551b

Browse files
committed
Merge commit '76982404' into attribute
2 parents 7176b43 + 7698240 commit cb3551b

46 files changed

Lines changed: 653 additions & 1575 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

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/dataflow/internal/DataFlowImplCommon.qll

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,12 +215,14 @@ private module ImplCommon {
215215

216216
/*
217217
* Calculation of `predicate store(Node node1, Content f, Node node2)`:
218-
* There are three cases:
218+
* There are four cases:
219219
* - The base case: A direct local assignment given by `storeStep`.
220220
* - A call to a method or constructor with two arguments, `arg1` and `arg2`,
221-
* such the call has the side-effect `arg2.f = arg1`.
221+
* such that the call has the side-effect `arg2.f = arg1`.
222222
* - A call to a method that returns an object in which an argument has been
223223
* stored.
224+
* - A reverse step through a read when the result of the read has been
225+
* stored into. This handles cases like `x.f1.f2 = y`.
224226
* `storeViaSideEffect` covers the first two cases, and `storeReturn` covers
225227
* the third case.
226228
*/
@@ -232,7 +234,8 @@ private module ImplCommon {
232234
cached
233235
predicate store(Node node1, Content f, Node node2) {
234236
storeViaSideEffect(node1, f, node2) or
235-
storeReturn(node1, f, node2)
237+
storeReturn(node1, f, node2) or
238+
read(node2.(PostUpdateNode).getPreUpdateNode(), f, node1.(PostUpdateNode).getPreUpdateNode())
236239
}
237240

238241
private predicate storeViaSideEffect(Node node1, Content f, PostUpdateNode node2) {

0 commit comments

Comments
 (0)