Skip to content

Commit 95a9e44

Browse files
committed
patch upper-case acronyms to be PascalCase
1 parent 858e9bf commit 95a9e44

File tree

359 files changed

+3309
-2068
lines changed

Some content is hidden

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

359 files changed

+3309
-2068
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ private import PrintAST
88
private predicate shouldPrintDeclaration(Declaration decl) {
99
not decl instanceof Function
1010
or
11-
not exists(PrintASTConfiguration c)
11+
not exists(PrintAstConfiguration c)
1212
or
13-
exists(PrintASTConfiguration config | config.shouldPrintFunction(decl))
13+
exists(PrintAstConfiguration config | config.shouldPrintFunction(decl))
1414
}
1515

1616
/**

cpp/ql/lib/semmle/code/cpp/PrintAST.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import PrintAST
1212
* Temporarily tweak this class or make a copy to control which functions are
1313
* printed.
1414
*/
15-
class Cfg extends PrintASTConfiguration {
15+
class Cfg extends PrintAstConfiguration {
1616
/**
1717
* TWEAK THIS PREDICATE AS NEEDED.
1818
* Holds if the AST for `func` should be printed.

cpp/ql/lib/semmle/code/cpp/PrintAST.qll

Lines changed: 55 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99
import cpp
1010
private import semmle.code.cpp.Print
1111

12-
private newtype TPrintASTConfiguration = MkPrintASTConfiguration()
12+
private newtype TPrintASTConfiguration = MkPrintAstConfiguration()
1313

1414
/**
1515
* The query can extend this class to control which functions are printed.
1616
*/
17-
class PrintASTConfiguration extends TPrintASTConfiguration {
17+
class PrintAstConfiguration extends TPrintASTConfiguration {
1818
/**
1919
* Gets a textual representation of this `PrintASTConfiguration`.
2020
*/
@@ -27,8 +27,11 @@ class PrintASTConfiguration extends TPrintASTConfiguration {
2727
predicate shouldPrintFunction(Function func) { any() }
2828
}
2929

30+
/** DEPRECATED: Alias for PrintAstConfiguration */
31+
deprecated class PrintASTConfiguration = PrintAstConfiguration;
32+
3033
private predicate shouldPrintFunction(Function func) {
31-
exists(PrintASTConfiguration config | config.shouldPrintFunction(func))
34+
exists(PrintAstConfiguration config | config.shouldPrintFunction(func))
3235
}
3336

3437
bindingset[s]
@@ -86,7 +89,7 @@ private Function getEnclosingFunction(Locatable ast) {
8689
* nodes for things like parameter lists and constructor init lists.
8790
*/
8891
private newtype TPrintASTNode =
89-
TASTNode(Locatable ast) { shouldPrintFunction(getEnclosingFunction(ast)) } or
92+
TAstNode(Locatable ast) { shouldPrintFunction(getEnclosingFunction(ast)) } or
9093
TDeclarationEntryNode(DeclStmt stmt, DeclarationEntry entry) {
9194
// We create a unique node for each pair of (stmt, entry), to avoid having one node with
9295
// multiple parents due to extractor bug CPP-413.
@@ -106,7 +109,7 @@ private newtype TPrintASTNode =
106109
/**
107110
* A node in the output tree.
108111
*/
109-
class PrintASTNode extends TPrintASTNode {
112+
class PrintAstNode extends TPrintASTNode {
110113
/**
111114
* Gets a textual representation of this node in the PrintAST output tree.
112115
*/
@@ -116,17 +119,17 @@ class PrintASTNode extends TPrintASTNode {
116119
* Gets the child node at index `childIndex`. Child indices must be unique,
117120
* but need not be contiguous.
118121
*/
119-
abstract PrintASTNode getChildInternal(int childIndex);
122+
abstract PrintAstNode getChildInternal(int childIndex);
120123

121124
/**
122125
* Gets the child node at index `childIndex`.
123126
* Adds edges to fully converted expressions, that are not part of the
124127
* regular parent/child relation traversal.
125128
*/
126-
final PrintASTNode getChild(int childIndex) {
129+
final PrintAstNode getChild(int childIndex) {
127130
// The exact value of `childIndex` doesn't matter, as long as we preserve the correct order.
128131
result =
129-
rank[childIndex](PrintASTNode child, int nonConvertedIndex, boolean isConverted |
132+
rank[childIndex](PrintAstNode child, int nonConvertedIndex, boolean isConverted |
130133
childAndAccessorPredicate(child, _, nonConvertedIndex, isConverted)
131134
|
132135
// Unconverted children come first, then sort by original child index within each group.
@@ -138,11 +141,11 @@ class PrintASTNode extends TPrintASTNode {
138141
* Gets the node for the `.getFullyConverted()` version of the child originally at index
139142
* `childIndex`, if that node has any conversions.
140143
*/
141-
private PrintASTNode getConvertedChild(int childIndex) {
144+
private PrintAstNode getConvertedChild(int childIndex) {
142145
exists(Expr expr |
143-
expr = getChildInternal(childIndex).(ASTNode).getAST() and
146+
expr = getChildInternal(childIndex).(AstNode).getAST() and
144147
expr.getFullyConverted() instanceof Conversion and
145-
result.(ASTNode).getAST() = expr.getFullyConverted() and
148+
result.(AstNode).getAST() = expr.getFullyConverted() and
146149
not expr instanceof Conversion
147150
)
148151
}
@@ -166,12 +169,12 @@ class PrintASTNode extends TPrintASTNode {
166169
/**
167170
* Gets the children of this node.
168171
*/
169-
final PrintASTNode getAChild() { result = getChild(_) }
172+
final PrintAstNode getAChild() { result = getChild(_) }
170173

171174
/**
172175
* Gets the parent of this node, if any.
173176
*/
174-
final PrintASTNode getParent() { result.getAChild() = this }
177+
final PrintAstNode getParent() { result.getAChild() = this }
175178

176179
/**
177180
* Gets the location of this node in the source code.
@@ -196,7 +199,7 @@ class PrintASTNode extends TPrintASTNode {
196199
* one result tuple, with `isConverted = false`.
197200
*/
198201
private predicate childAndAccessorPredicate(
199-
PrintASTNode child, string childPredicate, int nonConvertedIndex, boolean isConverted
202+
PrintAstNode child, string childPredicate, int nonConvertedIndex, boolean isConverted
200203
) {
201204
child = getChildInternal(nonConvertedIndex) and
202205
childPredicate = getChildAccessorPredicateInternal(nonConvertedIndex) and
@@ -234,12 +237,15 @@ class PrintASTNode extends TPrintASTNode {
234237
private Function getEnclosingFunction() { result = getParent*().(FunctionNode).getFunction() }
235238
}
236239

240+
/** DEPRECATED: Alias for PrintAstNode */
241+
deprecated class PrintASTNode = PrintAstNode;
242+
237243
/**
238244
* Class that restricts the elements that we compute `qlClass` for.
239245
*/
240246
private class PrintableElement extends Element {
241247
PrintableElement() {
242-
exists(TASTNode(this))
248+
exists(TAstNode(this))
243249
or
244250
exists(TDeclarationEntryNode(_, this))
245251
or
@@ -262,7 +268,7 @@ private string qlClass(PrintableElement el) {
262268
/**
263269
* A node representing an AST node.
264270
*/
265-
abstract class BaseASTNode extends PrintASTNode {
271+
abstract class BaseAstNode extends PrintAstNode {
266272
Locatable ast;
267273

268274
override string toString() { result = qlClass(ast) + ast.toString() }
@@ -275,22 +281,28 @@ abstract class BaseASTNode extends PrintASTNode {
275281
final Locatable getAST() { result = ast }
276282
}
277283

284+
/** DEPRECATED: Alias for BaseAstNode */
285+
deprecated class BaseASTNode = BaseAstNode;
286+
278287
/**
279288
* A node representing an AST node other than a `DeclarationEntry`.
280289
*/
281-
abstract class ASTNode extends BaseASTNode, TASTNode {
282-
ASTNode() { this = TASTNode(ast) }
290+
abstract class AstNode extends BaseAstNode, TAstNode {
291+
AstNode() { this = TAstNode(ast) }
283292
}
284293

294+
/** DEPRECATED: Alias for AstNode */
295+
deprecated class ASTNode = AstNode;
296+
285297
/**
286298
* A node representing an `Expr`.
287299
*/
288-
class ExprNode extends ASTNode {
300+
class ExprNode extends AstNode {
289301
Expr expr;
290302

291303
ExprNode() { expr = ast }
292304

293-
override ASTNode getChildInternal(int childIndex) { result.getAST() = expr.getChild(childIndex) }
305+
override AstNode getChildInternal(int childIndex) { result.getAST() = expr.getChild(childIndex) }
294306

295307
override string getProperty(string key) {
296308
result = super.getProperty(key)
@@ -334,7 +346,7 @@ class ConversionNode extends ExprNode {
334346

335347
ConversionNode() { conv = expr }
336348

337-
override ASTNode getChildInternal(int childIndex) {
349+
override AstNode getChildInternal(int childIndex) {
338350
childIndex = 0 and
339351
result.getAST() = conv.getExpr() and
340352
conv.getExpr() instanceof Conversion
@@ -363,7 +375,7 @@ class CastNode extends ConversionNode {
363375
class StmtExprNode extends ExprNode {
364376
override StmtExpr expr;
365377

366-
override ASTNode getChildInternal(int childIndex) {
378+
override AstNode getChildInternal(int childIndex) {
367379
childIndex = 0 and
368380
result.getAST() = expr.getStmt()
369381
}
@@ -372,18 +384,18 @@ class StmtExprNode extends ExprNode {
372384
/**
373385
* A node representing a `DeclarationEntry`.
374386
*/
375-
class DeclarationEntryNode extends BaseASTNode, TDeclarationEntryNode {
387+
class DeclarationEntryNode extends BaseAstNode, TDeclarationEntryNode {
376388
override DeclarationEntry ast;
377389
DeclStmt declStmt;
378390

379391
DeclarationEntryNode() { this = TDeclarationEntryNode(declStmt, ast) }
380392

381-
override PrintASTNode getChildInternal(int childIndex) { none() }
393+
override PrintAstNode getChildInternal(int childIndex) { none() }
382394

383395
override string getChildAccessorPredicateInternal(int childIndex) { none() }
384396

385397
override string getProperty(string key) {
386-
result = BaseASTNode.super.getProperty(key)
398+
result = BaseAstNode.super.getProperty(key)
387399
or
388400
key = "Type" and
389401
result = qlClass(ast.getType()) + ast.getType().toString()
@@ -396,7 +408,7 @@ class DeclarationEntryNode extends BaseASTNode, TDeclarationEntryNode {
396408
class VariableDeclarationEntryNode extends DeclarationEntryNode {
397409
override VariableDeclarationEntry ast;
398410

399-
override ASTNode getChildInternal(int childIndex) {
411+
override AstNode getChildInternal(int childIndex) {
400412
childIndex = 0 and
401413
result.getAST() = ast.getVariable().getInitializer()
402414
}
@@ -410,12 +422,12 @@ class VariableDeclarationEntryNode extends DeclarationEntryNode {
410422
/**
411423
* A node representing a `Stmt`.
412424
*/
413-
class StmtNode extends ASTNode {
425+
class StmtNode extends AstNode {
414426
Stmt stmt;
415427

416428
StmtNode() { stmt = ast }
417429

418-
override BaseASTNode getChildInternal(int childIndex) {
430+
override BaseAstNode getChildInternal(int childIndex) {
419431
exists(Locatable child |
420432
child = stmt.getChild(childIndex) and
421433
(
@@ -449,12 +461,12 @@ class DeclStmtNode extends StmtNode {
449461
/**
450462
* A node representing a `Parameter`.
451463
*/
452-
class ParameterNode extends ASTNode {
464+
class ParameterNode extends AstNode {
453465
Parameter param;
454466

455467
ParameterNode() { param = ast }
456468

457-
final override PrintASTNode getChildInternal(int childIndex) { none() }
469+
final override PrintAstNode getChildInternal(int childIndex) { none() }
458470

459471
final override string getChildAccessorPredicateInternal(int childIndex) { none() }
460472

@@ -469,12 +481,12 @@ class ParameterNode extends ASTNode {
469481
/**
470482
* A node representing an `Initializer`.
471483
*/
472-
class InitializerNode extends ASTNode {
484+
class InitializerNode extends AstNode {
473485
Initializer init;
474486

475487
InitializerNode() { init = ast }
476488

477-
override ASTNode getChildInternal(int childIndex) {
489+
override AstNode getChildInternal(int childIndex) {
478490
childIndex = 0 and
479491
result.getAST() = init.getExpr()
480492
}
@@ -488,7 +500,7 @@ class InitializerNode extends ASTNode {
488500
/**
489501
* A node representing the parameters of a `Function`.
490502
*/
491-
class ParametersNode extends PrintASTNode, TParametersNode {
503+
class ParametersNode extends PrintAstNode, TParametersNode {
492504
Function func;
493505

494506
ParametersNode() { this = TParametersNode(func) }
@@ -497,7 +509,7 @@ class ParametersNode extends PrintASTNode, TParametersNode {
497509

498510
final override Location getLocation() { result = getRepresentativeLocation(func) }
499511

500-
override ASTNode getChildInternal(int childIndex) {
512+
override AstNode getChildInternal(int childIndex) {
501513
result.getAST() = func.getParameter(childIndex)
502514
}
503515

@@ -515,7 +527,7 @@ class ParametersNode extends PrintASTNode, TParametersNode {
515527
/**
516528
* A node representing the initializer list of a `Constructor`.
517529
*/
518-
class ConstructorInitializersNode extends PrintASTNode, TConstructorInitializersNode {
530+
class ConstructorInitializersNode extends PrintAstNode, TConstructorInitializersNode {
519531
Constructor ctor;
520532

521533
ConstructorInitializersNode() { this = TConstructorInitializersNode(ctor) }
@@ -524,7 +536,7 @@ class ConstructorInitializersNode extends PrintASTNode, TConstructorInitializers
524536

525537
final override Location getLocation() { result = getRepresentativeLocation(ctor) }
526538

527-
final override ASTNode getChildInternal(int childIndex) {
539+
final override AstNode getChildInternal(int childIndex) {
528540
result.getAST() = ctor.getInitializer(childIndex)
529541
}
530542

@@ -542,7 +554,7 @@ class ConstructorInitializersNode extends PrintASTNode, TConstructorInitializers
542554
/**
543555
* A node representing the destruction list of a `Destructor`.
544556
*/
545-
class DestructorDestructionsNode extends PrintASTNode, TDestructorDestructionsNode {
557+
class DestructorDestructionsNode extends PrintAstNode, TDestructorDestructionsNode {
546558
Destructor dtor;
547559

548560
DestructorDestructionsNode() { this = TDestructorDestructionsNode(dtor) }
@@ -551,7 +563,7 @@ class DestructorDestructionsNode extends PrintASTNode, TDestructorDestructionsNo
551563

552564
final override Location getLocation() { result = getRepresentativeLocation(dtor) }
553565

554-
final override ASTNode getChildInternal(int childIndex) {
566+
final override AstNode getChildInternal(int childIndex) {
555567
result.getAST() = dtor.getDestruction(childIndex)
556568
}
557569

@@ -569,22 +581,22 @@ class DestructorDestructionsNode extends PrintASTNode, TDestructorDestructionsNo
569581
/**
570582
* A node representing a `Function`.
571583
*/
572-
class FunctionNode extends ASTNode {
584+
class FunctionNode extends AstNode {
573585
Function func;
574586

575587
FunctionNode() { func = ast }
576588

577589
override string toString() { result = qlClass(func) + getIdentityString(func) }
578590

579-
override PrintASTNode getChildInternal(int childIndex) {
591+
override PrintAstNode getChildInternal(int childIndex) {
580592
childIndex = 0 and
581593
result.(ParametersNode).getFunction() = func
582594
or
583595
childIndex = 1 and
584596
result.(ConstructorInitializersNode).getConstructor() = func
585597
or
586598
childIndex = 2 and
587-
result.(ASTNode).getAST() = func.getEntryPoint()
599+
result.(AstNode).getAST() = func.getEntryPoint()
588600
or
589601
childIndex = 3 and
590602
result.(DestructorDestructionsNode).getDestructor() = func
@@ -856,7 +868,7 @@ private predicate namedExprChildPredicates(Expr expr, Element ele, string pred)
856868
}
857869

858870
/** Holds if `node` belongs to the output tree, and its property `key` has the given `value`. */
859-
query predicate nodes(PrintASTNode node, string key, string value) {
871+
query predicate nodes(PrintAstNode node, string key, string value) {
860872
node.shouldPrint() and
861873
value = node.getProperty(key)
862874
}
@@ -865,7 +877,7 @@ query predicate nodes(PrintASTNode node, string key, string value) {
865877
* Holds if `target` is a child of `source` in the AST, and property `key` of the edge has the
866878
* given `value`.
867879
*/
868-
query predicate edges(PrintASTNode source, PrintASTNode target, string key, string value) {
880+
query predicate edges(PrintAstNode source, PrintAstNode target, string key, string value) {
869881
exists(int childIndex |
870882
source.shouldPrint() and
871883
target.shouldPrint() and

0 commit comments

Comments
 (0)