Skip to content

Commit 955c20d

Browse files
committed
Add pragmas to improve performance
1 parent 68dfa5c commit 955c20d

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

go/ql/lib/semmle/go/Decls.qll

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,7 @@ class FieldBase extends @field, ExprParent {
457457
/**
458458
* Gets the expression representing the type of the fields declared in this declaration.
459459
*/
460+
pragma[nomagic]
460461
Expr getTypeExpr() { result = this.getChildExpr(0) }
461462

462463
/**
@@ -489,6 +490,7 @@ class FieldBase extends @field, ExprParent {
489490
class FieldDecl extends FieldBase, Documentable, ExprParent {
490491
StructTypeExpr st;
491492

493+
pragma[nomagic]
492494
FieldDecl() { this = st.getField(_) }
493495

494496
/**

go/ql/lib/semmle/go/Expr.qll

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,7 @@ class Ellipsis extends @ellipsis, Expr {
234234
* ```
235235
*/
236236
class Literal extends Expr {
237+
pragma[nomagic]
237238
Literal() {
238239
this instanceof @basiclit or this instanceof @funclit or this instanceof @compositelit
239240
}
@@ -575,10 +576,14 @@ class ParenExpr extends @parenexpr, Expr {
575576
* ```
576577
*/
577578
class SelectorExpr extends @selectorexpr, Expr {
579+
pragma[nomagic]
580+
SelectorExpr() { any() }
581+
578582
/** Gets the base of this selector expression. */
579583
Expr getBase() { result = this.getChildExpr(0) }
580584

581585
/** Gets the selector of this selector expression. */
586+
pragma[inline]
582587
Ident getSelector() { result = this.getChildExpr(1) }
583588

584589
/** Holds if this selector is a use of `e`. */
@@ -984,6 +989,9 @@ class KeyValueExpr extends @keyvalueexpr, Expr {
984989
* ```
985990
*/
986991
class ArrayTypeExpr extends @arraytypeexpr, TypeExpr {
992+
pragma[nomagic]
993+
ArrayTypeExpr() { any() }
994+
987995
/** Gets the length expression of this array type. */
988996
Expr getLength() { result = this.getChildExpr(0) }
989997

0 commit comments

Comments
 (0)