Skip to content

Commit b3602a5

Browse files
committed
C#: Use functionname as stored in the database.
1 parent e877b16 commit b3602a5

File tree

1 file changed

+7
-57
lines changed

1 file changed

+7
-57
lines changed

csharp/ql/lib/semmle/code/csharp/Callable.qll

Lines changed: 7 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -435,8 +435,12 @@ class Destructor extends DotNet::Destructor, Callable, Member, Attributable, @de
435435
* (`BinaryOperator`), or a conversion operator (`ConversionOperator`).
436436
*/
437437
class Operator extends Callable, Member, Attributable, @operator {
438-
/** Gets the assembly name of this operator. */
439-
string getAssemblyName() { operators(this, result, _, _, _, _) }
438+
/**
439+
* DEPRECATED: use `getFunctionName()` instead.
440+
*
441+
* Gets the assembly name of this operator.
442+
*/
443+
deprecated string getAssemblyName() { result = this.getFunctionName() }
440444

441445
override string getName() { operators(this, _, result, _, _, _) }
442446

@@ -445,7 +449,7 @@ class Operator extends Callable, Member, Attributable, @operator {
445449
/**
446450
* Gets the metadata name of the operator, such as `op_implicit` or `op_RightShift`.
447451
*/
448-
string getFunctionName() { none() }
452+
string getFunctionName() { operators(this, result, _, _, _, _) }
449453

450454
override ValueOrRefType getDeclaringType() { operators(this, _, _, result, _, _) }
451455

@@ -505,8 +509,6 @@ class UnaryOperator extends Operator {
505509
class PlusOperator extends UnaryOperator {
506510
PlusOperator() { this.getName() = "+" }
507511

508-
override string getFunctionName() { result = "op_UnaryPlus" }
509-
510512
override string getAPrimaryQlClass() { result = "PlusOperator" }
511513
}
512514

@@ -522,8 +524,6 @@ class PlusOperator extends UnaryOperator {
522524
class MinusOperator extends UnaryOperator {
523525
MinusOperator() { this.getName() = "-" }
524526

525-
override string getFunctionName() { result = "op_UnaryNegation" }
526-
527527
override string getAPrimaryQlClass() { result = "MinusOperator" }
528528
}
529529

@@ -539,8 +539,6 @@ class MinusOperator extends UnaryOperator {
539539
class NotOperator extends UnaryOperator {
540540
NotOperator() { this.getName() = "!" }
541541

542-
override string getFunctionName() { result = "op_LogicalNot" }
543-
544542
override string getAPrimaryQlClass() { result = "NotOperator" }
545543
}
546544

@@ -556,8 +554,6 @@ class NotOperator extends UnaryOperator {
556554
class ComplementOperator extends UnaryOperator {
557555
ComplementOperator() { this.getName() = "~" }
558556

559-
override string getFunctionName() { result = "op_OnesComplement" }
560-
561557
override string getAPrimaryQlClass() { result = "ComplementOperator" }
562558
}
563559

@@ -573,8 +569,6 @@ class ComplementOperator extends UnaryOperator {
573569
class IncrementOperator extends UnaryOperator {
574570
IncrementOperator() { this.getName() = "++" }
575571

576-
override string getFunctionName() { result = "op_Increment" }
577-
578572
override string getAPrimaryQlClass() { result = "IncrementOperator" }
579573
}
580574

@@ -590,8 +584,6 @@ class IncrementOperator extends UnaryOperator {
590584
class DecrementOperator extends UnaryOperator {
591585
DecrementOperator() { this.getName() = "--" }
592586

593-
override string getFunctionName() { result = "op_Decrement" }
594-
595587
override string getAPrimaryQlClass() { result = "DecrementOperator" }
596588
}
597589

@@ -607,8 +599,6 @@ class DecrementOperator extends UnaryOperator {
607599
class FalseOperator extends UnaryOperator {
608600
FalseOperator() { this.getName() = "false" }
609601

610-
override string getFunctionName() { result = "op_False" }
611-
612602
override string getAPrimaryQlClass() { result = "FalseOperator" }
613603
}
614604

@@ -624,8 +614,6 @@ class FalseOperator extends UnaryOperator {
624614
class TrueOperator extends UnaryOperator {
625615
TrueOperator() { this.getName() = "true" }
626616

627-
override string getFunctionName() { result = "op_True" }
628-
629617
override string getAPrimaryQlClass() { result = "TrueOperator" }
630618
}
631619

@@ -659,8 +647,6 @@ class BinaryOperator extends Operator {
659647
class AddOperator extends BinaryOperator {
660648
AddOperator() { this.getName() = "+" }
661649

662-
override string getFunctionName() { result = "op_Addition" }
663-
664650
override string getAPrimaryQlClass() { result = "AddOperator" }
665651
}
666652

@@ -676,8 +662,6 @@ class AddOperator extends BinaryOperator {
676662
class SubOperator extends BinaryOperator {
677663
SubOperator() { this.getName() = "-" }
678664

679-
override string getFunctionName() { result = "op_Subtraction" }
680-
681665
override string getAPrimaryQlClass() { result = "SubOperator" }
682666
}
683667

@@ -693,8 +677,6 @@ class SubOperator extends BinaryOperator {
693677
class MulOperator extends BinaryOperator {
694678
MulOperator() { this.getName() = "*" }
695679

696-
override string getFunctionName() { result = "op_Multiply" }
697-
698680
override string getAPrimaryQlClass() { result = "MulOperator" }
699681
}
700682

@@ -710,8 +692,6 @@ class MulOperator extends BinaryOperator {
710692
class DivOperator extends BinaryOperator {
711693
DivOperator() { this.getName() = "/" }
712694

713-
override string getFunctionName() { result = "op_Division" }
714-
715695
override string getAPrimaryQlClass() { result = "DivOperator" }
716696
}
717697

@@ -727,8 +707,6 @@ class DivOperator extends BinaryOperator {
727707
class RemOperator extends BinaryOperator {
728708
RemOperator() { this.getName() = "%" }
729709

730-
override string getFunctionName() { result = "op_Modulus" }
731-
732710
override string getAPrimaryQlClass() { result = "RemOperator" }
733711
}
734712

@@ -744,8 +722,6 @@ class RemOperator extends BinaryOperator {
744722
class AndOperator extends BinaryOperator {
745723
AndOperator() { this.getName() = "&" }
746724

747-
override string getFunctionName() { result = "op_BitwiseAnd" }
748-
749725
override string getAPrimaryQlClass() { result = "AndOperator" }
750726
}
751727

@@ -761,8 +737,6 @@ class AndOperator extends BinaryOperator {
761737
class OrOperator extends BinaryOperator {
762738
OrOperator() { this.getName() = "|" }
763739

764-
override string getFunctionName() { result = "op_BitwiseOr" }
765-
766740
override string getAPrimaryQlClass() { result = "OrOperator" }
767741
}
768742

@@ -778,8 +752,6 @@ class OrOperator extends BinaryOperator {
778752
class XorOperator extends BinaryOperator {
779753
XorOperator() { this.getName() = "^" }
780754

781-
override string getFunctionName() { result = "op_ExclusiveOr" }
782-
783755
override string getAPrimaryQlClass() { result = "XorOperator" }
784756
}
785757

@@ -795,8 +767,6 @@ class XorOperator extends BinaryOperator {
795767
class LeftShiftOperator extends BinaryOperator {
796768
LeftShiftOperator() { this.getName() = "<<" }
797769

798-
override string getFunctionName() { result = "op_LeftShift" }
799-
800770
override string getAPrimaryQlClass() { result = "LeftShiftOperator" }
801771
}
802772

@@ -815,8 +785,6 @@ deprecated class LShiftOperator = LeftShiftOperator;
815785
class RightShiftOperator extends BinaryOperator {
816786
RightShiftOperator() { this.getName() = ">>" }
817787

818-
override string getFunctionName() { result = "op_RightShift" }
819-
820788
override string getAPrimaryQlClass() { result = "RightShiftOperator" }
821789
}
822790

@@ -835,8 +803,6 @@ deprecated class RShiftOperator = RightShiftOperator;
835803
class UnsignedRightShiftOperator extends BinaryOperator {
836804
UnsignedRightShiftOperator() { this.getName() = ">>>" }
837805

838-
override string getFunctionName() { result = "op_UnsignedRightShift" }
839-
840806
override string getAPrimaryQlClass() { result = "UnsignedRightShiftOperator" }
841807
}
842808

@@ -852,8 +818,6 @@ class UnsignedRightShiftOperator extends BinaryOperator {
852818
class EQOperator extends BinaryOperator {
853819
EQOperator() { this.getName() = "==" }
854820

855-
override string getFunctionName() { result = "op_Equality" }
856-
857821
override string getAPrimaryQlClass() { result = "EQOperator" }
858822
}
859823

@@ -869,8 +833,6 @@ class EQOperator extends BinaryOperator {
869833
class NEOperator extends BinaryOperator {
870834
NEOperator() { this.getName() = "!=" }
871835

872-
override string getFunctionName() { result = "op_Inequality" }
873-
874836
override string getAPrimaryQlClass() { result = "NEOperator" }
875837
}
876838

@@ -886,8 +848,6 @@ class NEOperator extends BinaryOperator {
886848
class LTOperator extends BinaryOperator {
887849
LTOperator() { this.getName() = "<" }
888850

889-
override string getFunctionName() { result = "op_LessThan" }
890-
891851
override string getAPrimaryQlClass() { result = "LTOperator" }
892852
}
893853

@@ -903,8 +863,6 @@ class LTOperator extends BinaryOperator {
903863
class GTOperator extends BinaryOperator {
904864
GTOperator() { this.getName() = ">" }
905865

906-
override string getFunctionName() { result = "op_GreaterThan" }
907-
908866
override string getAPrimaryQlClass() { result = "GTOperator" }
909867
}
910868

@@ -920,8 +878,6 @@ class GTOperator extends BinaryOperator {
920878
class LEOperator extends BinaryOperator {
921879
LEOperator() { this.getName() = "<=" }
922880

923-
override string getFunctionName() { result = "op_LessThanOrEqual" }
924-
925881
override string getAPrimaryQlClass() { result = "LEOperator" }
926882
}
927883

@@ -937,8 +893,6 @@ class LEOperator extends BinaryOperator {
937893
class GEOperator extends BinaryOperator {
938894
GEOperator() { this.getName() = ">=" }
939895

940-
override string getFunctionName() { result = "op_GreaterThanOrEqual" }
941-
942896
override string getAPrimaryQlClass() { result = "GEOperator" }
943897
}
944898

@@ -976,8 +930,6 @@ class ConversionOperator extends Operator {
976930
class ImplicitConversionOperator extends ConversionOperator {
977931
ImplicitConversionOperator() { this.getName() = "implicit conversion" }
978932

979-
override string getFunctionName() { result = "op_Implicit" }
980-
981933
override string getAPrimaryQlClass() { result = "ImplicitConversionOperator" }
982934
}
983935

@@ -993,8 +945,6 @@ class ImplicitConversionOperator extends ConversionOperator {
993945
class ExplicitConversionOperator extends ConversionOperator {
994946
ExplicitConversionOperator() { this.getName() = "explicit conversion" }
995947

996-
override string getFunctionName() { result = "op_Explicit" }
997-
998948
override string getAPrimaryQlClass() { result = "ExplicitConversionOperator" }
999949
}
1000950

0 commit comments

Comments
 (0)