mirror of
https://github.com/github/codeql.git
synced 2025-12-21 19:26:31 +01:00
C++: Use Opcode::Error for ErrorExpr translation
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
private newtype TOpcode =
|
||||
TNoOp() or
|
||||
TUninitialized() or
|
||||
TError() or
|
||||
TInitializeParameter() or
|
||||
TInitializeThis() or
|
||||
TEnterFunction() or
|
||||
@@ -147,6 +148,7 @@ abstract class BufferAccessOpcode extends MemoryAccessOpcode {}
|
||||
module Opcode {
|
||||
class NoOp extends Opcode, TNoOp { override final string toString() { result = "NoOp" } }
|
||||
class Uninitialized extends MemoryAccessOpcode, TUninitialized { override final string toString() { result = "Uninitialized" } }
|
||||
class Error extends Opcode, TError { override final string toString() { result = "Error" } }
|
||||
class InitializeParameter extends MemoryAccessOpcode, TInitializeParameter { override final string toString() { result = "InitializeParameter" } }
|
||||
class InitializeThis extends Opcode, TInitializeThis { override final string toString() { result = "InitializeThis" } }
|
||||
class EnterFunction extends Opcode, TEnterFunction { override final string toString() { result = "EnterFunction" } }
|
||||
|
||||
@@ -702,6 +702,22 @@ class FieldAddressInstruction extends FieldInstruction {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* An instruction that produces a well-defined but unknown result and has
|
||||
* unknown side effects, including side effects that are not conservatively
|
||||
* modeled in the SSA graph.
|
||||
*
|
||||
* This type of instruction appears when there is an `ErrorExpr` in the AST,
|
||||
* meaning that the extractor could not understand the expression and therefore
|
||||
* produced a partial AST. Queries that give alerts when some action is _not_
|
||||
* taken may want to ignore any function that contains an `ErrorInstruction`.
|
||||
*/
|
||||
class ErrorInstruction extends Instruction {
|
||||
ErrorInstruction() {
|
||||
getOpcode() instanceof Opcode::Error
|
||||
}
|
||||
}
|
||||
|
||||
class UninitializedInstruction extends VariableInstruction {
|
||||
UninitializedInstruction() {
|
||||
getOpcode() instanceof Opcode::Uninitialized
|
||||
|
||||
@@ -702,6 +702,22 @@ class FieldAddressInstruction extends FieldInstruction {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* An instruction that produces a well-defined but unknown result and has
|
||||
* unknown side effects, including side effects that are not conservatively
|
||||
* modeled in the SSA graph.
|
||||
*
|
||||
* This type of instruction appears when there is an `ErrorExpr` in the AST,
|
||||
* meaning that the extractor could not understand the expression and therefore
|
||||
* produced a partial AST. Queries that give alerts when some action is _not_
|
||||
* taken may want to ignore any function that contains an `ErrorInstruction`.
|
||||
*/
|
||||
class ErrorInstruction extends Instruction {
|
||||
ErrorInstruction() {
|
||||
getOpcode() instanceof Opcode::Error
|
||||
}
|
||||
}
|
||||
|
||||
class UninitializedInstruction extends VariableInstruction {
|
||||
UninitializedInstruction() {
|
||||
getOpcode() instanceof Opcode::Uninitialized
|
||||
|
||||
@@ -2892,6 +2892,6 @@ class TranslatedErrorExpr extends TranslatedSingleInstructionExpr {
|
||||
}
|
||||
|
||||
override final Opcode getOpcode() {
|
||||
result instanceof Opcode::NoOp
|
||||
result instanceof Opcode::Error
|
||||
}
|
||||
}
|
||||
|
||||
@@ -702,6 +702,22 @@ class FieldAddressInstruction extends FieldInstruction {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* An instruction that produces a well-defined but unknown result and has
|
||||
* unknown side effects, including side effects that are not conservatively
|
||||
* modeled in the SSA graph.
|
||||
*
|
||||
* This type of instruction appears when there is an `ErrorExpr` in the AST,
|
||||
* meaning that the extractor could not understand the expression and therefore
|
||||
* produced a partial AST. Queries that give alerts when some action is _not_
|
||||
* taken may want to ignore any function that contains an `ErrorInstruction`.
|
||||
*/
|
||||
class ErrorInstruction extends Instruction {
|
||||
ErrorInstruction() {
|
||||
getOpcode() instanceof Opcode::Error
|
||||
}
|
||||
}
|
||||
|
||||
class UninitializedInstruction extends VariableInstruction {
|
||||
UninitializedInstruction() {
|
||||
getOpcode() instanceof Opcode::Uninitialized
|
||||
|
||||
@@ -53,12 +53,12 @@ bad_asts.cpp:
|
||||
# 30| v0_0(void) = EnterFunction :
|
||||
# 30| mu0_1(unknown) = AliasedDefinition :
|
||||
# 30| mu0_2(unknown) = UnmodeledDefinition :
|
||||
#-----| r0_3(glval<error>) = NoOp :
|
||||
#-----| r0_3(glval<error>) = Error :
|
||||
#-----| r0_4(error) = Load : &:r0_3, ~mu0_2
|
||||
# 32| r0_5(glval<int>) = VariableAddress[x] :
|
||||
# 32| r0_6(error) = NoOp :
|
||||
# 32| r0_6(error) = Error :
|
||||
# 32| mu0_7(int) = Store : &:r0_5, r0_6
|
||||
#-----| r0_8(glval<error>) = NoOp :
|
||||
#-----| r0_8(glval<error>) = Error :
|
||||
#-----| r0_9(error) = Load : &:r0_8, ~mu0_2
|
||||
# 33| r0_10(glval<int>) = VariableAddress[x] :
|
||||
# 33| mu0_11(int) = Store : &:r0_10, r0_9
|
||||
|
||||
Reference in New Issue
Block a user