Skip to content

Commit acee9eb

Browse files
committed
C++: Add comment to pseudo-abstract predicates
1 parent 50709b2 commit acee9eb

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ class Declaration extends Locatable, @declaration {
124124
* To test whether this declaration has a particular name in the global
125125
* namespace, use `hasGlobalName`.
126126
*/
127-
string getName() { none() }
127+
string getName() { none() } // overridden in subclasses
128128

129129
/** Holds if this declaration has the given name. */
130130
predicate hasName(string name) { name = this.getName() }
@@ -140,7 +140,7 @@ class Declaration extends Locatable, @declaration {
140140
}
141141

142142
/** Gets a specifier of this declaration. */
143-
Specifier getASpecifier() { none() }
143+
Specifier getASpecifier() { none() } // overridden in subclasses
144144

145145
/** Holds if this declaration has a specifier with the given name. */
146146
predicate hasSpecifier(string name) { this.getASpecifier().hasName(name) }
@@ -156,7 +156,7 @@ class Declaration extends Locatable, @declaration {
156156
* Gets the location of a declaration entry corresponding to this
157157
* declaration.
158158
*/
159-
Location getADeclarationLocation() { none() }
159+
Location getADeclarationLocation() { none() } // overridden in subclasses
160160

161161
/**
162162
* Gets the declaration entry corresponding to this declaration that is a
@@ -165,7 +165,7 @@ class Declaration extends Locatable, @declaration {
165165
DeclarationEntry getDefinition() { none() }
166166

167167
/** Gets the location of the definition, if any. */
168-
Location getDefinitionLocation() { none() }
168+
Location getDefinitionLocation() { none() } // overridden in subclasses
169169

170170
/** Holds if the declaration has a definition. */
171171
predicate hasDefinition() { exists(this.getDefinition()) }
@@ -308,7 +308,7 @@ private class TDeclarationEntry = @var_decl or @type_decl or @fun_decl;
308308
*/
309309
class DeclarationEntry extends Locatable, TDeclarationEntry {
310310
/** Gets a specifier associated with this declaration entry. */
311-
string getASpecifier() { none() }
311+
string getASpecifier() { none() } // overridden in subclasses
312312

313313
/**
314314
* Gets the name associated with the corresponding definition (where
@@ -331,10 +331,10 @@ class DeclarationEntry extends Locatable, TDeclarationEntry {
331331
* `I.getADeclarationEntry()` returns `D`
332332
* but `D.getDeclaration()` only returns `C`
333333
*/
334-
Declaration getDeclaration() { none() }
334+
Declaration getDeclaration() { none() } // overridden in subclasses
335335

336336
/** Gets the name associated with this declaration entry, if any. */
337-
string getName() { none() }
337+
string getName() { none() } // overridden in subclasses
338338

339339
/**
340340
* Gets the type associated with this declaration entry.
@@ -343,7 +343,7 @@ class DeclarationEntry extends Locatable, TDeclarationEntry {
343343
* For function declarations, get the return type of the function.
344344
* For type declarations, get the type being declared.
345345
*/
346-
Type getType() { none() }
346+
Type getType() { none() } // overridden in subclasses
347347

348348
/**
349349
* Gets the type associated with this declaration entry after specifiers
@@ -361,7 +361,7 @@ class DeclarationEntry extends Locatable, TDeclarationEntry {
361361
predicate hasSpecifier(string specifier) { getASpecifier() = specifier }
362362

363363
/** Holds if this declaration entry is a definition. */
364-
predicate isDefinition() { none() }
364+
predicate isDefinition() { none() } // overridden in subclasses
365365

366366
override string toString() {
367367
if isDefinition()
@@ -414,7 +414,7 @@ class AccessHolder extends Declaration, TAccessHolder {
414414
/**
415415
* Gets the nearest enclosing `AccessHolder`.
416416
*/
417-
AccessHolder getEnclosingAccessHolder() { none() }
417+
AccessHolder getEnclosingAccessHolder() { none() } // overridden in subclasses
418418

419419
/**
420420
* Holds if a base class `base` of `derived` _is accessible at_ `this` (N4140

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ class ParameterDeclarationEntry extends VariableDeclarationEntry {
325325
*/
326326
class LocalScopeVariable extends Variable, @localscopevariable {
327327
/** Gets the function to which this variable belongs. */
328-
Function getFunction() { none() }
328+
Function getFunction() { none() } // overridden in subclasses
329329
}
330330

331331
/**

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ class Call extends Expr, NameQualifiableElement, TCall {
8484
* method, and it might not exist.
8585
* - For a variable call, it never exists.
8686
*/
87-
Function getTarget() { none() }
87+
Function getTarget() { none() } // overridden in subclasses
8888

8989
override int getPrecedence() { result = 17 }
9090

0 commit comments

Comments
 (0)