File tree Expand file tree Collapse file tree 6 files changed +54
-4
lines changed
src/semmle/code/cpp/ir/implementation Expand file tree Collapse file tree 6 files changed +54
-4
lines changed Original file line number Diff line number Diff line change 11private newtype TOpcode =
22 TNoOp ( ) or
33 TUninitialized ( ) or
4+ TError ( ) or
45 TInitializeParameter ( ) or
56 TInitializeThis ( ) or
67 TEnterFunction ( ) or
@@ -147,6 +148,7 @@ abstract class BufferAccessOpcode extends MemoryAccessOpcode {}
147148module Opcode {
148149 class NoOp extends Opcode , TNoOp { override final string toString ( ) { result = "NoOp" } }
149150 class Uninitialized extends MemoryAccessOpcode , TUninitialized { override final string toString ( ) { result = "Uninitialized" } }
151+ class Error extends Opcode , TError { override final string toString ( ) { result = "Error" } }
150152 class InitializeParameter extends MemoryAccessOpcode , TInitializeParameter { override final string toString ( ) { result = "InitializeParameter" } }
151153 class InitializeThis extends Opcode , TInitializeThis { override final string toString ( ) { result = "InitializeThis" } }
152154 class EnterFunction extends Opcode , TEnterFunction { override final string toString ( ) { result = "EnterFunction" } }
Original file line number Diff line number Diff line change @@ -702,6 +702,22 @@ class FieldAddressInstruction extends FieldInstruction {
702702 }
703703}
704704
705+ /**
706+ * An instruction that produces a well-defined but unknown result and has
707+ * unknown side effects, including side effects that are not conservatively
708+ * modeled in the SSA graph.
709+ *
710+ * This type of instruction appears when there is an `ErrorExpr` in the AST,
711+ * meaning that the extractor could not understand the expression and therefore
712+ * produced a partial AST. Queries that give alerts when some action is _not_
713+ * taken may want to ignore any function that contains an `ErrorInstruction`.
714+ */
715+ class ErrorInstruction extends Instruction {
716+ ErrorInstruction ( ) {
717+ getOpcode ( ) instanceof Opcode:: Error
718+ }
719+ }
720+
705721class UninitializedInstruction extends VariableInstruction {
706722 UninitializedInstruction ( ) {
707723 getOpcode ( ) instanceof Opcode:: Uninitialized
Original file line number Diff line number Diff line change @@ -702,6 +702,22 @@ class FieldAddressInstruction extends FieldInstruction {
702702 }
703703}
704704
705+ /**
706+ * An instruction that produces a well-defined but unknown result and has
707+ * unknown side effects, including side effects that are not conservatively
708+ * modeled in the SSA graph.
709+ *
710+ * This type of instruction appears when there is an `ErrorExpr` in the AST,
711+ * meaning that the extractor could not understand the expression and therefore
712+ * produced a partial AST. Queries that give alerts when some action is _not_
713+ * taken may want to ignore any function that contains an `ErrorInstruction`.
714+ */
715+ class ErrorInstruction extends Instruction {
716+ ErrorInstruction ( ) {
717+ getOpcode ( ) instanceof Opcode:: Error
718+ }
719+ }
720+
705721class UninitializedInstruction extends VariableInstruction {
706722 UninitializedInstruction ( ) {
707723 getOpcode ( ) instanceof Opcode:: Uninitialized
Original file line number Diff line number Diff line change @@ -2892,6 +2892,6 @@ class TranslatedErrorExpr extends TranslatedSingleInstructionExpr {
28922892 }
28932893
28942894 override final Opcode getOpcode ( ) {
2895- result instanceof Opcode:: NoOp
2895+ result instanceof Opcode:: Error
28962896 }
28972897}
Original file line number Diff line number Diff line change @@ -702,6 +702,22 @@ class FieldAddressInstruction extends FieldInstruction {
702702 }
703703}
704704
705+ /**
706+ * An instruction that produces a well-defined but unknown result and has
707+ * unknown side effects, including side effects that are not conservatively
708+ * modeled in the SSA graph.
709+ *
710+ * This type of instruction appears when there is an `ErrorExpr` in the AST,
711+ * meaning that the extractor could not understand the expression and therefore
712+ * produced a partial AST. Queries that give alerts when some action is _not_
713+ * taken may want to ignore any function that contains an `ErrorInstruction`.
714+ */
715+ class ErrorInstruction extends Instruction {
716+ ErrorInstruction ( ) {
717+ getOpcode ( ) instanceof Opcode:: Error
718+ }
719+ }
720+
705721class UninitializedInstruction extends VariableInstruction {
706722 UninitializedInstruction ( ) {
707723 getOpcode ( ) instanceof Opcode:: Uninitialized
Original file line number Diff line number Diff line change @@ -53,12 +53,12 @@ bad_asts.cpp:
5353# 30| v0_0(void) = EnterFunction :
5454# 30| mu0_1(unknown) = AliasedDefinition :
5555# 30| mu0_2(unknown) = UnmodeledDefinition :
56- #-----| r0_3(glval<error>) = NoOp :
56+ #-----| r0_3(glval<error>) = Error :
5757#-----| r0_4(error) = Load : &:r0_3, ~mu0_2
5858# 32| r0_5(glval<int>) = VariableAddress[x] :
59- # 32| r0_6(error) = NoOp :
59+ # 32| r0_6(error) = Error :
6060# 32| mu0_7(int) = Store : &:r0_5, r0_6
61- #-----| r0_8(glval<error>) = NoOp :
61+ #-----| r0_8(glval<error>) = Error :
6262#-----| r0_9(error) = Load : &:r0_8, ~mu0_2
6363# 33| r0_10(glval<int>) = VariableAddress[x] :
6464# 33| mu0_11(int) = Store : &:r0_10, r0_9
You can’t perform that action at this time.
0 commit comments