mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
C#: Improved CIL instruction types to pass type consistency checks
This commit is contained in:
@@ -167,7 +167,11 @@ module Opcodes {
|
||||
class Neg extends UnaryExpr, @cil_neg {
|
||||
override string getOpcodeName() { result = "neg" }
|
||||
|
||||
override NumericType getType() { result = getOperand(0).getType() }
|
||||
override NumericType getType() {
|
||||
result = getOperand().getType()
|
||||
or
|
||||
getOperand().getType() instanceof Enum and result instanceof IntType
|
||||
}
|
||||
}
|
||||
|
||||
// Binary operations
|
||||
@@ -1176,7 +1180,9 @@ module Opcodes {
|
||||
class Localloc extends Expr, @cil_localloc {
|
||||
override string getOpcodeName() { result = "localloc" }
|
||||
|
||||
override int getPopCount() { result = 1 } // ??
|
||||
override int getPopCount() { result = 1 }
|
||||
|
||||
override PointerType getType() { result.getReferentType() instanceof ByteType }
|
||||
}
|
||||
|
||||
class Readonly extends Instruction, @cil_readonly {
|
||||
|
||||
Reference in New Issue
Block a user