mirror of
https://github.com/github/codeql.git
synced 2026-04-26 01:05:15 +02:00
C++: Add an example of double negation to the IR tests.
This commit is contained in:
@@ -4932,7 +4932,20 @@ ir.c:
|
||||
# 103| Type = [IntType] int
|
||||
# 103| ValueCategory = prvalue(load)
|
||||
# 103| getThen(): [BlockStmt] { ... }
|
||||
# 104| getStmt(16): [ReturnStmt] return ...
|
||||
# 105| getStmt(16): [DeclStmt] declaration
|
||||
# 105| getDeclarationEntry(0): [VariableDeclarationEntry] definition of double_negation
|
||||
# 105| Type = [IntType] int
|
||||
# 105| getVariable().getInitializer(): [Initializer] initializer for double_negation
|
||||
# 105| getExpr(): [NotExpr] ! ...
|
||||
# 105| Type = [IntType] int
|
||||
# 105| ValueCategory = prvalue
|
||||
# 105| getOperand(): [NotExpr] ! ...
|
||||
# 105| Type = [IntType] int
|
||||
# 105| ValueCategory = prvalue
|
||||
# 105| getOperand(): [VariableAccess] x1
|
||||
# 105| Type = [IntType] int
|
||||
# 105| ValueCategory = prvalue(load)
|
||||
# 106| getStmt(17): [ReturnStmt] return ...
|
||||
ir.cpp:
|
||||
# 1| [TopLevelFunction] void Constants()
|
||||
# 1| <params>:
|
||||
|
||||
@@ -3969,11 +3969,18 @@ ir.c:
|
||||
# 103| v103_6(void) = NoOp :
|
||||
#-----| Goto -> Block 40
|
||||
|
||||
# 104| Block 40
|
||||
# 104| v104_1(void) = NoOp :
|
||||
# 84| v84_9(void) = ReturnVoid :
|
||||
# 84| v84_10(void) = AliasedUse : m84_3
|
||||
# 84| v84_11(void) = ExitFunction :
|
||||
# 105| Block 40
|
||||
# 105| r105_1(glval<int>) = VariableAddress[double_negation] :
|
||||
# 105| r105_2(glval<int>) = VariableAddress[x1] :
|
||||
# 105| r105_3(int) = Load[x1] : &:r105_2, m84_6
|
||||
# 105| r105_4(int) = Constant[0] :
|
||||
# 105| r105_5(bool) = CompareEQ : r105_3, r105_4
|
||||
# 105| r105_6(bool) = LogicalNot : r105_5
|
||||
# 105| m105_7(int) = Store[double_negation] : &:r105_1, r105_6
|
||||
# 106| v106_1(void) = NoOp :
|
||||
# 84| v84_9(void) = ReturnVoid :
|
||||
# 84| v84_10(void) = AliasedUse : m84_3
|
||||
# 84| v84_11(void) = ExitFunction :
|
||||
|
||||
ir.cpp:
|
||||
# 1| void Constants()
|
||||
|
||||
@@ -101,6 +101,8 @@ void branch_on_integral_in_c(int x1, int x2) {
|
||||
int x_1_and_2 = x1 && x2;
|
||||
if(x_1_and_2) {}
|
||||
if(!x_1_and_2) {}
|
||||
|
||||
int double_negation = !!x1;
|
||||
}
|
||||
|
||||
// semmle-extractor-options: --microsoft
|
||||
|
||||
@@ -3605,11 +3605,18 @@ ir.c:
|
||||
# 103| v103_6(void) = NoOp :
|
||||
#-----| Goto -> Block 40
|
||||
|
||||
# 104| Block 40
|
||||
# 104| v104_1(void) = NoOp :
|
||||
# 84| v84_8(void) = ReturnVoid :
|
||||
# 84| v84_9(void) = AliasedUse : ~m?
|
||||
# 84| v84_10(void) = ExitFunction :
|
||||
# 105| Block 40
|
||||
# 105| r105_1(glval<int>) = VariableAddress[double_negation] :
|
||||
# 105| r105_2(glval<int>) = VariableAddress[x1] :
|
||||
# 105| r105_3(int) = Load[x1] : &:r105_2, ~m?
|
||||
# 105| r105_4(int) = Constant[0] :
|
||||
# 105| r105_5(bool) = CompareEQ : r105_3, r105_4
|
||||
# 105| r105_6(bool) = LogicalNot : r105_5
|
||||
# 105| mu105_7(int) = Store[double_negation] : &:r105_1, r105_6
|
||||
# 106| v106_1(void) = NoOp :
|
||||
# 84| v84_8(void) = ReturnVoid :
|
||||
# 84| v84_9(void) = AliasedUse : ~m?
|
||||
# 84| v84_10(void) = ExitFunction :
|
||||
|
||||
ir.cpp:
|
||||
# 1| void Constants()
|
||||
|
||||
Reference in New Issue
Block a user