From bf21a471ed2377e784b0eb76f4ff2a890bb1d2c8 Mon Sep 17 00:00:00 2001 From: Robert Marsh Date: Mon, 14 Mar 2022 17:11:36 -0400 Subject: [PATCH 01/19] C++: add some global variables to IR tests --- cpp/ql/test/library-tests/ir/ir/ir.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cpp/ql/test/library-tests/ir/ir/ir.cpp b/cpp/ql/test/library-tests/ir/ir/ir.cpp index 8ed4574a530..cf4161745d6 100644 --- a/cpp/ql/test/library-tests/ir/ir/ir.cpp +++ b/cpp/ql/test/library-tests/ir/ir/ir.cpp @@ -1669,4 +1669,10 @@ void tuple_structured_binding_no_ref_get() { } } +int global_1; + +int global_2 = 1; + +const int global_3 = 2; + // semmle-extractor-options: -std=c++17 --clang From 143b79c0ccda6834bcdfa7809b1e2ed5dfbc9a6d Mon Sep 17 00:00:00 2001 From: Robert Marsh Date: Mon, 14 Mar 2022 17:12:30 -0400 Subject: [PATCH 02/19] C++/WIP: Generate IR for global variables --- .../internal/IRFunctionBase.qll | 23 ++++++++++++------- .../raw/internal/IRConstruction.qll | 3 +++ .../raw/internal/TranslatedElement.qll | 9 +++++--- .../code/cpp/ir/internal/IRCppLanguage.qll | 2 ++ 4 files changed, 26 insertions(+), 11 deletions(-) diff --git a/cpp/ql/lib/semmle/code/cpp/ir/implementation/internal/IRFunctionBase.qll b/cpp/ql/lib/semmle/code/cpp/ir/implementation/internal/IRFunctionBase.qll index 60895ce3d26..557a9a7b5e2 100644 --- a/cpp/ql/lib/semmle/code/cpp/ir/implementation/internal/IRFunctionBase.qll +++ b/cpp/ql/lib/semmle/code/cpp/ir/implementation/internal/IRFunctionBase.qll @@ -5,23 +5,30 @@ private import IRFunctionBaseInternal private newtype TIRFunction = - MkIRFunction(Language::Function func) { IRConstruction::Raw::functionHasIR(func) } + TFunctionIRFunction(Language::Function func) { IRConstruction::Raw::functionHasIR(func) } or + TVarInitIRFunction(Language::GlobalVariable var) { IRConstruction::Raw::varHasIRFunc(var) } /** * The IR for a function. This base class contains only the predicates that are the same between all * phases of the IR. Each instantiation of `IRFunction` extends this class. */ class IRFunctionBase extends TIRFunction { - Language::Function func; - - IRFunctionBase() { this = MkIRFunction(func) } - + //Language::Function func; + // IRFunctionBase() { this = TFunctionIRFunction(func) } /** Gets a textual representation of this element. */ - final string toString() { result = "IR: " + func.toString() } + final string toString() { + result = "IR: " + any(Language::Function func | this = TFunctionIRFunction(func)).toString() + or + result = "IR: " + any(Language::GlobalVariable var | this = TVarInitIRFunction(var)).toString() + } /** Gets the function whose IR is represented. */ - final Language::Function getFunction() { result = func } + final Language::Function getFunction() { this = TFunctionIRFunction(result) } /** Gets the location of the function. */ - final Language::Location getLocation() { result = func.getLocation() } + final Language::Location getLocation() { + result = any(Language::Function func | this = TFunctionIRFunction(func)).getLocation() + or + result = any(Language::GlobalVariable var | this = TVarInitIRFunction(var)).getLocation() + } } diff --git a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/IRConstruction.qll b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/IRConstruction.qll index 16158a4c73a..8f523ef371e 100644 --- a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/IRConstruction.qll +++ b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/IRConstruction.qll @@ -34,6 +34,9 @@ module Raw { cached predicate functionHasIR(Function func) { exists(getTranslatedFunction(func)) } + + cached + predicate varHasIRFunc(GlobalOrNamespaceVariable var) { any() } // TODO: restrict? cached predicate hasInstruction(TranslatedElement element, InstructionTag tag) { diff --git a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedElement.qll b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedElement.qll index c9ac4d0e6d9..d936f68f58e 100644 --- a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedElement.qll +++ b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedElement.qll @@ -67,7 +67,8 @@ private predicate ignoreExprAndDescendants(Expr expr) { exists(Initializer init, StaticStorageDurationVariable var | init = var.getInitializer() and not var.hasDynamicInitialization() and - expr = init.getExpr().getFullyConverted() + expr = init.getExpr().getFullyConverted() and + not var instanceof GlobalOrNamespaceVariable ) or // Ignore descendants of `__assume` expressions, since we translated these to `NoOp`. @@ -117,7 +118,8 @@ private predicate ignoreExprOnly(Expr expr) { // should not be translated. exists(NewOrNewArrayExpr new | expr = new.getAllocatorCall().getArgument(0)) or - not translateFunction(expr.getEnclosingFunction()) + not translateFunction(expr.getEnclosingFunction()) and + not expr.getEnclosingVariable() instanceof GlobalOrNamespaceVariable or // We do not yet translate destructors properly, so for now we ignore the // destructor call. We do, however, translate the expression being @@ -669,7 +671,8 @@ newtype TTranslatedElement = opcode = getASideEffectOpcode(call, -1) } or // The side effect that initializes newly-allocated memory. - TTranslatedAllocationSideEffect(AllocationExpr expr) { not ignoreSideEffects(expr) } + TTranslatedAllocationSideEffect(AllocationExpr expr) { not ignoreSideEffects(expr) } or + TTranslatedGlobalOrNamespaceVarInit(GlobalOrNamespaceVariable var) { any() } /** * Gets the index of the first explicitly initialized element in `initList` diff --git a/cpp/ql/lib/semmle/code/cpp/ir/internal/IRCppLanguage.qll b/cpp/ql/lib/semmle/code/cpp/ir/internal/IRCppLanguage.qll index f047d6c4753..4f2761096c4 100644 --- a/cpp/ql/lib/semmle/code/cpp/ir/internal/IRCppLanguage.qll +++ b/cpp/ql/lib/semmle/code/cpp/ir/internal/IRCppLanguage.qll @@ -50,6 +50,8 @@ class AutomaticVariable = Cpp::StackVariable; class StaticVariable = Cpp::Variable; +class GlobalVariable = Cpp::GlobalOrNamespaceVariable; + class Parameter = Cpp::Parameter; class Field = Cpp::Field; From c27dfb5120d8e5ae4c64d72844e97c58cca17bea Mon Sep 17 00:00:00 2001 From: Robert Marsh Date: Mon, 21 Mar 2022 13:17:05 -0400 Subject: [PATCH 03/19] C++: IR translation for global variable inits --- .../cpp/ir/implementation/IRConfiguration.qll | 4 +- .../ir/implementation/aliased_ssa/IRBlock.qll | 2 +- .../aliased_ssa/Instruction.qll | 2 +- .../ir/implementation/aliased_ssa/PrintIR.qll | 8 +- .../internal/IRFunctionBase.qll | 22 +++-- .../cpp/ir/implementation/raw/IRBlock.qll | 2 +- .../cpp/ir/implementation/raw/Instruction.qll | 2 +- .../cpp/ir/implementation/raw/PrintIR.qll | 8 +- .../raw/internal/TranslatedElement.qll | 10 ++- .../raw/internal/TranslatedExpr.qll | 14 ++- .../raw/internal/TranslatedFunction.qll | 2 +- .../raw/internal/TranslatedGlobalVar.qll | 81 +++++++++++++++++ .../raw/internal/TranslatedInitialization.qll | 10 ++- .../implementation/unaliased_ssa/IRBlock.qll | 2 +- .../unaliased_ssa/Instruction.qll | 2 +- .../implementation/unaliased_ssa/PrintIR.qll | 8 +- .../code/cpp/ir/internal/IRCppLanguage.qll | 2 + .../ir/ir/aliased_ssa_consistency.expected | 26 ++++++ .../aliased_ssa_consistency_unsound.expected | 26 ++++++ .../ir/ir/operand_locations.expected | 4 + .../ir/ir/raw_consistency.expected | 14 +++ .../test/library-tests/ir/ir/raw_ir.expected | 87 +++++++++++++++++++ cpp/ql/test/library-tests/ir/ir/raw_ir.ql | 4 +- .../ir/ir/unaliased_ssa_consistency.expected | 14 +++ ...unaliased_ssa_consistency_unsound.expected | 14 +++ 25 files changed, 329 insertions(+), 41 deletions(-) create mode 100644 cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedGlobalVar.qll diff --git a/cpp/ql/lib/semmle/code/cpp/ir/implementation/IRConfiguration.qll b/cpp/ql/lib/semmle/code/cpp/ir/implementation/IRConfiguration.qll index 37ac2fccdd9..90cdb9e0f5f 100644 --- a/cpp/ql/lib/semmle/code/cpp/ir/implementation/IRConfiguration.qll +++ b/cpp/ql/lib/semmle/code/cpp/ir/implementation/IRConfiguration.qll @@ -16,7 +16,7 @@ class IRConfiguration extends TIRConfiguration { /** * Holds if IR should be created for function `func`. By default, holds for all functions. */ - predicate shouldCreateIRForFunction(Language::Function func) { any() } + predicate shouldCreateIRForFunction(Language::Declaration func) { any() } /** * Holds if the strings used as part of an IR dump should be generated for function `func`. @@ -25,7 +25,7 @@ class IRConfiguration extends TIRConfiguration { * of debug strings for IR that will not be dumped. We still generate the actual IR for these * functions, however, to preserve the results of any interprocedural analysis. */ - predicate shouldEvaluateDebugStringsForFunction(Language::Function func) { any() } + predicate shouldEvaluateDebugStringsForFunction(Language::Declaration func) { any() } } private newtype TIREscapeAnalysisConfiguration = MkIREscapeAnalysisConfiguration() diff --git a/cpp/ql/lib/semmle/code/cpp/ir/implementation/aliased_ssa/IRBlock.qll b/cpp/ql/lib/semmle/code/cpp/ir/implementation/aliased_ssa/IRBlock.qll index 82db3146630..1ac76d57730 100644 --- a/cpp/ql/lib/semmle/code/cpp/ir/implementation/aliased_ssa/IRBlock.qll +++ b/cpp/ql/lib/semmle/code/cpp/ir/implementation/aliased_ssa/IRBlock.qll @@ -97,7 +97,7 @@ class IRBlockBase extends TIRBlock { /** * Gets the `Function` that contains this block. */ - final Language::Function getEnclosingFunction() { + final Language::Declaration getEnclosingFunction() { result = getFirstInstruction(this).getEnclosingFunction() } } diff --git a/cpp/ql/lib/semmle/code/cpp/ir/implementation/aliased_ssa/Instruction.qll b/cpp/ql/lib/semmle/code/cpp/ir/implementation/aliased_ssa/Instruction.qll index e5a908bbf9a..8e863ddf635 100644 --- a/cpp/ql/lib/semmle/code/cpp/ir/implementation/aliased_ssa/Instruction.qll +++ b/cpp/ql/lib/semmle/code/cpp/ir/implementation/aliased_ssa/Instruction.qll @@ -194,7 +194,7 @@ class Instruction extends Construction::TStageInstruction { /** * Gets the function that contains this instruction. */ - final Language::Function getEnclosingFunction() { + final Language::Declaration getEnclosingFunction() { result = this.getEnclosingIRFunction().getFunction() } diff --git a/cpp/ql/lib/semmle/code/cpp/ir/implementation/aliased_ssa/PrintIR.qll b/cpp/ql/lib/semmle/code/cpp/ir/implementation/aliased_ssa/PrintIR.qll index 59dadee7154..53cdc75512b 100644 --- a/cpp/ql/lib/semmle/code/cpp/ir/implementation/aliased_ssa/PrintIR.qll +++ b/cpp/ql/lib/semmle/code/cpp/ir/implementation/aliased_ssa/PrintIR.qll @@ -26,20 +26,20 @@ class PrintIRConfiguration extends TPrintIRConfiguration { * Holds if the IR for `func` should be printed. By default, holds for all * functions. */ - predicate shouldPrintFunction(Language::Function func) { any() } + predicate shouldPrintFunction(Language::Declaration decl) { any() } } /** * Override of `IRConfiguration` to only evaluate debug strings for the functions that are to be dumped. */ private class FilteredIRConfiguration extends IRConfiguration { - override predicate shouldEvaluateDebugStringsForFunction(Language::Function func) { + override predicate shouldEvaluateDebugStringsForFunction(Language::Declaration func) { shouldPrintFunction(func) } } -private predicate shouldPrintFunction(Language::Function func) { - exists(PrintIRConfiguration config | config.shouldPrintFunction(func)) +private predicate shouldPrintFunction(Language::Declaration decl) { + exists(PrintIRConfiguration config | config.shouldPrintFunction(decl)) } private string getAdditionalInstructionProperty(Instruction instr, string key) { diff --git a/cpp/ql/lib/semmle/code/cpp/ir/implementation/internal/IRFunctionBase.qll b/cpp/ql/lib/semmle/code/cpp/ir/implementation/internal/IRFunctionBase.qll index 557a9a7b5e2..576b4f9adf1 100644 --- a/cpp/ql/lib/semmle/code/cpp/ir/implementation/internal/IRFunctionBase.qll +++ b/cpp/ql/lib/semmle/code/cpp/ir/implementation/internal/IRFunctionBase.qll @@ -13,22 +13,20 @@ private newtype TIRFunction = * phases of the IR. Each instantiation of `IRFunction` extends this class. */ class IRFunctionBase extends TIRFunction { - //Language::Function func; - // IRFunctionBase() { this = TFunctionIRFunction(func) } - /** Gets a textual representation of this element. */ - final string toString() { - result = "IR: " + any(Language::Function func | this = TFunctionIRFunction(func)).toString() + Language::Declaration decl; + + IRFunctionBase() { + this = TFunctionIRFunction(decl) or - result = "IR: " + any(Language::GlobalVariable var | this = TVarInitIRFunction(var)).toString() + this = TVarInitIRFunction(decl) } + /** Gets a textual representation of this element. */ + final string toString() { result = "IR: " + decl.toString() } + /** Gets the function whose IR is represented. */ - final Language::Function getFunction() { this = TFunctionIRFunction(result) } + final Language::Declaration getFunction() { result = decl } /** Gets the location of the function. */ - final Language::Location getLocation() { - result = any(Language::Function func | this = TFunctionIRFunction(func)).getLocation() - or - result = any(Language::GlobalVariable var | this = TVarInitIRFunction(var)).getLocation() - } + final Language::Location getLocation() { result = decl.getLocation() } } diff --git a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/IRBlock.qll b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/IRBlock.qll index 82db3146630..1ac76d57730 100644 --- a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/IRBlock.qll +++ b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/IRBlock.qll @@ -97,7 +97,7 @@ class IRBlockBase extends TIRBlock { /** * Gets the `Function` that contains this block. */ - final Language::Function getEnclosingFunction() { + final Language::Declaration getEnclosingFunction() { result = getFirstInstruction(this).getEnclosingFunction() } } diff --git a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/Instruction.qll b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/Instruction.qll index e5a908bbf9a..8e863ddf635 100644 --- a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/Instruction.qll +++ b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/Instruction.qll @@ -194,7 +194,7 @@ class Instruction extends Construction::TStageInstruction { /** * Gets the function that contains this instruction. */ - final Language::Function getEnclosingFunction() { + final Language::Declaration getEnclosingFunction() { result = this.getEnclosingIRFunction().getFunction() } diff --git a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/PrintIR.qll b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/PrintIR.qll index 59dadee7154..53cdc75512b 100644 --- a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/PrintIR.qll +++ b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/PrintIR.qll @@ -26,20 +26,20 @@ class PrintIRConfiguration extends TPrintIRConfiguration { * Holds if the IR for `func` should be printed. By default, holds for all * functions. */ - predicate shouldPrintFunction(Language::Function func) { any() } + predicate shouldPrintFunction(Language::Declaration decl) { any() } } /** * Override of `IRConfiguration` to only evaluate debug strings for the functions that are to be dumped. */ private class FilteredIRConfiguration extends IRConfiguration { - override predicate shouldEvaluateDebugStringsForFunction(Language::Function func) { + override predicate shouldEvaluateDebugStringsForFunction(Language::Declaration func) { shouldPrintFunction(func) } } -private predicate shouldPrintFunction(Language::Function func) { - exists(PrintIRConfiguration config | config.shouldPrintFunction(func)) +private predicate shouldPrintFunction(Language::Declaration decl) { + exists(PrintIRConfiguration config | config.shouldPrintFunction(decl)) } private string getAdditionalInstructionProperty(Instruction instr, string key) { diff --git a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedElement.qll b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedElement.qll index d936f68f58e..594319c3db5 100644 --- a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedElement.qll +++ b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedElement.qll @@ -802,7 +802,7 @@ abstract class TranslatedElement extends TTranslatedElement { /** * Gets the `Function` that contains this element. */ - abstract Function getFunction(); + abstract Declaration getFunction(); /** * Gets the successor instruction of the instruction that was generated by @@ -952,3 +952,11 @@ abstract class TranslatedElement extends TTranslatedElement { */ final TranslatedElement getParent() { result.getAChild() = this } } + +abstract class TranslatedInstructionContainer extends TranslatedElement { + TranslatedInstructionContainer() { + this instanceof TTranslatedFunction + or + this instanceof TTranslatedGlobalOrNamespaceVarInit + } +} \ No newline at end of file diff --git a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedExpr.qll b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedExpr.qll index 4449b03a84a..8dcfa174d43 100644 --- a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedExpr.qll +++ b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedExpr.qll @@ -13,6 +13,7 @@ private import TranslatedFunction private import TranslatedInitialization private import TranslatedFunction private import TranslatedStmt +private import TranslatedGlobalVar import TranslatedCall /** @@ -79,7 +80,10 @@ abstract class TranslatedExpr extends TranslatedElement { /** DEPRECATED: Alias for getAst */ deprecated override Locatable getAST() { result = this.getAst() } - final override Function getFunction() { result = expr.getEnclosingFunction() } + final override Declaration getFunction() { + result = expr.getEnclosingFunction() or + result = expr.getEnclosingVariable().(GlobalOrNamespaceVariable) + } /** * Gets the expression from which this `TranslatedExpr` is generated. @@ -89,8 +93,10 @@ abstract class TranslatedExpr extends TranslatedElement { /** * Gets the `TranslatedFunction` containing this expression. */ - final TranslatedFunction getEnclosingFunction() { + final TranslatedInstructionContainer getEnclosingFunction() { result = getTranslatedFunction(expr.getEnclosingFunction()) + or + result = getTranslatedVarInit(expr.getEnclosingVariable()) } } @@ -788,7 +794,7 @@ class TranslatedThisExpr extends TranslatedNonConstantExpr { override IRVariable getInstructionVariable(InstructionTag tag) { tag = ThisAddressTag() and - result = this.getEnclosingFunction().getThisVariable() + result = this.getEnclosingFunction().(TranslatedFunction).getThisVariable() } } @@ -2523,7 +2529,7 @@ class TranslatedVarArgsStart extends TranslatedNonConstantExpr { final override IRVariable getInstructionVariable(InstructionTag tag) { tag = VarArgsStartEllipsisAddressTag() and - result = this.getEnclosingFunction().getEllipsisVariable() + result = this.getEnclosingFunction().(TranslatedFunction).getEllipsisVariable() } final override Instruction getInstructionRegisterOperand(InstructionTag tag, OperandTag operandTag) { diff --git a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedFunction.qll b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedFunction.qll index 0f781cb2244..1e2aca25336 100644 --- a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedFunction.qll +++ b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedFunction.qll @@ -58,7 +58,7 @@ predicate hasReturnValue(Function func) { not func.getUnspecifiedType() instance * Represents the IR translation of a function. This is the root elements for * all other elements associated with this function. */ -class TranslatedFunction extends TranslatedElement, TTranslatedFunction { +class TranslatedFunction extends TranslatedInstructionContainer, TTranslatedFunction { Function func; TranslatedFunction() { this = TTranslatedFunction(func) } diff --git a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedGlobalVar.qll b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedGlobalVar.qll new file mode 100644 index 00000000000..f26d7e39d21 --- /dev/null +++ b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedGlobalVar.qll @@ -0,0 +1,81 @@ +import semmle.code.cpp.ir.implementation.raw.internal.TranslatedElement +private import cpp +private import semmle.code.cpp.ir.implementation.IRType +private import semmle.code.cpp.ir.implementation.Opcode +private import semmle.code.cpp.ir.implementation.internal.OperandTag +private import semmle.code.cpp.ir.internal.CppType +private import TranslatedInitialization +private import InstructionTag + +class TranslatedGlobalOrNamespaceVarInit extends TranslatedInstructionContainer, + TTranslatedGlobalOrNamespaceVarInit, InitializationContext { + GlobalOrNamespaceVariable var; + + TranslatedGlobalOrNamespaceVarInit() { this = TTranslatedGlobalOrNamespaceVarInit(var) } + + override string toString() { result = var.toString() } + + final override GlobalOrNamespaceVariable getAst() { result = var } + + final override Declaration getFunction() { result = var } + + final Location getLocation() { result = var.getLocation() } + + override Instruction getFirstInstruction() { result = this.getInstruction(EnterFunctionTag()) } + + override TranslatedElement getChild(int n) { + n = 1 and result = getTranslatedInitialization(var.getInitializer().getExpr()) + } + + override predicate hasInstruction(Opcode op, InstructionTag tag, CppType type) { + op instanceof Opcode::EnterFunction and + tag = EnterFunctionTag() and + type = getVoidType() + or + op instanceof Opcode::VariableAddress and + tag = InitializerVariableAddressTag() and + type = getTypeForGLValue(var.getType()) + or + op instanceof Opcode::ReturnVoid and + tag = ReturnTag() and + type = getVoidType() + or + op instanceof Opcode::ExitFunction and + tag = ExitFunctionTag() and + type = getVoidType() + } + + override Instruction getInstructionSuccessor(InstructionTag tag, EdgeKind kind) { + tag = EnterFunctionTag() and + kind instanceof GotoEdge and + result = getInstruction(InitializerVariableAddressTag()) + or + tag = InitializerVariableAddressTag() and + kind instanceof GotoEdge and + result = getChild(1).getFirstInstruction() + or + tag = ReturnTag() and + kind instanceof GotoEdge and + result = getInstruction(ExitFunctionTag()) + } + + override Instruction getChildSuccessor(TranslatedElement child) { + child = getChild(1) and + result = getInstruction(ReturnTag()) + } + + override IRUserVariable getInstructionVariable(InstructionTag tag) { + tag = InitializerVariableAddressTag() and + result.getVariable() = var + } + + override Instruction getTargetAddress() { + result = getInstruction(InitializerVariableAddressTag()) + } + + override Type getTargetType() { result = var.getType() } +} + +TranslatedGlobalOrNamespaceVarInit getTranslatedVarInit(GlobalOrNamespaceVariable var) { + result.getAst() = var +} diff --git a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedInitialization.qll b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedInitialization.qll index 1a9d7ad9d70..209532d3625 100644 --- a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedInitialization.qll +++ b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedInitialization.qll @@ -137,7 +137,10 @@ abstract class TranslatedInitialization extends TranslatedElement, TTranslatedIn final override string toString() { result = "init: " + expr.toString() } - final override Function getFunction() { result = expr.getEnclosingFunction() } + final override Declaration getFunction() { + result = expr.getEnclosingFunction() or + result = expr.getEnclosingVariable().(GlobalOrNamespaceVariable) + } final override Locatable getAst() { result = expr } @@ -486,7 +489,10 @@ abstract class TranslatedFieldInitialization extends TranslatedElement { /** DEPRECATED: Alias for getAst */ deprecated override Locatable getAST() { result = getAst() } - final override Function getFunction() { result = ast.getEnclosingFunction() } + final override Declaration getFunction() { + result = ast.getEnclosingFunction() or + result = ast.getEnclosingVariable().(GlobalOrNamespaceVariable) + } final override Instruction getFirstInstruction() { result = getInstruction(getFieldAddressTag()) } diff --git a/cpp/ql/lib/semmle/code/cpp/ir/implementation/unaliased_ssa/IRBlock.qll b/cpp/ql/lib/semmle/code/cpp/ir/implementation/unaliased_ssa/IRBlock.qll index 82db3146630..1ac76d57730 100644 --- a/cpp/ql/lib/semmle/code/cpp/ir/implementation/unaliased_ssa/IRBlock.qll +++ b/cpp/ql/lib/semmle/code/cpp/ir/implementation/unaliased_ssa/IRBlock.qll @@ -97,7 +97,7 @@ class IRBlockBase extends TIRBlock { /** * Gets the `Function` that contains this block. */ - final Language::Function getEnclosingFunction() { + final Language::Declaration getEnclosingFunction() { result = getFirstInstruction(this).getEnclosingFunction() } } diff --git a/cpp/ql/lib/semmle/code/cpp/ir/implementation/unaliased_ssa/Instruction.qll b/cpp/ql/lib/semmle/code/cpp/ir/implementation/unaliased_ssa/Instruction.qll index e5a908bbf9a..8e863ddf635 100644 --- a/cpp/ql/lib/semmle/code/cpp/ir/implementation/unaliased_ssa/Instruction.qll +++ b/cpp/ql/lib/semmle/code/cpp/ir/implementation/unaliased_ssa/Instruction.qll @@ -194,7 +194,7 @@ class Instruction extends Construction::TStageInstruction { /** * Gets the function that contains this instruction. */ - final Language::Function getEnclosingFunction() { + final Language::Declaration getEnclosingFunction() { result = this.getEnclosingIRFunction().getFunction() } diff --git a/cpp/ql/lib/semmle/code/cpp/ir/implementation/unaliased_ssa/PrintIR.qll b/cpp/ql/lib/semmle/code/cpp/ir/implementation/unaliased_ssa/PrintIR.qll index 59dadee7154..53cdc75512b 100644 --- a/cpp/ql/lib/semmle/code/cpp/ir/implementation/unaliased_ssa/PrintIR.qll +++ b/cpp/ql/lib/semmle/code/cpp/ir/implementation/unaliased_ssa/PrintIR.qll @@ -26,20 +26,20 @@ class PrintIRConfiguration extends TPrintIRConfiguration { * Holds if the IR for `func` should be printed. By default, holds for all * functions. */ - predicate shouldPrintFunction(Language::Function func) { any() } + predicate shouldPrintFunction(Language::Declaration decl) { any() } } /** * Override of `IRConfiguration` to only evaluate debug strings for the functions that are to be dumped. */ private class FilteredIRConfiguration extends IRConfiguration { - override predicate shouldEvaluateDebugStringsForFunction(Language::Function func) { + override predicate shouldEvaluateDebugStringsForFunction(Language::Declaration func) { shouldPrintFunction(func) } } -private predicate shouldPrintFunction(Language::Function func) { - exists(PrintIRConfiguration config | config.shouldPrintFunction(func)) +private predicate shouldPrintFunction(Language::Declaration decl) { + exists(PrintIRConfiguration config | config.shouldPrintFunction(decl)) } private string getAdditionalInstructionProperty(Instruction instr, string key) { diff --git a/cpp/ql/lib/semmle/code/cpp/ir/internal/IRCppLanguage.qll b/cpp/ql/lib/semmle/code/cpp/ir/internal/IRCppLanguage.qll index 4f2761096c4..46e3e6dec1c 100644 --- a/cpp/ql/lib/semmle/code/cpp/ir/internal/IRCppLanguage.qll +++ b/cpp/ql/lib/semmle/code/cpp/ir/internal/IRCppLanguage.qll @@ -58,6 +58,8 @@ class Field = Cpp::Field; class BuiltInOperation = Cpp::BuiltInOperation; +class Declaration = Cpp::Declaration; + // TODO: Remove necessity for these. class Expr = Cpp::Expr; diff --git a/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency.expected b/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency.expected index 31e5b01229c..4054550d46d 100644 --- a/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency.expected +++ b/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency.expected @@ -3,14 +3,28 @@ unexpectedOperand duplicateOperand missingPhiOperand missingOperandType +| ir.cpp:1038:12:1038:18 | ChiTotal | Operand 'ChiTotal' of instruction 'Chi' is missing a type in function '$@'. | ir.cpp:1038:6:1038:8 | (lambda [] type at line 1038, col. 12) lam | (lambda [] type at line 1038, col. 12) lam | +| ir.cpp:1674:16:1674:16 | ChiTotal | Operand 'ChiTotal' of instruction 'Chi' is missing a type in function '$@'. | ir.cpp:1674:5:1674:12 | int global_2 | int global_2 | +| ir.cpp:1676:22:1676:22 | ChiTotal | Operand 'ChiTotal' of instruction 'Chi' is missing a type in function '$@'. | ir.cpp:1676:11:1676:18 | int const global_3 | int const global_3 | +| struct_init.cpp:10:7:10:9 | ChiTotal | Operand 'ChiTotal' of instruction 'Chi' is missing a type in function '$@'. | struct_init.cpp:9:13:9:25 | Info infos_in_file[] | Info infos_in_file[] | duplicateChiOperand sideEffectWithoutPrimary instructionWithoutSuccessor +| clang.cpp:3:5:3:13 | VariableAddress: globalInt | Instruction 'VariableAddress: globalInt' has no successors in function '$@'. | clang.cpp:3:5:3:13 | int globalInt | int globalInt | +| ir.cpp:346:5:346:5 | VariableAddress: g | Instruction 'VariableAddress: g' has no successors in function '$@'. | ir.cpp:346:5:346:5 | int g | int g | +| ir.cpp:1672:5:1672:12 | VariableAddress: global_1 | Instruction 'VariableAddress: global_1' has no successors in function '$@'. | ir.cpp:1672:5:1672:12 | int global_1 | int global_1 | +| struct_init.cpp:14:7:14:20 | VariableAddress: global_pointer | Instruction 'VariableAddress: global_pointer' has no successors in function '$@'. | struct_init.cpp:14:7:14:20 | Info* global_pointer | Info* global_pointer | ambiguousSuccessors unexplainedLoop unnecessaryPhiInstruction memoryOperandDefinitionIsUnmodeled operandAcrossFunctions +| struct_init.cpp:9:13:9:25 | Left | Operand 'Left' is used on instruction 'PointerAdd: {...}' in function '$@', but is defined on instruction 'VariableAddress: infos_in_file' in function '$@'. | file://:0:0:0:0 | | | struct_init.cpp:9:13:9:25 | Info infos_in_file[] | Info infos_in_file[] | +| struct_init.cpp:9:13:9:25 | Left | Operand 'Left' is used on instruction 'PointerAdd: {...}' in function '$@', but is defined on instruction 'VariableAddress: infos_in_file' in function '$@'. | file://:0:0:0:0 | | | struct_init.cpp:9:13:9:25 | Info infos_in_file[] | Info infos_in_file[] | +| struct_init.cpp:9:31:12:1 | Unary | Operand 'Unary' is used on instruction 'FieldAddress: {...}' in function '$@', but is defined on instruction 'PointerAdd: {...}' in function '$@'. | struct_init.cpp:9:13:9:25 | Info infos_in_file[] | Info infos_in_file[] | file://:0:0:0:0 | | | +| struct_init.cpp:9:31:12:1 | Unary | Operand 'Unary' is used on instruction 'FieldAddress: {...}' in function '$@', but is defined on instruction 'PointerAdd: {...}' in function '$@'. | struct_init.cpp:9:13:9:25 | Info infos_in_file[] | Info infos_in_file[] | file://:0:0:0:0 | | | +| struct_init.cpp:9:31:12:1 | Unary | Operand 'Unary' is used on instruction 'FieldAddress: {...}' in function '$@', but is defined on instruction 'PointerAdd: {...}' in function '$@'. | struct_init.cpp:9:13:9:25 | Info infos_in_file[] | Info infos_in_file[] | file://:0:0:0:0 | | | +| struct_init.cpp:9:31:12:1 | Unary | Operand 'Unary' is used on instruction 'FieldAddress: {...}' in function '$@', but is defined on instruction 'PointerAdd: {...}' in function '$@'. | struct_init.cpp:9:13:9:25 | Info infos_in_file[] | Info infos_in_file[] | file://:0:0:0:0 | | | instructionWithoutUniqueBlock containsLoopOfForwardEdges lostReachability @@ -19,8 +33,20 @@ useNotDominatedByDefinition switchInstructionWithoutDefaultEdge notMarkedAsConflated wronglyMarkedAsConflated +| ir.cpp:1038:12:1038:18 | Chi: [...](...){...} | Instruction 'Chi: [...](...){...}' should not be marked as having a conflated result in function '$@'. | ir.cpp:1038:6:1038:8 | (lambda [] type at line 1038, col. 12) lam | (lambda [] type at line 1038, col. 12) lam | +| ir.cpp:1038:12:1038:18 | Chi: [...](...){...} | Instruction 'Chi: [...](...){...}' should not be marked as having a conflated result in function '$@'. | ir.cpp:1038:6:1038:8 | (lambda [] type at line 1038, col. 12) lam | (lambda [] type at line 1038, col. 12) lam | +| ir.cpp:1674:16:1674:16 | Chi: 1 | Instruction 'Chi: 1' should not be marked as having a conflated result in function '$@'. | ir.cpp:1674:5:1674:12 | int global_2 | int global_2 | +| ir.cpp:1676:22:1676:22 | Chi: 2 | Instruction 'Chi: 2' should not be marked as having a conflated result in function '$@'. | ir.cpp:1676:11:1676:18 | int const global_3 | int const global_3 | +| struct_init.cpp:10:7:10:9 | Chi: array to pointer conversion | Instruction 'Chi: array to pointer conversion' should not be marked as having a conflated result in function '$@'. | struct_init.cpp:9:13:9:25 | Info infos_in_file[] | Info infos_in_file[] | +| struct_init.cpp:10:12:10:19 | Chi: handler1 | Instruction 'Chi: handler1' should not be marked as having a conflated result in function '$@'. | struct_init.cpp:9:13:9:25 | Info infos_in_file[] | Info infos_in_file[] | +| struct_init.cpp:11:7:11:9 | Chi: array to pointer conversion | Instruction 'Chi: array to pointer conversion' should not be marked as having a conflated result in function '$@'. | struct_init.cpp:9:13:9:25 | Info infos_in_file[] | Info infos_in_file[] | +| struct_init.cpp:11:12:11:20 | Chi: & ... | Instruction 'Chi: & ...' should not be marked as having a conflated result in function '$@'. | struct_init.cpp:9:13:9:25 | Info infos_in_file[] | Info infos_in_file[] | invalidOverlap nonUniqueEnclosingIRFunction +| struct_init.cpp:9:31:12:1 | Constant: {...} | Instruction 'Constant: {...}' has 0 results for `getEnclosingIRFunction()` in function '$@'. | file://:0:0:0:0 | | | +| struct_init.cpp:9:31:12:1 | Constant: {...} | Instruction 'Constant: {...}' has 0 results for `getEnclosingIRFunction()` in function '$@'. | file://:0:0:0:0 | | | +| struct_init.cpp:9:31:12:1 | PointerAdd: {...} | Instruction 'PointerAdd: {...}' has 0 results for `getEnclosingIRFunction()` in function '$@'. | file://:0:0:0:0 | | | +| struct_init.cpp:9:31:12:1 | PointerAdd: {...} | Instruction 'PointerAdd: {...}' has 0 results for `getEnclosingIRFunction()` in function '$@'. | file://:0:0:0:0 | | | fieldAddressOnNonPointer thisArgumentIsNonPointer missingCanonicalLanguageType diff --git a/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency_unsound.expected b/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency_unsound.expected index 31e5b01229c..4054550d46d 100644 --- a/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency_unsound.expected +++ b/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency_unsound.expected @@ -3,14 +3,28 @@ unexpectedOperand duplicateOperand missingPhiOperand missingOperandType +| ir.cpp:1038:12:1038:18 | ChiTotal | Operand 'ChiTotal' of instruction 'Chi' is missing a type in function '$@'. | ir.cpp:1038:6:1038:8 | (lambda [] type at line 1038, col. 12) lam | (lambda [] type at line 1038, col. 12) lam | +| ir.cpp:1674:16:1674:16 | ChiTotal | Operand 'ChiTotal' of instruction 'Chi' is missing a type in function '$@'. | ir.cpp:1674:5:1674:12 | int global_2 | int global_2 | +| ir.cpp:1676:22:1676:22 | ChiTotal | Operand 'ChiTotal' of instruction 'Chi' is missing a type in function '$@'. | ir.cpp:1676:11:1676:18 | int const global_3 | int const global_3 | +| struct_init.cpp:10:7:10:9 | ChiTotal | Operand 'ChiTotal' of instruction 'Chi' is missing a type in function '$@'. | struct_init.cpp:9:13:9:25 | Info infos_in_file[] | Info infos_in_file[] | duplicateChiOperand sideEffectWithoutPrimary instructionWithoutSuccessor +| clang.cpp:3:5:3:13 | VariableAddress: globalInt | Instruction 'VariableAddress: globalInt' has no successors in function '$@'. | clang.cpp:3:5:3:13 | int globalInt | int globalInt | +| ir.cpp:346:5:346:5 | VariableAddress: g | Instruction 'VariableAddress: g' has no successors in function '$@'. | ir.cpp:346:5:346:5 | int g | int g | +| ir.cpp:1672:5:1672:12 | VariableAddress: global_1 | Instruction 'VariableAddress: global_1' has no successors in function '$@'. | ir.cpp:1672:5:1672:12 | int global_1 | int global_1 | +| struct_init.cpp:14:7:14:20 | VariableAddress: global_pointer | Instruction 'VariableAddress: global_pointer' has no successors in function '$@'. | struct_init.cpp:14:7:14:20 | Info* global_pointer | Info* global_pointer | ambiguousSuccessors unexplainedLoop unnecessaryPhiInstruction memoryOperandDefinitionIsUnmodeled operandAcrossFunctions +| struct_init.cpp:9:13:9:25 | Left | Operand 'Left' is used on instruction 'PointerAdd: {...}' in function '$@', but is defined on instruction 'VariableAddress: infos_in_file' in function '$@'. | file://:0:0:0:0 | | | struct_init.cpp:9:13:9:25 | Info infos_in_file[] | Info infos_in_file[] | +| struct_init.cpp:9:13:9:25 | Left | Operand 'Left' is used on instruction 'PointerAdd: {...}' in function '$@', but is defined on instruction 'VariableAddress: infos_in_file' in function '$@'. | file://:0:0:0:0 | | | struct_init.cpp:9:13:9:25 | Info infos_in_file[] | Info infos_in_file[] | +| struct_init.cpp:9:31:12:1 | Unary | Operand 'Unary' is used on instruction 'FieldAddress: {...}' in function '$@', but is defined on instruction 'PointerAdd: {...}' in function '$@'. | struct_init.cpp:9:13:9:25 | Info infos_in_file[] | Info infos_in_file[] | file://:0:0:0:0 | | | +| struct_init.cpp:9:31:12:1 | Unary | Operand 'Unary' is used on instruction 'FieldAddress: {...}' in function '$@', but is defined on instruction 'PointerAdd: {...}' in function '$@'. | struct_init.cpp:9:13:9:25 | Info infos_in_file[] | Info infos_in_file[] | file://:0:0:0:0 | | | +| struct_init.cpp:9:31:12:1 | Unary | Operand 'Unary' is used on instruction 'FieldAddress: {...}' in function '$@', but is defined on instruction 'PointerAdd: {...}' in function '$@'. | struct_init.cpp:9:13:9:25 | Info infos_in_file[] | Info infos_in_file[] | file://:0:0:0:0 | | | +| struct_init.cpp:9:31:12:1 | Unary | Operand 'Unary' is used on instruction 'FieldAddress: {...}' in function '$@', but is defined on instruction 'PointerAdd: {...}' in function '$@'. | struct_init.cpp:9:13:9:25 | Info infos_in_file[] | Info infos_in_file[] | file://:0:0:0:0 | | | instructionWithoutUniqueBlock containsLoopOfForwardEdges lostReachability @@ -19,8 +33,20 @@ useNotDominatedByDefinition switchInstructionWithoutDefaultEdge notMarkedAsConflated wronglyMarkedAsConflated +| ir.cpp:1038:12:1038:18 | Chi: [...](...){...} | Instruction 'Chi: [...](...){...}' should not be marked as having a conflated result in function '$@'. | ir.cpp:1038:6:1038:8 | (lambda [] type at line 1038, col. 12) lam | (lambda [] type at line 1038, col. 12) lam | +| ir.cpp:1038:12:1038:18 | Chi: [...](...){...} | Instruction 'Chi: [...](...){...}' should not be marked as having a conflated result in function '$@'. | ir.cpp:1038:6:1038:8 | (lambda [] type at line 1038, col. 12) lam | (lambda [] type at line 1038, col. 12) lam | +| ir.cpp:1674:16:1674:16 | Chi: 1 | Instruction 'Chi: 1' should not be marked as having a conflated result in function '$@'. | ir.cpp:1674:5:1674:12 | int global_2 | int global_2 | +| ir.cpp:1676:22:1676:22 | Chi: 2 | Instruction 'Chi: 2' should not be marked as having a conflated result in function '$@'. | ir.cpp:1676:11:1676:18 | int const global_3 | int const global_3 | +| struct_init.cpp:10:7:10:9 | Chi: array to pointer conversion | Instruction 'Chi: array to pointer conversion' should not be marked as having a conflated result in function '$@'. | struct_init.cpp:9:13:9:25 | Info infos_in_file[] | Info infos_in_file[] | +| struct_init.cpp:10:12:10:19 | Chi: handler1 | Instruction 'Chi: handler1' should not be marked as having a conflated result in function '$@'. | struct_init.cpp:9:13:9:25 | Info infos_in_file[] | Info infos_in_file[] | +| struct_init.cpp:11:7:11:9 | Chi: array to pointer conversion | Instruction 'Chi: array to pointer conversion' should not be marked as having a conflated result in function '$@'. | struct_init.cpp:9:13:9:25 | Info infos_in_file[] | Info infos_in_file[] | +| struct_init.cpp:11:12:11:20 | Chi: & ... | Instruction 'Chi: & ...' should not be marked as having a conflated result in function '$@'. | struct_init.cpp:9:13:9:25 | Info infos_in_file[] | Info infos_in_file[] | invalidOverlap nonUniqueEnclosingIRFunction +| struct_init.cpp:9:31:12:1 | Constant: {...} | Instruction 'Constant: {...}' has 0 results for `getEnclosingIRFunction()` in function '$@'. | file://:0:0:0:0 | | | +| struct_init.cpp:9:31:12:1 | Constant: {...} | Instruction 'Constant: {...}' has 0 results for `getEnclosingIRFunction()` in function '$@'. | file://:0:0:0:0 | | | +| struct_init.cpp:9:31:12:1 | PointerAdd: {...} | Instruction 'PointerAdd: {...}' has 0 results for `getEnclosingIRFunction()` in function '$@'. | file://:0:0:0:0 | | | +| struct_init.cpp:9:31:12:1 | PointerAdd: {...} | Instruction 'PointerAdd: {...}' has 0 results for `getEnclosingIRFunction()` in function '$@'. | file://:0:0:0:0 | | | fieldAddressOnNonPointer thisArgumentIsNonPointer missingCanonicalLanguageType diff --git a/cpp/ql/test/library-tests/ir/ir/operand_locations.expected b/cpp/ql/test/library-tests/ir/ir/operand_locations.expected index b57e3861629..df1e6a6daab 100644 --- a/cpp/ql/test/library-tests/ir/ir/operand_locations.expected +++ b/cpp/ql/test/library-tests/ir/ir/operand_locations.expected @@ -4658,6 +4658,7 @@ | ir.cpp:1034:6:1034:20 | ChiTotal | total:m1034_2 | | ir.cpp:1034:6:1034:20 | SideEffect | m1034_3 | | ir.cpp:1035:15:1035:15 | Address | &:r1035_1 | +| ir.cpp:1038:12:1038:18 | ChiTotal | total:~m? | | ir.cpp:1038:14:1038:14 | Address | &:r1038_5 | | ir.cpp:1038:14:1038:14 | Address | &:r1038_5 | | ir.cpp:1038:14:1038:14 | Address | &:r1038_5 | @@ -7436,6 +7437,8 @@ | ir.cpp:1668:17:1668:17 | Load | m1661_14 | | ir.cpp:1668:17:1668:17 | Load | ~m1666_6 | | ir.cpp:1668:17:1668:17 | StoreValue | r1668_4 | +| ir.cpp:1674:16:1674:16 | ChiTotal | total:~m? | +| ir.cpp:1676:22:1676:22 | ChiTotal | total:~m? | | perf-regression.cpp:6:3:6:5 | Address | &:r6_5 | | perf-regression.cpp:6:3:6:5 | Address | &:r6_5 | | perf-regression.cpp:6:3:6:5 | Address | &:r6_7 | @@ -7679,6 +7682,7 @@ | smart_ptr.cpp:47:43:47:63 | SideEffect | ~m47_16 | | smart_ptr.cpp:47:43:47:63 | Unary | r47_5 | | smart_ptr.cpp:47:43:47:63 | Unary | r47_6 | +| struct_init.cpp:10:7:10:9 | ChiTotal | total:~m? | | struct_init.cpp:16:6:16:20 | ChiPartial | partial:m16_3 | | struct_init.cpp:16:6:16:20 | ChiTotal | total:m16_2 | | struct_init.cpp:16:6:16:20 | SideEffect | ~m17_5 | diff --git a/cpp/ql/test/library-tests/ir/ir/raw_consistency.expected b/cpp/ql/test/library-tests/ir/ir/raw_consistency.expected index 826c3beedf1..b0a01e27615 100644 --- a/cpp/ql/test/library-tests/ir/ir/raw_consistency.expected +++ b/cpp/ql/test/library-tests/ir/ir/raw_consistency.expected @@ -7,11 +7,21 @@ duplicateChiOperand sideEffectWithoutPrimary instructionWithoutSuccessor | ../../../include/memory.h:68:25:68:33 | CopyValue: (reference to) | Instruction 'CopyValue: (reference to)' has no successors in function '$@'. | ../../../include/memory.h:67:5:67:5 | void std::unique_ptr>::~unique_ptr() | void std::unique_ptr>::~unique_ptr() | +| clang.cpp:3:5:3:13 | VariableAddress: globalInt | Instruction 'VariableAddress: globalInt' has no successors in function '$@'. | clang.cpp:3:5:3:13 | int globalInt | int globalInt | +| ir.cpp:346:5:346:5 | VariableAddress: g | Instruction 'VariableAddress: g' has no successors in function '$@'. | ir.cpp:346:5:346:5 | int g | int g | +| ir.cpp:1672:5:1672:12 | VariableAddress: global_1 | Instruction 'VariableAddress: global_1' has no successors in function '$@'. | ir.cpp:1672:5:1672:12 | int global_1 | int global_1 | +| struct_init.cpp:14:7:14:20 | VariableAddress: global_pointer | Instruction 'VariableAddress: global_pointer' has no successors in function '$@'. | struct_init.cpp:14:7:14:20 | Info* global_pointer | Info* global_pointer | ambiguousSuccessors unexplainedLoop unnecessaryPhiInstruction memoryOperandDefinitionIsUnmodeled operandAcrossFunctions +| struct_init.cpp:9:13:9:25 | Left | Operand 'Left' is used on instruction 'PointerAdd: {...}' in function '$@', but is defined on instruction 'VariableAddress: infos_in_file' in function '$@'. | file://:0:0:0:0 | | | struct_init.cpp:9:13:9:25 | Info infos_in_file[] | Info infos_in_file[] | +| struct_init.cpp:9:13:9:25 | Left | Operand 'Left' is used on instruction 'PointerAdd: {...}' in function '$@', but is defined on instruction 'VariableAddress: infos_in_file' in function '$@'. | file://:0:0:0:0 | | | struct_init.cpp:9:13:9:25 | Info infos_in_file[] | Info infos_in_file[] | +| struct_init.cpp:9:31:12:1 | Unary | Operand 'Unary' is used on instruction 'FieldAddress: {...}' in function '$@', but is defined on instruction 'PointerAdd: {...}' in function '$@'. | struct_init.cpp:9:13:9:25 | Info infos_in_file[] | Info infos_in_file[] | file://:0:0:0:0 | | | +| struct_init.cpp:9:31:12:1 | Unary | Operand 'Unary' is used on instruction 'FieldAddress: {...}' in function '$@', but is defined on instruction 'PointerAdd: {...}' in function '$@'. | struct_init.cpp:9:13:9:25 | Info infos_in_file[] | Info infos_in_file[] | file://:0:0:0:0 | | | +| struct_init.cpp:9:31:12:1 | Unary | Operand 'Unary' is used on instruction 'FieldAddress: {...}' in function '$@', but is defined on instruction 'PointerAdd: {...}' in function '$@'. | struct_init.cpp:9:13:9:25 | Info infos_in_file[] | Info infos_in_file[] | file://:0:0:0:0 | | | +| struct_init.cpp:9:31:12:1 | Unary | Operand 'Unary' is used on instruction 'FieldAddress: {...}' in function '$@', but is defined on instruction 'PointerAdd: {...}' in function '$@'. | struct_init.cpp:9:13:9:25 | Info infos_in_file[] | Info infos_in_file[] | file://:0:0:0:0 | | | instructionWithoutUniqueBlock containsLoopOfForwardEdges lostReachability @@ -23,6 +33,10 @@ notMarkedAsConflated wronglyMarkedAsConflated invalidOverlap nonUniqueEnclosingIRFunction +| struct_init.cpp:9:31:12:1 | Constant: {...} | Instruction 'Constant: {...}' has 0 results for `getEnclosingIRFunction()` in function '$@'. | file://:0:0:0:0 | | | +| struct_init.cpp:9:31:12:1 | Constant: {...} | Instruction 'Constant: {...}' has 0 results for `getEnclosingIRFunction()` in function '$@'. | file://:0:0:0:0 | | | +| struct_init.cpp:9:31:12:1 | PointerAdd: {...} | Instruction 'PointerAdd: {...}' has 0 results for `getEnclosingIRFunction()` in function '$@'. | file://:0:0:0:0 | | | +| struct_init.cpp:9:31:12:1 | PointerAdd: {...} | Instruction 'PointerAdd: {...}' has 0 results for `getEnclosingIRFunction()` in function '$@'. | file://:0:0:0:0 | | | fieldAddressOnNonPointer thisArgumentIsNonPointer missingCanonicalLanguageType diff --git a/cpp/ql/test/library-tests/ir/ir/raw_ir.expected b/cpp/ql/test/library-tests/ir/ir/raw_ir.expected index c4b1439fec1..35e92adfd12 100644 --- a/cpp/ql/test/library-tests/ir/ir/raw_ir.expected +++ b/cpp/ql/test/library-tests/ir/ir/raw_ir.expected @@ -107,6 +107,15 @@ bad_asts.cpp: # 30| v30_6(void) = ExitFunction : clang.cpp: +# 3| int globalInt +# 3| Block 0 +# 3| v3_1(void) = EnterFunction : +# 3| r3_2(glval) = VariableAddress[globalInt] : + +# 3| Block 1 +# 3| v3_3(void) = ReturnVoid : +# 3| v3_4(void) = ExitFunction : + # 5| int* globalIntAddress() # 5| Block 0 # 5| v5_1(void) = EnterFunction : @@ -2192,6 +2201,15 @@ ir.cpp: # 341| v341_11(void) = AliasedUse : ~m? # 341| v341_12(void) = ExitFunction : +# 346| int g +# 346| Block 0 +# 346| v346_1(void) = EnterFunction : +# 346| r346_2(glval) = VariableAddress[g] : + +# 346| Block 1 +# 346| v346_3(void) = ReturnVoid : +# 346| v346_4(void) = ExitFunction : + # 348| int* AddressOf() # 348| Block 0 # 348| v348_1(void) = EnterFunction : @@ -5616,6 +5634,17 @@ ir.cpp: # 1034| v1034_5(void) = AliasedUse : ~m? # 1034| v1034_6(void) = ExitFunction : +# 1038| (lambda [] type at line 1038, col. 12) lam +# 1038| Block 0 +# 1038| v1038_1(void) = EnterFunction : +# 1038| r1038_2(glval) = VariableAddress : +# 1038| r1038_3(glval) = VariableAddress : +# 1038| mu1038_4(decltype([...](...){...})) = Uninitialized : &:r1038_3 +# 1038| r1038_5(decltype([...](...){...})) = Load[?] : &:r1038_3, ~m? +# 1038| mu1038_6(decltype([...](...){...})) = Store[?] : &:r1038_2, r1038_5 +# 1038| v1038_7(void) = ReturnVoid : +# 1038| v1038_8(void) = ExitFunction : + # 1038| void (lambda [] type at line 1038, col. 12)::operator()() const # 1038| Block 0 # 1038| v1038_1(void) = EnterFunction : @@ -8664,6 +8693,33 @@ ir.cpp: # 1645| v1645_5(void) = AliasedUse : ~m? # 1645| v1645_6(void) = ExitFunction : +# 1672| int global_1 +# 1672| Block 0 +# 1672| v1672_1(void) = EnterFunction : +# 1672| r1672_2(glval) = VariableAddress : + +# 1672| Block 1 +# 1672| v1672_3(void) = ReturnVoid : +# 1672| v1672_4(void) = ExitFunction : + +# 1674| int global_2 +# 1674| Block 0 +# 1674| v1674_1(void) = EnterFunction : +# 1674| r1674_2(glval) = VariableAddress : +# 1674| r1674_3(int) = Constant[1] : +# 1674| mu1674_4(int) = Store[?] : &:r1674_2, r1674_3 +# 1674| v1674_5(void) = ReturnVoid : +# 1674| v1674_6(void) = ExitFunction : + +# 1676| int const global_3 +# 1676| Block 0 +# 1676| v1676_1(void) = EnterFunction : +# 1676| r1676_2(glval) = VariableAddress : +# 1676| r1676_3(int) = Constant[2] : +# 1676| mu1676_4(int) = Store[?] : &:r1676_2, r1676_3 +# 1676| v1676_5(void) = ReturnVoid : +# 1676| v1676_6(void) = ExitFunction : + perf-regression.cpp: # 6| void Big::Big() # 6| Block 0 @@ -8885,6 +8941,37 @@ smart_ptr.cpp: # 28| v28_6(void) = ExitFunction : struct_init.cpp: +# 9| Info infos_in_file[] +# 9| Block 0 +# 9| v9_1(void) = EnterFunction : +# 9| r9_2(glval) = VariableAddress : +# 10| r10_1(glval) = FieldAddress[name] : +# 10| r10_2(glval) = StringConstant : +# 10| r10_3(char *) = Convert : r10_2 +# 10| mu10_4(char *) = Store[?] : &:r10_1, r10_3 +# 10| r10_5(glval<..(*)(..)>) = FieldAddress[handler] : +# 10| r10_6(..(*)(..)) = FunctionAddress[handler1] : +# 10| mu10_7(..(*)(..)) = Store[?] : &:r10_5, r10_6 +# 11| r11_1(glval) = FieldAddress[name] : +# 11| r11_2(glval) = StringConstant : +# 11| r11_3(char *) = Convert : r11_2 +# 11| mu11_4(char *) = Store[?] : &:r11_1, r11_3 +# 11| r11_5(glval<..(*)(..)>) = FieldAddress[handler] : +# 11| r11_6(glval<..()(..)>) = FunctionAddress[handler2] : +# 11| r11_7(..(*)(..)) = CopyValue : r11_6 +# 11| mu11_8(..(*)(..)) = Store[?] : &:r11_5, r11_7 +# 9| v9_3(void) = ReturnVoid : +# 9| v9_4(void) = ExitFunction : + +# 14| Info* global_pointer +# 14| Block 0 +# 14| v14_1(void) = EnterFunction : +# 14| r14_2(glval) = VariableAddress[global_pointer] : + +# 14| Block 1 +# 14| v14_3(void) = ReturnVoid : +# 14| v14_4(void) = ExitFunction : + # 16| void let_info_escape(Info*) # 16| Block 0 # 16| v16_1(void) = EnterFunction : diff --git a/cpp/ql/test/library-tests/ir/ir/raw_ir.ql b/cpp/ql/test/library-tests/ir/ir/raw_ir.ql index a0ebe4d2bdd..4e64ca4153b 100644 --- a/cpp/ql/test/library-tests/ir/ir/raw_ir.ql +++ b/cpp/ql/test/library-tests/ir/ir/raw_ir.ql @@ -7,5 +7,7 @@ private import semmle.code.cpp.ir.implementation.raw.PrintIR private import PrintConfig private class PrintConfig extends PrintIRConfiguration { - override predicate shouldPrintFunction(Function func) { shouldDumpFunction(func) } + override predicate shouldPrintFunction(Declaration decl) { + shouldDumpFunction(decl) or decl instanceof GlobalOrNamespaceVariable + } } diff --git a/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency.expected b/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency.expected index 31e5b01229c..e03f79ae560 100644 --- a/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency.expected +++ b/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency.expected @@ -6,11 +6,21 @@ missingOperandType duplicateChiOperand sideEffectWithoutPrimary instructionWithoutSuccessor +| clang.cpp:3:5:3:13 | VariableAddress: globalInt | Instruction 'VariableAddress: globalInt' has no successors in function '$@'. | clang.cpp:3:5:3:13 | int globalInt | int globalInt | +| ir.cpp:346:5:346:5 | VariableAddress: g | Instruction 'VariableAddress: g' has no successors in function '$@'. | ir.cpp:346:5:346:5 | int g | int g | +| ir.cpp:1672:5:1672:12 | VariableAddress: global_1 | Instruction 'VariableAddress: global_1' has no successors in function '$@'. | ir.cpp:1672:5:1672:12 | int global_1 | int global_1 | +| struct_init.cpp:14:7:14:20 | VariableAddress: global_pointer | Instruction 'VariableAddress: global_pointer' has no successors in function '$@'. | struct_init.cpp:14:7:14:20 | Info* global_pointer | Info* global_pointer | ambiguousSuccessors unexplainedLoop unnecessaryPhiInstruction memoryOperandDefinitionIsUnmodeled operandAcrossFunctions +| struct_init.cpp:9:13:9:25 | Left | Operand 'Left' is used on instruction 'PointerAdd: {...}' in function '$@', but is defined on instruction 'VariableAddress: infos_in_file' in function '$@'. | file://:0:0:0:0 | | | struct_init.cpp:9:13:9:25 | Info infos_in_file[] | Info infos_in_file[] | +| struct_init.cpp:9:13:9:25 | Left | Operand 'Left' is used on instruction 'PointerAdd: {...}' in function '$@', but is defined on instruction 'VariableAddress: infos_in_file' in function '$@'. | file://:0:0:0:0 | | | struct_init.cpp:9:13:9:25 | Info infos_in_file[] | Info infos_in_file[] | +| struct_init.cpp:9:31:12:1 | Unary | Operand 'Unary' is used on instruction 'FieldAddress: {...}' in function '$@', but is defined on instruction 'PointerAdd: {...}' in function '$@'. | struct_init.cpp:9:13:9:25 | Info infos_in_file[] | Info infos_in_file[] | file://:0:0:0:0 | | | +| struct_init.cpp:9:31:12:1 | Unary | Operand 'Unary' is used on instruction 'FieldAddress: {...}' in function '$@', but is defined on instruction 'PointerAdd: {...}' in function '$@'. | struct_init.cpp:9:13:9:25 | Info infos_in_file[] | Info infos_in_file[] | file://:0:0:0:0 | | | +| struct_init.cpp:9:31:12:1 | Unary | Operand 'Unary' is used on instruction 'FieldAddress: {...}' in function '$@', but is defined on instruction 'PointerAdd: {...}' in function '$@'. | struct_init.cpp:9:13:9:25 | Info infos_in_file[] | Info infos_in_file[] | file://:0:0:0:0 | | | +| struct_init.cpp:9:31:12:1 | Unary | Operand 'Unary' is used on instruction 'FieldAddress: {...}' in function '$@', but is defined on instruction 'PointerAdd: {...}' in function '$@'. | struct_init.cpp:9:13:9:25 | Info infos_in_file[] | Info infos_in_file[] | file://:0:0:0:0 | | | instructionWithoutUniqueBlock containsLoopOfForwardEdges lostReachability @@ -21,6 +31,10 @@ notMarkedAsConflated wronglyMarkedAsConflated invalidOverlap nonUniqueEnclosingIRFunction +| struct_init.cpp:9:31:12:1 | Constant: {...} | Instruction 'Constant: {...}' has 0 results for `getEnclosingIRFunction()` in function '$@'. | file://:0:0:0:0 | | | +| struct_init.cpp:9:31:12:1 | Constant: {...} | Instruction 'Constant: {...}' has 0 results for `getEnclosingIRFunction()` in function '$@'. | file://:0:0:0:0 | | | +| struct_init.cpp:9:31:12:1 | PointerAdd: {...} | Instruction 'PointerAdd: {...}' has 0 results for `getEnclosingIRFunction()` in function '$@'. | file://:0:0:0:0 | | | +| struct_init.cpp:9:31:12:1 | PointerAdd: {...} | Instruction 'PointerAdd: {...}' has 0 results for `getEnclosingIRFunction()` in function '$@'. | file://:0:0:0:0 | | | fieldAddressOnNonPointer thisArgumentIsNonPointer missingCanonicalLanguageType diff --git a/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency_unsound.expected b/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency_unsound.expected index 31e5b01229c..e03f79ae560 100644 --- a/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency_unsound.expected +++ b/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency_unsound.expected @@ -6,11 +6,21 @@ missingOperandType duplicateChiOperand sideEffectWithoutPrimary instructionWithoutSuccessor +| clang.cpp:3:5:3:13 | VariableAddress: globalInt | Instruction 'VariableAddress: globalInt' has no successors in function '$@'. | clang.cpp:3:5:3:13 | int globalInt | int globalInt | +| ir.cpp:346:5:346:5 | VariableAddress: g | Instruction 'VariableAddress: g' has no successors in function '$@'. | ir.cpp:346:5:346:5 | int g | int g | +| ir.cpp:1672:5:1672:12 | VariableAddress: global_1 | Instruction 'VariableAddress: global_1' has no successors in function '$@'. | ir.cpp:1672:5:1672:12 | int global_1 | int global_1 | +| struct_init.cpp:14:7:14:20 | VariableAddress: global_pointer | Instruction 'VariableAddress: global_pointer' has no successors in function '$@'. | struct_init.cpp:14:7:14:20 | Info* global_pointer | Info* global_pointer | ambiguousSuccessors unexplainedLoop unnecessaryPhiInstruction memoryOperandDefinitionIsUnmodeled operandAcrossFunctions +| struct_init.cpp:9:13:9:25 | Left | Operand 'Left' is used on instruction 'PointerAdd: {...}' in function '$@', but is defined on instruction 'VariableAddress: infos_in_file' in function '$@'. | file://:0:0:0:0 | | | struct_init.cpp:9:13:9:25 | Info infos_in_file[] | Info infos_in_file[] | +| struct_init.cpp:9:13:9:25 | Left | Operand 'Left' is used on instruction 'PointerAdd: {...}' in function '$@', but is defined on instruction 'VariableAddress: infos_in_file' in function '$@'. | file://:0:0:0:0 | | | struct_init.cpp:9:13:9:25 | Info infos_in_file[] | Info infos_in_file[] | +| struct_init.cpp:9:31:12:1 | Unary | Operand 'Unary' is used on instruction 'FieldAddress: {...}' in function '$@', but is defined on instruction 'PointerAdd: {...}' in function '$@'. | struct_init.cpp:9:13:9:25 | Info infos_in_file[] | Info infos_in_file[] | file://:0:0:0:0 | | | +| struct_init.cpp:9:31:12:1 | Unary | Operand 'Unary' is used on instruction 'FieldAddress: {...}' in function '$@', but is defined on instruction 'PointerAdd: {...}' in function '$@'. | struct_init.cpp:9:13:9:25 | Info infos_in_file[] | Info infos_in_file[] | file://:0:0:0:0 | | | +| struct_init.cpp:9:31:12:1 | Unary | Operand 'Unary' is used on instruction 'FieldAddress: {...}' in function '$@', but is defined on instruction 'PointerAdd: {...}' in function '$@'. | struct_init.cpp:9:13:9:25 | Info infos_in_file[] | Info infos_in_file[] | file://:0:0:0:0 | | | +| struct_init.cpp:9:31:12:1 | Unary | Operand 'Unary' is used on instruction 'FieldAddress: {...}' in function '$@', but is defined on instruction 'PointerAdd: {...}' in function '$@'. | struct_init.cpp:9:13:9:25 | Info infos_in_file[] | Info infos_in_file[] | file://:0:0:0:0 | | | instructionWithoutUniqueBlock containsLoopOfForwardEdges lostReachability @@ -21,6 +31,10 @@ notMarkedAsConflated wronglyMarkedAsConflated invalidOverlap nonUniqueEnclosingIRFunction +| struct_init.cpp:9:31:12:1 | Constant: {...} | Instruction 'Constant: {...}' has 0 results for `getEnclosingIRFunction()` in function '$@'. | file://:0:0:0:0 | | | +| struct_init.cpp:9:31:12:1 | Constant: {...} | Instruction 'Constant: {...}' has 0 results for `getEnclosingIRFunction()` in function '$@'. | file://:0:0:0:0 | | | +| struct_init.cpp:9:31:12:1 | PointerAdd: {...} | Instruction 'PointerAdd: {...}' has 0 results for `getEnclosingIRFunction()` in function '$@'. | file://:0:0:0:0 | | | +| struct_init.cpp:9:31:12:1 | PointerAdd: {...} | Instruction 'PointerAdd: {...}' has 0 results for `getEnclosingIRFunction()` in function '$@'. | file://:0:0:0:0 | | | fieldAddressOnNonPointer thisArgumentIsNonPointer missingCanonicalLanguageType From a36c6f2daba0f33fc4e9b8e14cfac36e9a7442a3 Mon Sep 17 00:00:00 2001 From: Robert Marsh Date: Mon, 21 Mar 2022 14:26:29 -0400 Subject: [PATCH 04/19] C++: restrict IR generation to global vars w inits --- .../raw/internal/TranslatedElement.qll | 2 +- .../ir/ir/aliased_ssa_consistency.expected | 4 --- .../aliased_ssa_consistency_unsound.expected | 4 --- .../ir/ir/operand_locations.expected | 34 +++++++++++++++++++ .../ir/ir/raw_consistency.expected | 4 --- .../test/library-tests/ir/ir/raw_ir.expected | 28 --------------- .../ir/ir/unaliased_ssa_consistency.expected | 4 --- ...unaliased_ssa_consistency_unsound.expected | 4 --- 8 files changed, 35 insertions(+), 49 deletions(-) diff --git a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedElement.qll b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedElement.qll index 594319c3db5..a8c4e269a7d 100644 --- a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedElement.qll +++ b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedElement.qll @@ -672,7 +672,7 @@ newtype TTranslatedElement = } or // The side effect that initializes newly-allocated memory. TTranslatedAllocationSideEffect(AllocationExpr expr) { not ignoreSideEffects(expr) } or - TTranslatedGlobalOrNamespaceVarInit(GlobalOrNamespaceVariable var) { any() } + TTranslatedGlobalOrNamespaceVarInit(GlobalOrNamespaceVariable var) { var.hasInitializer() } /** * Gets the index of the first explicitly initialized element in `initList` diff --git a/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency.expected b/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency.expected index 4054550d46d..764696f5ffd 100644 --- a/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency.expected +++ b/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency.expected @@ -10,10 +10,6 @@ missingOperandType duplicateChiOperand sideEffectWithoutPrimary instructionWithoutSuccessor -| clang.cpp:3:5:3:13 | VariableAddress: globalInt | Instruction 'VariableAddress: globalInt' has no successors in function '$@'. | clang.cpp:3:5:3:13 | int globalInt | int globalInt | -| ir.cpp:346:5:346:5 | VariableAddress: g | Instruction 'VariableAddress: g' has no successors in function '$@'. | ir.cpp:346:5:346:5 | int g | int g | -| ir.cpp:1672:5:1672:12 | VariableAddress: global_1 | Instruction 'VariableAddress: global_1' has no successors in function '$@'. | ir.cpp:1672:5:1672:12 | int global_1 | int global_1 | -| struct_init.cpp:14:7:14:20 | VariableAddress: global_pointer | Instruction 'VariableAddress: global_pointer' has no successors in function '$@'. | struct_init.cpp:14:7:14:20 | Info* global_pointer | Info* global_pointer | ambiguousSuccessors unexplainedLoop unnecessaryPhiInstruction diff --git a/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency_unsound.expected b/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency_unsound.expected index 4054550d46d..764696f5ffd 100644 --- a/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency_unsound.expected +++ b/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency_unsound.expected @@ -10,10 +10,6 @@ missingOperandType duplicateChiOperand sideEffectWithoutPrimary instructionWithoutSuccessor -| clang.cpp:3:5:3:13 | VariableAddress: globalInt | Instruction 'VariableAddress: globalInt' has no successors in function '$@'. | clang.cpp:3:5:3:13 | int globalInt | int globalInt | -| ir.cpp:346:5:346:5 | VariableAddress: g | Instruction 'VariableAddress: g' has no successors in function '$@'. | ir.cpp:346:5:346:5 | int g | int g | -| ir.cpp:1672:5:1672:12 | VariableAddress: global_1 | Instruction 'VariableAddress: global_1' has no successors in function '$@'. | ir.cpp:1672:5:1672:12 | int global_1 | int global_1 | -| struct_init.cpp:14:7:14:20 | VariableAddress: global_pointer | Instruction 'VariableAddress: global_pointer' has no successors in function '$@'. | struct_init.cpp:14:7:14:20 | Info* global_pointer | Info* global_pointer | ambiguousSuccessors unexplainedLoop unnecessaryPhiInstruction diff --git a/cpp/ql/test/library-tests/ir/ir/operand_locations.expected b/cpp/ql/test/library-tests/ir/ir/operand_locations.expected index df1e6a6daab..fc5d44968cc 100644 --- a/cpp/ql/test/library-tests/ir/ir/operand_locations.expected +++ b/cpp/ql/test/library-tests/ir/ir/operand_locations.expected @@ -4658,7 +4658,15 @@ | ir.cpp:1034:6:1034:20 | ChiTotal | total:m1034_2 | | ir.cpp:1034:6:1034:20 | SideEffect | m1034_3 | | ir.cpp:1035:15:1035:15 | Address | &:r1035_1 | +| ir.cpp:1038:6:1038:8 | Address | &:r1038_2 | +| ir.cpp:1038:12:1038:18 | Address | &:r1038_3 | +| ir.cpp:1038:12:1038:18 | Address | &:r1038_3 | +| ir.cpp:1038:12:1038:18 | ChiPartial | partial:m1038_4 | +| ir.cpp:1038:12:1038:18 | ChiPartial | partial:m1038_7 | +| ir.cpp:1038:12:1038:18 | ChiTotal | total:m1038_5 | | ir.cpp:1038:12:1038:18 | ChiTotal | total:~m? | +| ir.cpp:1038:12:1038:18 | Load | ~m1038_5 | +| ir.cpp:1038:12:1038:18 | StoreValue | r1038_6 | | ir.cpp:1038:14:1038:14 | Address | &:r1038_5 | | ir.cpp:1038:14:1038:14 | Address | &:r1038_5 | | ir.cpp:1038:14:1038:14 | Address | &:r1038_5 | @@ -7437,8 +7445,14 @@ | ir.cpp:1668:17:1668:17 | Load | m1661_14 | | ir.cpp:1668:17:1668:17 | Load | ~m1666_6 | | ir.cpp:1668:17:1668:17 | StoreValue | r1668_4 | +| ir.cpp:1674:5:1674:12 | Address | &:r1674_2 | +| ir.cpp:1674:16:1674:16 | ChiPartial | partial:m1674_4 | | ir.cpp:1674:16:1674:16 | ChiTotal | total:~m? | +| ir.cpp:1674:16:1674:16 | StoreValue | r1674_3 | +| ir.cpp:1676:11:1676:18 | Address | &:r1676_2 | +| ir.cpp:1676:22:1676:22 | ChiPartial | partial:m1676_4 | | ir.cpp:1676:22:1676:22 | ChiTotal | total:~m? | +| ir.cpp:1676:22:1676:22 | StoreValue | r1676_3 | | perf-regression.cpp:6:3:6:5 | Address | &:r6_5 | | perf-regression.cpp:6:3:6:5 | Address | &:r6_5 | | perf-regression.cpp:6:3:6:5 | Address | &:r6_7 | @@ -7682,7 +7696,27 @@ | smart_ptr.cpp:47:43:47:63 | SideEffect | ~m47_16 | | smart_ptr.cpp:47:43:47:63 | Unary | r47_5 | | smart_ptr.cpp:47:43:47:63 | Unary | r47_6 | +| struct_init.cpp:9:13:9:25 | Left | r9_2 | +| struct_init.cpp:9:13:9:25 | Left | r9_2 | +| struct_init.cpp:10:5:10:21 | Address | &:r10_1 | +| struct_init.cpp:10:5:10:21 | Address | &:r10_6 | +| struct_init.cpp:10:7:10:9 | ChiPartial | partial:m10_4 | | struct_init.cpp:10:7:10:9 | ChiTotal | total:~m? | +| struct_init.cpp:10:7:10:9 | StoreValue | r10_3 | +| struct_init.cpp:10:7:10:9 | Unary | r10_2 | +| struct_init.cpp:10:12:10:19 | ChiPartial | partial:m10_8 | +| struct_init.cpp:10:12:10:19 | ChiTotal | total:m10_5 | +| struct_init.cpp:10:12:10:19 | StoreValue | r10_7 | +| struct_init.cpp:11:5:11:22 | Address | &:r11_1 | +| struct_init.cpp:11:5:11:22 | Address | &:r11_6 | +| struct_init.cpp:11:7:11:9 | ChiPartial | partial:m11_4 | +| struct_init.cpp:11:7:11:9 | ChiTotal | total:m10_9 | +| struct_init.cpp:11:7:11:9 | StoreValue | r11_3 | +| struct_init.cpp:11:7:11:9 | Unary | r11_2 | +| struct_init.cpp:11:12:11:20 | ChiPartial | partial:m11_9 | +| struct_init.cpp:11:12:11:20 | ChiTotal | total:m11_5 | +| struct_init.cpp:11:12:11:20 | StoreValue | r11_8 | +| struct_init.cpp:11:13:11:20 | Unary | r11_7 | | struct_init.cpp:16:6:16:20 | ChiPartial | partial:m16_3 | | struct_init.cpp:16:6:16:20 | ChiTotal | total:m16_2 | | struct_init.cpp:16:6:16:20 | SideEffect | ~m17_5 | diff --git a/cpp/ql/test/library-tests/ir/ir/raw_consistency.expected b/cpp/ql/test/library-tests/ir/ir/raw_consistency.expected index b0a01e27615..443becd566a 100644 --- a/cpp/ql/test/library-tests/ir/ir/raw_consistency.expected +++ b/cpp/ql/test/library-tests/ir/ir/raw_consistency.expected @@ -7,10 +7,6 @@ duplicateChiOperand sideEffectWithoutPrimary instructionWithoutSuccessor | ../../../include/memory.h:68:25:68:33 | CopyValue: (reference to) | Instruction 'CopyValue: (reference to)' has no successors in function '$@'. | ../../../include/memory.h:67:5:67:5 | void std::unique_ptr>::~unique_ptr() | void std::unique_ptr>::~unique_ptr() | -| clang.cpp:3:5:3:13 | VariableAddress: globalInt | Instruction 'VariableAddress: globalInt' has no successors in function '$@'. | clang.cpp:3:5:3:13 | int globalInt | int globalInt | -| ir.cpp:346:5:346:5 | VariableAddress: g | Instruction 'VariableAddress: g' has no successors in function '$@'. | ir.cpp:346:5:346:5 | int g | int g | -| ir.cpp:1672:5:1672:12 | VariableAddress: global_1 | Instruction 'VariableAddress: global_1' has no successors in function '$@'. | ir.cpp:1672:5:1672:12 | int global_1 | int global_1 | -| struct_init.cpp:14:7:14:20 | VariableAddress: global_pointer | Instruction 'VariableAddress: global_pointer' has no successors in function '$@'. | struct_init.cpp:14:7:14:20 | Info* global_pointer | Info* global_pointer | ambiguousSuccessors unexplainedLoop unnecessaryPhiInstruction diff --git a/cpp/ql/test/library-tests/ir/ir/raw_ir.expected b/cpp/ql/test/library-tests/ir/ir/raw_ir.expected index 35e92adfd12..1b80ee4a5f9 100644 --- a/cpp/ql/test/library-tests/ir/ir/raw_ir.expected +++ b/cpp/ql/test/library-tests/ir/ir/raw_ir.expected @@ -108,13 +108,6 @@ bad_asts.cpp: clang.cpp: # 3| int globalInt -# 3| Block 0 -# 3| v3_1(void) = EnterFunction : -# 3| r3_2(glval) = VariableAddress[globalInt] : - -# 3| Block 1 -# 3| v3_3(void) = ReturnVoid : -# 3| v3_4(void) = ExitFunction : # 5| int* globalIntAddress() # 5| Block 0 @@ -2202,13 +2195,6 @@ ir.cpp: # 341| v341_12(void) = ExitFunction : # 346| int g -# 346| Block 0 -# 346| v346_1(void) = EnterFunction : -# 346| r346_2(glval) = VariableAddress[g] : - -# 346| Block 1 -# 346| v346_3(void) = ReturnVoid : -# 346| v346_4(void) = ExitFunction : # 348| int* AddressOf() # 348| Block 0 @@ -8694,13 +8680,6 @@ ir.cpp: # 1645| v1645_6(void) = ExitFunction : # 1672| int global_1 -# 1672| Block 0 -# 1672| v1672_1(void) = EnterFunction : -# 1672| r1672_2(glval) = VariableAddress : - -# 1672| Block 1 -# 1672| v1672_3(void) = ReturnVoid : -# 1672| v1672_4(void) = ExitFunction : # 1674| int global_2 # 1674| Block 0 @@ -8964,13 +8943,6 @@ struct_init.cpp: # 9| v9_4(void) = ExitFunction : # 14| Info* global_pointer -# 14| Block 0 -# 14| v14_1(void) = EnterFunction : -# 14| r14_2(glval) = VariableAddress[global_pointer] : - -# 14| Block 1 -# 14| v14_3(void) = ReturnVoid : -# 14| v14_4(void) = ExitFunction : # 16| void let_info_escape(Info*) # 16| Block 0 diff --git a/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency.expected b/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency.expected index e03f79ae560..4ce0efcbd7c 100644 --- a/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency.expected +++ b/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency.expected @@ -6,10 +6,6 @@ missingOperandType duplicateChiOperand sideEffectWithoutPrimary instructionWithoutSuccessor -| clang.cpp:3:5:3:13 | VariableAddress: globalInt | Instruction 'VariableAddress: globalInt' has no successors in function '$@'. | clang.cpp:3:5:3:13 | int globalInt | int globalInt | -| ir.cpp:346:5:346:5 | VariableAddress: g | Instruction 'VariableAddress: g' has no successors in function '$@'. | ir.cpp:346:5:346:5 | int g | int g | -| ir.cpp:1672:5:1672:12 | VariableAddress: global_1 | Instruction 'VariableAddress: global_1' has no successors in function '$@'. | ir.cpp:1672:5:1672:12 | int global_1 | int global_1 | -| struct_init.cpp:14:7:14:20 | VariableAddress: global_pointer | Instruction 'VariableAddress: global_pointer' has no successors in function '$@'. | struct_init.cpp:14:7:14:20 | Info* global_pointer | Info* global_pointer | ambiguousSuccessors unexplainedLoop unnecessaryPhiInstruction diff --git a/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency_unsound.expected b/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency_unsound.expected index e03f79ae560..4ce0efcbd7c 100644 --- a/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency_unsound.expected +++ b/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency_unsound.expected @@ -6,10 +6,6 @@ missingOperandType duplicateChiOperand sideEffectWithoutPrimary instructionWithoutSuccessor -| clang.cpp:3:5:3:13 | VariableAddress: globalInt | Instruction 'VariableAddress: globalInt' has no successors in function '$@'. | clang.cpp:3:5:3:13 | int globalInt | int globalInt | -| ir.cpp:346:5:346:5 | VariableAddress: g | Instruction 'VariableAddress: g' has no successors in function '$@'. | ir.cpp:346:5:346:5 | int g | int g | -| ir.cpp:1672:5:1672:12 | VariableAddress: global_1 | Instruction 'VariableAddress: global_1' has no successors in function '$@'. | ir.cpp:1672:5:1672:12 | int global_1 | int global_1 | -| struct_init.cpp:14:7:14:20 | VariableAddress: global_pointer | Instruction 'VariableAddress: global_pointer' has no successors in function '$@'. | struct_init.cpp:14:7:14:20 | Info* global_pointer | Info* global_pointer | ambiguousSuccessors unexplainedLoop unnecessaryPhiInstruction From 5bb6441047f4993c6dc8936ed09f5959a45b0df0 Mon Sep 17 00:00:00 2001 From: Robert Marsh Date: Mon, 21 Mar 2022 16:01:24 -0400 Subject: [PATCH 05/19] C++: Fix consistency issues with aggregate inits --- .../raw/internal/TranslatedGlobalVar.qll | 2 +- .../raw/internal/TranslatedInitialization.qll | 6 +++++- .../ir/ir/aliased_ssa_consistency.expected | 10 ---------- .../ir/aliased_ssa_consistency_unsound.expected | 10 ---------- .../ir/ir/operand_locations.expected | 6 ++++++ .../library-tests/ir/ir/raw_consistency.expected | 10 ---------- cpp/ql/test/library-tests/ir/ir/raw_ir.expected | 16 ++++++++++------ .../ir/ir/unaliased_ssa_consistency.expected | 10 ---------- .../unaliased_ssa_consistency_unsound.expected | 10 ---------- .../library-tests/ir/ssa/aliased_ssa_ir.expected | 2 ++ .../ir/ssa/aliased_ssa_ir_unsound.expected | 2 ++ .../ir/ssa/unaliased_ssa_ir.expected | 2 ++ .../ir/ssa/unaliased_ssa_ir_unsound.expected | 2 ++ 13 files changed, 30 insertions(+), 58 deletions(-) diff --git a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedGlobalVar.qll b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedGlobalVar.qll index f26d7e39d21..e600e86bb5a 100644 --- a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedGlobalVar.qll +++ b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedGlobalVar.qll @@ -73,7 +73,7 @@ class TranslatedGlobalOrNamespaceVarInit extends TranslatedInstructionContainer, result = getInstruction(InitializerVariableAddressTag()) } - override Type getTargetType() { result = var.getType() } + override Type getTargetType() { result = var.getUnspecifiedType() } } TranslatedGlobalOrNamespaceVarInit getTranslatedVarInit(GlobalOrNamespaceVariable var) { diff --git a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedInitialization.qll b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedInitialization.qll index 209532d3625..b800405a73b 100644 --- a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedInitialization.qll +++ b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedInitialization.qll @@ -639,7 +639,11 @@ abstract class TranslatedElementInitialization extends TranslatedElement { /** DEPRECATED: Alias for getAst */ deprecated override Locatable getAST() { result = getAst() } - final override Function getFunction() { result = initList.getEnclosingFunction() } + final override Declaration getFunction() { + result = initList.getEnclosingFunction() + or + result = initList.getEnclosingVariable().(GlobalOrNamespaceVariable) + } final override Instruction getFirstInstruction() { result = getInstruction(getElementIndexTag()) } diff --git a/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency.expected b/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency.expected index 764696f5ffd..b14f9173c96 100644 --- a/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency.expected +++ b/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency.expected @@ -15,12 +15,6 @@ unexplainedLoop unnecessaryPhiInstruction memoryOperandDefinitionIsUnmodeled operandAcrossFunctions -| struct_init.cpp:9:13:9:25 | Left | Operand 'Left' is used on instruction 'PointerAdd: {...}' in function '$@', but is defined on instruction 'VariableAddress: infos_in_file' in function '$@'. | file://:0:0:0:0 | | | struct_init.cpp:9:13:9:25 | Info infos_in_file[] | Info infos_in_file[] | -| struct_init.cpp:9:13:9:25 | Left | Operand 'Left' is used on instruction 'PointerAdd: {...}' in function '$@', but is defined on instruction 'VariableAddress: infos_in_file' in function '$@'. | file://:0:0:0:0 | | | struct_init.cpp:9:13:9:25 | Info infos_in_file[] | Info infos_in_file[] | -| struct_init.cpp:9:31:12:1 | Unary | Operand 'Unary' is used on instruction 'FieldAddress: {...}' in function '$@', but is defined on instruction 'PointerAdd: {...}' in function '$@'. | struct_init.cpp:9:13:9:25 | Info infos_in_file[] | Info infos_in_file[] | file://:0:0:0:0 | | | -| struct_init.cpp:9:31:12:1 | Unary | Operand 'Unary' is used on instruction 'FieldAddress: {...}' in function '$@', but is defined on instruction 'PointerAdd: {...}' in function '$@'. | struct_init.cpp:9:13:9:25 | Info infos_in_file[] | Info infos_in_file[] | file://:0:0:0:0 | | | -| struct_init.cpp:9:31:12:1 | Unary | Operand 'Unary' is used on instruction 'FieldAddress: {...}' in function '$@', but is defined on instruction 'PointerAdd: {...}' in function '$@'. | struct_init.cpp:9:13:9:25 | Info infos_in_file[] | Info infos_in_file[] | file://:0:0:0:0 | | | -| struct_init.cpp:9:31:12:1 | Unary | Operand 'Unary' is used on instruction 'FieldAddress: {...}' in function '$@', but is defined on instruction 'PointerAdd: {...}' in function '$@'. | struct_init.cpp:9:13:9:25 | Info infos_in_file[] | Info infos_in_file[] | file://:0:0:0:0 | | | instructionWithoutUniqueBlock containsLoopOfForwardEdges lostReachability @@ -39,10 +33,6 @@ wronglyMarkedAsConflated | struct_init.cpp:11:12:11:20 | Chi: & ... | Instruction 'Chi: & ...' should not be marked as having a conflated result in function '$@'. | struct_init.cpp:9:13:9:25 | Info infos_in_file[] | Info infos_in_file[] | invalidOverlap nonUniqueEnclosingIRFunction -| struct_init.cpp:9:31:12:1 | Constant: {...} | Instruction 'Constant: {...}' has 0 results for `getEnclosingIRFunction()` in function '$@'. | file://:0:0:0:0 | | | -| struct_init.cpp:9:31:12:1 | Constant: {...} | Instruction 'Constant: {...}' has 0 results for `getEnclosingIRFunction()` in function '$@'. | file://:0:0:0:0 | | | -| struct_init.cpp:9:31:12:1 | PointerAdd: {...} | Instruction 'PointerAdd: {...}' has 0 results for `getEnclosingIRFunction()` in function '$@'. | file://:0:0:0:0 | | | -| struct_init.cpp:9:31:12:1 | PointerAdd: {...} | Instruction 'PointerAdd: {...}' has 0 results for `getEnclosingIRFunction()` in function '$@'. | file://:0:0:0:0 | | | fieldAddressOnNonPointer thisArgumentIsNonPointer missingCanonicalLanguageType diff --git a/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency_unsound.expected b/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency_unsound.expected index 764696f5ffd..b14f9173c96 100644 --- a/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency_unsound.expected +++ b/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency_unsound.expected @@ -15,12 +15,6 @@ unexplainedLoop unnecessaryPhiInstruction memoryOperandDefinitionIsUnmodeled operandAcrossFunctions -| struct_init.cpp:9:13:9:25 | Left | Operand 'Left' is used on instruction 'PointerAdd: {...}' in function '$@', but is defined on instruction 'VariableAddress: infos_in_file' in function '$@'. | file://:0:0:0:0 | | | struct_init.cpp:9:13:9:25 | Info infos_in_file[] | Info infos_in_file[] | -| struct_init.cpp:9:13:9:25 | Left | Operand 'Left' is used on instruction 'PointerAdd: {...}' in function '$@', but is defined on instruction 'VariableAddress: infos_in_file' in function '$@'. | file://:0:0:0:0 | | | struct_init.cpp:9:13:9:25 | Info infos_in_file[] | Info infos_in_file[] | -| struct_init.cpp:9:31:12:1 | Unary | Operand 'Unary' is used on instruction 'FieldAddress: {...}' in function '$@', but is defined on instruction 'PointerAdd: {...}' in function '$@'. | struct_init.cpp:9:13:9:25 | Info infos_in_file[] | Info infos_in_file[] | file://:0:0:0:0 | | | -| struct_init.cpp:9:31:12:1 | Unary | Operand 'Unary' is used on instruction 'FieldAddress: {...}' in function '$@', but is defined on instruction 'PointerAdd: {...}' in function '$@'. | struct_init.cpp:9:13:9:25 | Info infos_in_file[] | Info infos_in_file[] | file://:0:0:0:0 | | | -| struct_init.cpp:9:31:12:1 | Unary | Operand 'Unary' is used on instruction 'FieldAddress: {...}' in function '$@', but is defined on instruction 'PointerAdd: {...}' in function '$@'. | struct_init.cpp:9:13:9:25 | Info infos_in_file[] | Info infos_in_file[] | file://:0:0:0:0 | | | -| struct_init.cpp:9:31:12:1 | Unary | Operand 'Unary' is used on instruction 'FieldAddress: {...}' in function '$@', but is defined on instruction 'PointerAdd: {...}' in function '$@'. | struct_init.cpp:9:13:9:25 | Info infos_in_file[] | Info infos_in_file[] | file://:0:0:0:0 | | | instructionWithoutUniqueBlock containsLoopOfForwardEdges lostReachability @@ -39,10 +33,6 @@ wronglyMarkedAsConflated | struct_init.cpp:11:12:11:20 | Chi: & ... | Instruction 'Chi: & ...' should not be marked as having a conflated result in function '$@'. | struct_init.cpp:9:13:9:25 | Info infos_in_file[] | Info infos_in_file[] | invalidOverlap nonUniqueEnclosingIRFunction -| struct_init.cpp:9:31:12:1 | Constant: {...} | Instruction 'Constant: {...}' has 0 results for `getEnclosingIRFunction()` in function '$@'. | file://:0:0:0:0 | | | -| struct_init.cpp:9:31:12:1 | Constant: {...} | Instruction 'Constant: {...}' has 0 results for `getEnclosingIRFunction()` in function '$@'. | file://:0:0:0:0 | | | -| struct_init.cpp:9:31:12:1 | PointerAdd: {...} | Instruction 'PointerAdd: {...}' has 0 results for `getEnclosingIRFunction()` in function '$@'. | file://:0:0:0:0 | | | -| struct_init.cpp:9:31:12:1 | PointerAdd: {...} | Instruction 'PointerAdd: {...}' has 0 results for `getEnclosingIRFunction()` in function '$@'. | file://:0:0:0:0 | | | fieldAddressOnNonPointer thisArgumentIsNonPointer missingCanonicalLanguageType diff --git a/cpp/ql/test/library-tests/ir/ir/operand_locations.expected b/cpp/ql/test/library-tests/ir/ir/operand_locations.expected index fc5d44968cc..80e12c35bae 100644 --- a/cpp/ql/test/library-tests/ir/ir/operand_locations.expected +++ b/cpp/ql/test/library-tests/ir/ir/operand_locations.expected @@ -7698,6 +7698,12 @@ | smart_ptr.cpp:47:43:47:63 | Unary | r47_6 | | struct_init.cpp:9:13:9:25 | Left | r9_2 | | struct_init.cpp:9:13:9:25 | Left | r9_2 | +| struct_init.cpp:9:31:12:1 | Right | r9_3 | +| struct_init.cpp:9:31:12:1 | Right | r9_5 | +| struct_init.cpp:9:31:12:1 | Unary | r9_4 | +| struct_init.cpp:9:31:12:1 | Unary | r9_4 | +| struct_init.cpp:9:31:12:1 | Unary | r9_6 | +| struct_init.cpp:9:31:12:1 | Unary | r9_6 | | struct_init.cpp:10:5:10:21 | Address | &:r10_1 | | struct_init.cpp:10:5:10:21 | Address | &:r10_6 | | struct_init.cpp:10:7:10:9 | ChiPartial | partial:m10_4 | diff --git a/cpp/ql/test/library-tests/ir/ir/raw_consistency.expected b/cpp/ql/test/library-tests/ir/ir/raw_consistency.expected index 443becd566a..826c3beedf1 100644 --- a/cpp/ql/test/library-tests/ir/ir/raw_consistency.expected +++ b/cpp/ql/test/library-tests/ir/ir/raw_consistency.expected @@ -12,12 +12,6 @@ unexplainedLoop unnecessaryPhiInstruction memoryOperandDefinitionIsUnmodeled operandAcrossFunctions -| struct_init.cpp:9:13:9:25 | Left | Operand 'Left' is used on instruction 'PointerAdd: {...}' in function '$@', but is defined on instruction 'VariableAddress: infos_in_file' in function '$@'. | file://:0:0:0:0 | | | struct_init.cpp:9:13:9:25 | Info infos_in_file[] | Info infos_in_file[] | -| struct_init.cpp:9:13:9:25 | Left | Operand 'Left' is used on instruction 'PointerAdd: {...}' in function '$@', but is defined on instruction 'VariableAddress: infos_in_file' in function '$@'. | file://:0:0:0:0 | | | struct_init.cpp:9:13:9:25 | Info infos_in_file[] | Info infos_in_file[] | -| struct_init.cpp:9:31:12:1 | Unary | Operand 'Unary' is used on instruction 'FieldAddress: {...}' in function '$@', but is defined on instruction 'PointerAdd: {...}' in function '$@'. | struct_init.cpp:9:13:9:25 | Info infos_in_file[] | Info infos_in_file[] | file://:0:0:0:0 | | | -| struct_init.cpp:9:31:12:1 | Unary | Operand 'Unary' is used on instruction 'FieldAddress: {...}' in function '$@', but is defined on instruction 'PointerAdd: {...}' in function '$@'. | struct_init.cpp:9:13:9:25 | Info infos_in_file[] | Info infos_in_file[] | file://:0:0:0:0 | | | -| struct_init.cpp:9:31:12:1 | Unary | Operand 'Unary' is used on instruction 'FieldAddress: {...}' in function '$@', but is defined on instruction 'PointerAdd: {...}' in function '$@'. | struct_init.cpp:9:13:9:25 | Info infos_in_file[] | Info infos_in_file[] | file://:0:0:0:0 | | | -| struct_init.cpp:9:31:12:1 | Unary | Operand 'Unary' is used on instruction 'FieldAddress: {...}' in function '$@', but is defined on instruction 'PointerAdd: {...}' in function '$@'. | struct_init.cpp:9:13:9:25 | Info infos_in_file[] | Info infos_in_file[] | file://:0:0:0:0 | | | instructionWithoutUniqueBlock containsLoopOfForwardEdges lostReachability @@ -29,10 +23,6 @@ notMarkedAsConflated wronglyMarkedAsConflated invalidOverlap nonUniqueEnclosingIRFunction -| struct_init.cpp:9:31:12:1 | Constant: {...} | Instruction 'Constant: {...}' has 0 results for `getEnclosingIRFunction()` in function '$@'. | file://:0:0:0:0 | | | -| struct_init.cpp:9:31:12:1 | Constant: {...} | Instruction 'Constant: {...}' has 0 results for `getEnclosingIRFunction()` in function '$@'. | file://:0:0:0:0 | | | -| struct_init.cpp:9:31:12:1 | PointerAdd: {...} | Instruction 'PointerAdd: {...}' has 0 results for `getEnclosingIRFunction()` in function '$@'. | file://:0:0:0:0 | | | -| struct_init.cpp:9:31:12:1 | PointerAdd: {...} | Instruction 'PointerAdd: {...}' has 0 results for `getEnclosingIRFunction()` in function '$@'. | file://:0:0:0:0 | | | fieldAddressOnNonPointer thisArgumentIsNonPointer missingCanonicalLanguageType diff --git a/cpp/ql/test/library-tests/ir/ir/raw_ir.expected b/cpp/ql/test/library-tests/ir/ir/raw_ir.expected index 1b80ee4a5f9..e1d944c45c1 100644 --- a/cpp/ql/test/library-tests/ir/ir/raw_ir.expected +++ b/cpp/ql/test/library-tests/ir/ir/raw_ir.expected @@ -8924,23 +8924,27 @@ struct_init.cpp: # 9| Block 0 # 9| v9_1(void) = EnterFunction : # 9| r9_2(glval) = VariableAddress : -# 10| r10_1(glval) = FieldAddress[name] : +# 9| r9_3(int) = Constant[0] : +# 9| r9_4(glval) = PointerAdd[16] : r9_2, r9_3 +# 10| r10_1(glval) = FieldAddress[name] : r9_4 # 10| r10_2(glval) = StringConstant : # 10| r10_3(char *) = Convert : r10_2 # 10| mu10_4(char *) = Store[?] : &:r10_1, r10_3 -# 10| r10_5(glval<..(*)(..)>) = FieldAddress[handler] : +# 10| r10_5(glval<..(*)(..)>) = FieldAddress[handler] : r9_4 # 10| r10_6(..(*)(..)) = FunctionAddress[handler1] : # 10| mu10_7(..(*)(..)) = Store[?] : &:r10_5, r10_6 -# 11| r11_1(glval) = FieldAddress[name] : +# 9| r9_5(int) = Constant[1] : +# 9| r9_6(glval) = PointerAdd[16] : r9_2, r9_5 +# 11| r11_1(glval) = FieldAddress[name] : r9_6 # 11| r11_2(glval) = StringConstant : # 11| r11_3(char *) = Convert : r11_2 # 11| mu11_4(char *) = Store[?] : &:r11_1, r11_3 -# 11| r11_5(glval<..(*)(..)>) = FieldAddress[handler] : +# 11| r11_5(glval<..(*)(..)>) = FieldAddress[handler] : r9_6 # 11| r11_6(glval<..()(..)>) = FunctionAddress[handler2] : # 11| r11_7(..(*)(..)) = CopyValue : r11_6 # 11| mu11_8(..(*)(..)) = Store[?] : &:r11_5, r11_7 -# 9| v9_3(void) = ReturnVoid : -# 9| v9_4(void) = ExitFunction : +# 9| v9_7(void) = ReturnVoid : +# 9| v9_8(void) = ExitFunction : # 14| Info* global_pointer diff --git a/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency.expected b/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency.expected index 4ce0efcbd7c..31e5b01229c 100644 --- a/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency.expected +++ b/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency.expected @@ -11,12 +11,6 @@ unexplainedLoop unnecessaryPhiInstruction memoryOperandDefinitionIsUnmodeled operandAcrossFunctions -| struct_init.cpp:9:13:9:25 | Left | Operand 'Left' is used on instruction 'PointerAdd: {...}' in function '$@', but is defined on instruction 'VariableAddress: infos_in_file' in function '$@'. | file://:0:0:0:0 | | | struct_init.cpp:9:13:9:25 | Info infos_in_file[] | Info infos_in_file[] | -| struct_init.cpp:9:13:9:25 | Left | Operand 'Left' is used on instruction 'PointerAdd: {...}' in function '$@', but is defined on instruction 'VariableAddress: infos_in_file' in function '$@'. | file://:0:0:0:0 | | | struct_init.cpp:9:13:9:25 | Info infos_in_file[] | Info infos_in_file[] | -| struct_init.cpp:9:31:12:1 | Unary | Operand 'Unary' is used on instruction 'FieldAddress: {...}' in function '$@', but is defined on instruction 'PointerAdd: {...}' in function '$@'. | struct_init.cpp:9:13:9:25 | Info infos_in_file[] | Info infos_in_file[] | file://:0:0:0:0 | | | -| struct_init.cpp:9:31:12:1 | Unary | Operand 'Unary' is used on instruction 'FieldAddress: {...}' in function '$@', but is defined on instruction 'PointerAdd: {...}' in function '$@'. | struct_init.cpp:9:13:9:25 | Info infos_in_file[] | Info infos_in_file[] | file://:0:0:0:0 | | | -| struct_init.cpp:9:31:12:1 | Unary | Operand 'Unary' is used on instruction 'FieldAddress: {...}' in function '$@', but is defined on instruction 'PointerAdd: {...}' in function '$@'. | struct_init.cpp:9:13:9:25 | Info infos_in_file[] | Info infos_in_file[] | file://:0:0:0:0 | | | -| struct_init.cpp:9:31:12:1 | Unary | Operand 'Unary' is used on instruction 'FieldAddress: {...}' in function '$@', but is defined on instruction 'PointerAdd: {...}' in function '$@'. | struct_init.cpp:9:13:9:25 | Info infos_in_file[] | Info infos_in_file[] | file://:0:0:0:0 | | | instructionWithoutUniqueBlock containsLoopOfForwardEdges lostReachability @@ -27,10 +21,6 @@ notMarkedAsConflated wronglyMarkedAsConflated invalidOverlap nonUniqueEnclosingIRFunction -| struct_init.cpp:9:31:12:1 | Constant: {...} | Instruction 'Constant: {...}' has 0 results for `getEnclosingIRFunction()` in function '$@'. | file://:0:0:0:0 | | | -| struct_init.cpp:9:31:12:1 | Constant: {...} | Instruction 'Constant: {...}' has 0 results for `getEnclosingIRFunction()` in function '$@'. | file://:0:0:0:0 | | | -| struct_init.cpp:9:31:12:1 | PointerAdd: {...} | Instruction 'PointerAdd: {...}' has 0 results for `getEnclosingIRFunction()` in function '$@'. | file://:0:0:0:0 | | | -| struct_init.cpp:9:31:12:1 | PointerAdd: {...} | Instruction 'PointerAdd: {...}' has 0 results for `getEnclosingIRFunction()` in function '$@'. | file://:0:0:0:0 | | | fieldAddressOnNonPointer thisArgumentIsNonPointer missingCanonicalLanguageType diff --git a/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency_unsound.expected b/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency_unsound.expected index 4ce0efcbd7c..31e5b01229c 100644 --- a/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency_unsound.expected +++ b/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency_unsound.expected @@ -11,12 +11,6 @@ unexplainedLoop unnecessaryPhiInstruction memoryOperandDefinitionIsUnmodeled operandAcrossFunctions -| struct_init.cpp:9:13:9:25 | Left | Operand 'Left' is used on instruction 'PointerAdd: {...}' in function '$@', but is defined on instruction 'VariableAddress: infos_in_file' in function '$@'. | file://:0:0:0:0 | | | struct_init.cpp:9:13:9:25 | Info infos_in_file[] | Info infos_in_file[] | -| struct_init.cpp:9:13:9:25 | Left | Operand 'Left' is used on instruction 'PointerAdd: {...}' in function '$@', but is defined on instruction 'VariableAddress: infos_in_file' in function '$@'. | file://:0:0:0:0 | | | struct_init.cpp:9:13:9:25 | Info infos_in_file[] | Info infos_in_file[] | -| struct_init.cpp:9:31:12:1 | Unary | Operand 'Unary' is used on instruction 'FieldAddress: {...}' in function '$@', but is defined on instruction 'PointerAdd: {...}' in function '$@'. | struct_init.cpp:9:13:9:25 | Info infos_in_file[] | Info infos_in_file[] | file://:0:0:0:0 | | | -| struct_init.cpp:9:31:12:1 | Unary | Operand 'Unary' is used on instruction 'FieldAddress: {...}' in function '$@', but is defined on instruction 'PointerAdd: {...}' in function '$@'. | struct_init.cpp:9:13:9:25 | Info infos_in_file[] | Info infos_in_file[] | file://:0:0:0:0 | | | -| struct_init.cpp:9:31:12:1 | Unary | Operand 'Unary' is used on instruction 'FieldAddress: {...}' in function '$@', but is defined on instruction 'PointerAdd: {...}' in function '$@'. | struct_init.cpp:9:13:9:25 | Info infos_in_file[] | Info infos_in_file[] | file://:0:0:0:0 | | | -| struct_init.cpp:9:31:12:1 | Unary | Operand 'Unary' is used on instruction 'FieldAddress: {...}' in function '$@', but is defined on instruction 'PointerAdd: {...}' in function '$@'. | struct_init.cpp:9:13:9:25 | Info infos_in_file[] | Info infos_in_file[] | file://:0:0:0:0 | | | instructionWithoutUniqueBlock containsLoopOfForwardEdges lostReachability @@ -27,10 +21,6 @@ notMarkedAsConflated wronglyMarkedAsConflated invalidOverlap nonUniqueEnclosingIRFunction -| struct_init.cpp:9:31:12:1 | Constant: {...} | Instruction 'Constant: {...}' has 0 results for `getEnclosingIRFunction()` in function '$@'. | file://:0:0:0:0 | | | -| struct_init.cpp:9:31:12:1 | Constant: {...} | Instruction 'Constant: {...}' has 0 results for `getEnclosingIRFunction()` in function '$@'. | file://:0:0:0:0 | | | -| struct_init.cpp:9:31:12:1 | PointerAdd: {...} | Instruction 'PointerAdd: {...}' has 0 results for `getEnclosingIRFunction()` in function '$@'. | file://:0:0:0:0 | | | -| struct_init.cpp:9:31:12:1 | PointerAdd: {...} | Instruction 'PointerAdd: {...}' has 0 results for `getEnclosingIRFunction()` in function '$@'. | file://:0:0:0:0 | | | fieldAddressOnNonPointer thisArgumentIsNonPointer missingCanonicalLanguageType diff --git a/cpp/ql/test/library-tests/ir/ssa/aliased_ssa_ir.expected b/cpp/ql/test/library-tests/ir/ssa/aliased_ssa_ir.expected index 147c10b7c7f..1893ab5c0d5 100644 --- a/cpp/ql/test/library-tests/ir/ssa/aliased_ssa_ir.expected +++ b/cpp/ql/test/library-tests/ir/ssa/aliased_ssa_ir.expected @@ -1234,6 +1234,8 @@ ssa.cpp: # 268| v268_14(void) = AliasedUse : ~m269_7 # 268| v268_15(void) = ExitFunction : +# 274| Point* pp + # 275| void EscapedButNotConflated(bool, Point, int) # 275| Block 0 # 275| v275_1(void) = EnterFunction : diff --git a/cpp/ql/test/library-tests/ir/ssa/aliased_ssa_ir_unsound.expected b/cpp/ql/test/library-tests/ir/ssa/aliased_ssa_ir_unsound.expected index 396b7532d68..faedd418ed2 100644 --- a/cpp/ql/test/library-tests/ir/ssa/aliased_ssa_ir_unsound.expected +++ b/cpp/ql/test/library-tests/ir/ssa/aliased_ssa_ir_unsound.expected @@ -1229,6 +1229,8 @@ ssa.cpp: # 268| v268_14(void) = AliasedUse : ~m269_7 # 268| v268_15(void) = ExitFunction : +# 274| Point* pp + # 275| void EscapedButNotConflated(bool, Point, int) # 275| Block 0 # 275| v275_1(void) = EnterFunction : diff --git a/cpp/ql/test/library-tests/ir/ssa/unaliased_ssa_ir.expected b/cpp/ql/test/library-tests/ir/ssa/unaliased_ssa_ir.expected index 3fc07bf6950..6d1e8f4d03d 100644 --- a/cpp/ql/test/library-tests/ir/ssa/unaliased_ssa_ir.expected +++ b/cpp/ql/test/library-tests/ir/ssa/unaliased_ssa_ir.expected @@ -1140,6 +1140,8 @@ ssa.cpp: # 268| v268_13(void) = AliasedUse : ~m? # 268| v268_14(void) = ExitFunction : +# 274| Point* pp + # 275| void EscapedButNotConflated(bool, Point, int) # 275| Block 0 # 275| v275_1(void) = EnterFunction : diff --git a/cpp/ql/test/library-tests/ir/ssa/unaliased_ssa_ir_unsound.expected b/cpp/ql/test/library-tests/ir/ssa/unaliased_ssa_ir_unsound.expected index 3fc07bf6950..6d1e8f4d03d 100644 --- a/cpp/ql/test/library-tests/ir/ssa/unaliased_ssa_ir_unsound.expected +++ b/cpp/ql/test/library-tests/ir/ssa/unaliased_ssa_ir_unsound.expected @@ -1140,6 +1140,8 @@ ssa.cpp: # 268| v268_13(void) = AliasedUse : ~m? # 268| v268_14(void) = ExitFunction : +# 274| Point* pp + # 275| void EscapedButNotConflated(bool, Point, int) # 275| Block 0 # 275| v275_1(void) = EnterFunction : From 32e128d207a14457e0068020ac4fd3669c0fbe36 Mon Sep 17 00:00:00 2001 From: Robert Marsh Date: Mon, 21 Mar 2022 16:01:53 -0400 Subject: [PATCH 06/19] C#: sync IR files --- .../ir/implementation/IRConfiguration.qll | 4 ++-- .../implementation/internal/IRFunctionBase.qll | 17 +++++++++++------ .../ir/implementation/raw/IRBlock.qll | 2 +- .../ir/implementation/raw/Instruction.qll | 2 +- .../ir/implementation/raw/PrintIR.qll | 8 ++++---- .../ir/implementation/unaliased_ssa/IRBlock.qll | 2 +- .../unaliased_ssa/Instruction.qll | 2 +- .../ir/implementation/unaliased_ssa/PrintIR.qll | 8 ++++---- 8 files changed, 25 insertions(+), 20 deletions(-) diff --git a/csharp/ql/src/experimental/ir/implementation/IRConfiguration.qll b/csharp/ql/src/experimental/ir/implementation/IRConfiguration.qll index 37ac2fccdd9..90cdb9e0f5f 100644 --- a/csharp/ql/src/experimental/ir/implementation/IRConfiguration.qll +++ b/csharp/ql/src/experimental/ir/implementation/IRConfiguration.qll @@ -16,7 +16,7 @@ class IRConfiguration extends TIRConfiguration { /** * Holds if IR should be created for function `func`. By default, holds for all functions. */ - predicate shouldCreateIRForFunction(Language::Function func) { any() } + predicate shouldCreateIRForFunction(Language::Declaration func) { any() } /** * Holds if the strings used as part of an IR dump should be generated for function `func`. @@ -25,7 +25,7 @@ class IRConfiguration extends TIRConfiguration { * of debug strings for IR that will not be dumped. We still generate the actual IR for these * functions, however, to preserve the results of any interprocedural analysis. */ - predicate shouldEvaluateDebugStringsForFunction(Language::Function func) { any() } + predicate shouldEvaluateDebugStringsForFunction(Language::Declaration func) { any() } } private newtype TIREscapeAnalysisConfiguration = MkIREscapeAnalysisConfiguration() diff --git a/csharp/ql/src/experimental/ir/implementation/internal/IRFunctionBase.qll b/csharp/ql/src/experimental/ir/implementation/internal/IRFunctionBase.qll index 60895ce3d26..576b4f9adf1 100644 --- a/csharp/ql/src/experimental/ir/implementation/internal/IRFunctionBase.qll +++ b/csharp/ql/src/experimental/ir/implementation/internal/IRFunctionBase.qll @@ -5,23 +5,28 @@ private import IRFunctionBaseInternal private newtype TIRFunction = - MkIRFunction(Language::Function func) { IRConstruction::Raw::functionHasIR(func) } + TFunctionIRFunction(Language::Function func) { IRConstruction::Raw::functionHasIR(func) } or + TVarInitIRFunction(Language::GlobalVariable var) { IRConstruction::Raw::varHasIRFunc(var) } /** * The IR for a function. This base class contains only the predicates that are the same between all * phases of the IR. Each instantiation of `IRFunction` extends this class. */ class IRFunctionBase extends TIRFunction { - Language::Function func; + Language::Declaration decl; - IRFunctionBase() { this = MkIRFunction(func) } + IRFunctionBase() { + this = TFunctionIRFunction(decl) + or + this = TVarInitIRFunction(decl) + } /** Gets a textual representation of this element. */ - final string toString() { result = "IR: " + func.toString() } + final string toString() { result = "IR: " + decl.toString() } /** Gets the function whose IR is represented. */ - final Language::Function getFunction() { result = func } + final Language::Declaration getFunction() { result = decl } /** Gets the location of the function. */ - final Language::Location getLocation() { result = func.getLocation() } + final Language::Location getLocation() { result = decl.getLocation() } } diff --git a/csharp/ql/src/experimental/ir/implementation/raw/IRBlock.qll b/csharp/ql/src/experimental/ir/implementation/raw/IRBlock.qll index 82db3146630..1ac76d57730 100644 --- a/csharp/ql/src/experimental/ir/implementation/raw/IRBlock.qll +++ b/csharp/ql/src/experimental/ir/implementation/raw/IRBlock.qll @@ -97,7 +97,7 @@ class IRBlockBase extends TIRBlock { /** * Gets the `Function` that contains this block. */ - final Language::Function getEnclosingFunction() { + final Language::Declaration getEnclosingFunction() { result = getFirstInstruction(this).getEnclosingFunction() } } diff --git a/csharp/ql/src/experimental/ir/implementation/raw/Instruction.qll b/csharp/ql/src/experimental/ir/implementation/raw/Instruction.qll index e5a908bbf9a..8e863ddf635 100644 --- a/csharp/ql/src/experimental/ir/implementation/raw/Instruction.qll +++ b/csharp/ql/src/experimental/ir/implementation/raw/Instruction.qll @@ -194,7 +194,7 @@ class Instruction extends Construction::TStageInstruction { /** * Gets the function that contains this instruction. */ - final Language::Function getEnclosingFunction() { + final Language::Declaration getEnclosingFunction() { result = this.getEnclosingIRFunction().getFunction() } diff --git a/csharp/ql/src/experimental/ir/implementation/raw/PrintIR.qll b/csharp/ql/src/experimental/ir/implementation/raw/PrintIR.qll index 59dadee7154..53cdc75512b 100644 --- a/csharp/ql/src/experimental/ir/implementation/raw/PrintIR.qll +++ b/csharp/ql/src/experimental/ir/implementation/raw/PrintIR.qll @@ -26,20 +26,20 @@ class PrintIRConfiguration extends TPrintIRConfiguration { * Holds if the IR for `func` should be printed. By default, holds for all * functions. */ - predicate shouldPrintFunction(Language::Function func) { any() } + predicate shouldPrintFunction(Language::Declaration decl) { any() } } /** * Override of `IRConfiguration` to only evaluate debug strings for the functions that are to be dumped. */ private class FilteredIRConfiguration extends IRConfiguration { - override predicate shouldEvaluateDebugStringsForFunction(Language::Function func) { + override predicate shouldEvaluateDebugStringsForFunction(Language::Declaration func) { shouldPrintFunction(func) } } -private predicate shouldPrintFunction(Language::Function func) { - exists(PrintIRConfiguration config | config.shouldPrintFunction(func)) +private predicate shouldPrintFunction(Language::Declaration decl) { + exists(PrintIRConfiguration config | config.shouldPrintFunction(decl)) } private string getAdditionalInstructionProperty(Instruction instr, string key) { diff --git a/csharp/ql/src/experimental/ir/implementation/unaliased_ssa/IRBlock.qll b/csharp/ql/src/experimental/ir/implementation/unaliased_ssa/IRBlock.qll index 82db3146630..1ac76d57730 100644 --- a/csharp/ql/src/experimental/ir/implementation/unaliased_ssa/IRBlock.qll +++ b/csharp/ql/src/experimental/ir/implementation/unaliased_ssa/IRBlock.qll @@ -97,7 +97,7 @@ class IRBlockBase extends TIRBlock { /** * Gets the `Function` that contains this block. */ - final Language::Function getEnclosingFunction() { + final Language::Declaration getEnclosingFunction() { result = getFirstInstruction(this).getEnclosingFunction() } } diff --git a/csharp/ql/src/experimental/ir/implementation/unaliased_ssa/Instruction.qll b/csharp/ql/src/experimental/ir/implementation/unaliased_ssa/Instruction.qll index e5a908bbf9a..8e863ddf635 100644 --- a/csharp/ql/src/experimental/ir/implementation/unaliased_ssa/Instruction.qll +++ b/csharp/ql/src/experimental/ir/implementation/unaliased_ssa/Instruction.qll @@ -194,7 +194,7 @@ class Instruction extends Construction::TStageInstruction { /** * Gets the function that contains this instruction. */ - final Language::Function getEnclosingFunction() { + final Language::Declaration getEnclosingFunction() { result = this.getEnclosingIRFunction().getFunction() } diff --git a/csharp/ql/src/experimental/ir/implementation/unaliased_ssa/PrintIR.qll b/csharp/ql/src/experimental/ir/implementation/unaliased_ssa/PrintIR.qll index 59dadee7154..53cdc75512b 100644 --- a/csharp/ql/src/experimental/ir/implementation/unaliased_ssa/PrintIR.qll +++ b/csharp/ql/src/experimental/ir/implementation/unaliased_ssa/PrintIR.qll @@ -26,20 +26,20 @@ class PrintIRConfiguration extends TPrintIRConfiguration { * Holds if the IR for `func` should be printed. By default, holds for all * functions. */ - predicate shouldPrintFunction(Language::Function func) { any() } + predicate shouldPrintFunction(Language::Declaration decl) { any() } } /** * Override of `IRConfiguration` to only evaluate debug strings for the functions that are to be dumped. */ private class FilteredIRConfiguration extends IRConfiguration { - override predicate shouldEvaluateDebugStringsForFunction(Language::Function func) { + override predicate shouldEvaluateDebugStringsForFunction(Language::Declaration func) { shouldPrintFunction(func) } } -private predicate shouldPrintFunction(Language::Function func) { - exists(PrintIRConfiguration config | config.shouldPrintFunction(func)) +private predicate shouldPrintFunction(Language::Declaration decl) { + exists(PrintIRConfiguration config | config.shouldPrintFunction(decl)) } private string getAdditionalInstructionProperty(Instruction instr, string key) { From 6be3db85751f106c6a2e0c6fe916a96e92289691 Mon Sep 17 00:00:00 2001 From: Robert Marsh Date: Tue, 22 Mar 2022 13:01:56 -0400 Subject: [PATCH 07/19] C++: update test expectations for extractor changes --- .../library-tests/ir/ir/PrintAST.expected | 4 +- .../ir/ir/operand_locations.expected | 15 +++++++ .../ir/ir/raw_consistency.expected | 2 - .../test/library-tests/ir/ir/raw_ir.expected | 39 +++++++++---------- 4 files changed, 36 insertions(+), 24 deletions(-) diff --git a/cpp/ql/test/library-tests/ir/ir/PrintAST.expected b/cpp/ql/test/library-tests/ir/ir/PrintAST.expected index 3c1f42f6de8..d4ce2f621bf 100644 --- a/cpp/ql/test/library-tests/ir/ir/PrintAST.expected +++ b/cpp/ql/test/library-tests/ir/ir/PrintAST.expected @@ -12842,9 +12842,9 @@ ir.cpp: # 1674| getDeclarationEntry(0): (no string representation) # 1674| Type = [ArrayType] int[2] # 1674| getVariable().getInitializer(): [Initializer] initializer for (unnamed local variable) -# 1674| getExpr(): (no string representation) +# 1674| getExpr(): [VariableAccess] xs # 1674| Type = [ArrayType] int[2] -# 1674| ValueCategory = prvalue +# 1674| ValueCategory = prvalue(load) # 1674| getDeclarationEntry(1): [VariableDeclarationEntry] definition of x0 # 1674| Type = [IntType] int #-----| getVariable().getInitializer(): [Initializer] initializer for x0 diff --git a/cpp/ql/test/library-tests/ir/ir/operand_locations.expected b/cpp/ql/test/library-tests/ir/ir/operand_locations.expected index 94eca27e9ab..a0cfe3bc9d1 100644 --- a/cpp/ql/test/library-tests/ir/ir/operand_locations.expected +++ b/cpp/ql/test/library-tests/ir/ir/operand_locations.expected @@ -684,7 +684,9 @@ | file://:0:0:0:0 | ChiTotal | total:m763_8 | | file://:0:0:0:0 | ChiTotal | total:m1043_10 | | file://:0:0:0:0 | ChiTotal | total:m1240_4 | +| file://:0:0:0:0 | Left | r0_2 | | file://:0:0:0:0 | Left | r0_4 | +| file://:0:0:0:0 | Left | r0_7 | | file://:0:0:0:0 | Left | r0_11 | | file://:0:0:0:0 | Load | m0_2 | | file://:0:0:0:0 | Load | m0_2 | @@ -696,7 +698,9 @@ | file://:0:0:0:0 | Load | m1466_4 | | file://:0:0:0:0 | Load | m1466_4 | | file://:0:0:0:0 | Load | ~m1444_6 | +| file://:0:0:0:0 | Right | r0_3 | | file://:0:0:0:0 | Right | r0_5 | +| file://:0:0:0:0 | Right | r0_8 | | file://:0:0:0:0 | Right | r0_12 | | file://:0:0:0:0 | SideEffect | m0_4 | | file://:0:0:0:0 | SideEffect | m0_4 | @@ -726,12 +730,15 @@ | file://:0:0:0:0 | StoreValue | r0_1 | | file://:0:0:0:0 | StoreValue | r0_1 | | file://:0:0:0:0 | StoreValue | r0_3 | +| file://:0:0:0:0 | StoreValue | r0_4 | | file://:0:0:0:0 | StoreValue | r0_6 | +| file://:0:0:0:0 | StoreValue | r0_9 | | file://:0:0:0:0 | StoreValue | r0_13 | | file://:0:0:0:0 | StoreValue | r0_13 | | file://:0:0:0:0 | StoreValue | r0_22 | | file://:0:0:0:0 | StoreValue | r0_22 | | file://:0:0:0:0 | Unary | r0_1 | +| file://:0:0:0:0 | Unary | r0_1 | | file://:0:0:0:0 | Unary | r0_2 | | file://:0:0:0:0 | Unary | r0_3 | | file://:0:0:0:0 | Unary | r0_5 | @@ -739,6 +746,7 @@ | file://:0:0:0:0 | Unary | r0_6 | | file://:0:0:0:0 | Unary | r0_6 | | file://:0:0:0:0 | Unary | r0_6 | +| file://:0:0:0:0 | Unary | r0_6 | | file://:0:0:0:0 | Unary | r0_7 | | file://:0:0:0:0 | Unary | r0_7 | | file://:0:0:0:0 | Unary | r0_7 | @@ -7447,6 +7455,7 @@ | ir.cpp:1668:17:1668:17 | StoreValue | r1668_4 | | ir.cpp:1672:6:1672:42 | ChiPartial | partial:m1672_3 | | ir.cpp:1672:6:1672:42 | ChiTotal | total:m1672_2 | +| ir.cpp:1672:6:1672:42 | SideEffect | m1672_3 | | ir.cpp:1673:9:1673:10 | Address | &:r1673_1 | | ir.cpp:1673:9:1673:10 | Left | r1673_1 | | ir.cpp:1673:9:1673:10 | Left | r1673_1 | @@ -7460,6 +7469,12 @@ | ir.cpp:1673:21:1673:21 | ChiPartial | partial:m1673_11 | | ir.cpp:1673:21:1673:21 | ChiTotal | total:m1673_7 | | ir.cpp:1673:21:1673:21 | StoreValue | r1673_10 | +| ir.cpp:1674:10:1674:10 | Address | &:r1674_1 | +| ir.cpp:1674:11:1674:11 | Address | &:r1674_5 | +| ir.cpp:1674:15:1674:15 | Address | &:r1674_6 | +| ir.cpp:1674:21:1674:22 | Address | &:r1674_2 | +| ir.cpp:1674:21:1674:22 | Load | m1673_12 | +| ir.cpp:1674:21:1674:22 | StoreValue | r1674_3 | | ir.cpp:1680:5:1680:23 | Address | &:r1680_5 | | ir.cpp:1680:5:1680:23 | Address | &:r1680_5 | | ir.cpp:1680:5:1680:23 | Address | &:r1680_7 | diff --git a/cpp/ql/test/library-tests/ir/ir/raw_consistency.expected b/cpp/ql/test/library-tests/ir/ir/raw_consistency.expected index e627bbb375f..52173741010 100644 --- a/cpp/ql/test/library-tests/ir/ir/raw_consistency.expected +++ b/cpp/ql/test/library-tests/ir/ir/raw_consistency.expected @@ -1,5 +1,4 @@ missingOperand -| ir.cpp:1674:21:1674:22 | Load: Unknown literal | Instruction 'Load' is missing an expected operand with tag 'Address' in function '$@'. | ir.cpp:1672:6:1672:42 | void array_structured_binding_non_ref_init() | void array_structured_binding_non_ref_init() | | ir.cpp:1688:24:1690:5 | Store: Unknown literal | Instruction 'Store' is missing an expected operand with tag 'StoreValue' in function '$@'. | ir.cpp:1683:6:1683:20 | void captured_lambda(int, int&, int&&) | void captured_lambda(int, int&, int&&) | | ir.cpp:1688:24:1690:5 | Store: Unknown literal | Instruction 'Store' is missing an expected operand with tag 'StoreValue' in function '$@'. | ir.cpp:1683:6:1683:20 | void captured_lambda(int, int&, int&&) | void captured_lambda(int, int&, int&&) | | ir.cpp:1689:28:1689:54 | Store: Unknown literal | Instruction 'Store' is missing an expected operand with tag 'StoreValue' in function '$@'. | ir.cpp:1688:46:1688:46 | void (void captured_lambda(int, int&, int&&))::(lambda [] type at line 1688, col. 25)::operator()() const | void (void captured_lambda(int, int&, int&&))::(lambda [] type at line 1688, col. 25)::operator()() const | @@ -27,7 +26,6 @@ lostReachability backEdgeCountMismatch useNotDominatedByDefinition | ir.cpp:1486:8:1486:8 | Unary | Operand 'Unary' is not dominated by its definition in function '$@'. | ir.cpp:1486:8:1486:8 | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct() | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct() | -| ir.cpp:1674:10:1674:10 | Address | Operand 'Address' is not dominated by its definition in function '$@'. | ir.cpp:1672:6:1672:42 | void array_structured_binding_non_ref_init() | void array_structured_binding_non_ref_init() | | ir.cpp:1683:34:1683:34 | Address | Operand 'Address' is not dominated by its definition in function '$@'. | ir.cpp:1683:6:1683:20 | void captured_lambda(int, int&, int&&) | void captured_lambda(int, int&, int&&) | | ir.cpp:1683:43:1683:43 | Address | Operand 'Address' is not dominated by its definition in function '$@'. | ir.cpp:1683:6:1683:20 | void captured_lambda(int, int&, int&&) | void captured_lambda(int, int&, int&&) | | ir.cpp:1688:10:1688:21 | Address | Operand 'Address' is not dominated by its definition in function '$@'. | ir.cpp:1683:6:1683:20 | void captured_lambda(int, int&, int&&) | void captured_lambda(int, int&, int&&) | diff --git a/cpp/ql/test/library-tests/ir/ir/raw_ir.expected b/cpp/ql/test/library-tests/ir/ir/raw_ir.expected index 2a3f91863dd..3325148a280 100644 --- a/cpp/ql/test/library-tests/ir/ir/raw_ir.expected +++ b/cpp/ql/test/library-tests/ir/ir/raw_ir.expected @@ -8695,26 +8695,25 @@ ir.cpp: # 1673| r1673_9(int) = Constant[2] : # 1673| mu1673_10(int) = Store[?] : &:r1673_8, r1673_9 # 1674| r1674_1(glval) = VariableAddress[(unnamed local variable)] : - -# 1674| Block 1 -# 1674| r1674_2(int[2]) = Load : ~m? -# 1674| mu1674_3(int[2]) = Store[(unnamed local variable)] : &:r1674_1, r1674_2 -# 1674| r1674_4(glval) = VariableAddress[x0] : -#-----| r0_1(glval) = VariableAddress[(unnamed local variable)] : -#-----| r0_2(int *) = Convert : r0_1 -#-----| r0_3(unsigned long) = Constant[0] : -#-----| r0_4(glval) = PointerAdd[4] : r0_2, r0_3 -#-----| mu0_5(int &) = Store[x0] : &:r1674_4, r0_4 -# 1674| r1674_5(glval) = VariableAddress[x1] : -#-----| r0_6(glval) = VariableAddress[(unnamed local variable)] : -#-----| r0_7(int *) = Convert : r0_6 -#-----| r0_8(unsigned long) = Constant[1] : -#-----| r0_9(glval) = PointerAdd[4] : r0_7, r0_8 -#-----| mu0_10(int &) = Store[x1] : &:r1674_5, r0_9 -# 1675| v1675_1(void) = NoOp : -# 1672| v1672_4(void) = ReturnVoid : -# 1672| v1672_5(void) = AliasedUse : ~m? -# 1672| v1672_6(void) = ExitFunction : +# 1674| r1674_2(glval) = VariableAddress[xs] : +# 1674| r1674_3(int[2]) = Load[xs] : &:r1674_2, ~m? +# 1674| mu1674_4(int[2]) = Store[(unnamed local variable)] : &:r1674_1, r1674_3 +# 1674| r1674_5(glval) = VariableAddress[x0] : +#-----| r0_1(glval) = VariableAddress[(unnamed local variable)] : +#-----| r0_2(int *) = Convert : r0_1 +#-----| r0_3(unsigned long) = Constant[0] : +#-----| r0_4(glval) = PointerAdd[4] : r0_2, r0_3 +#-----| mu0_5(int &) = Store[x0] : &:r1674_5, r0_4 +# 1674| r1674_6(glval) = VariableAddress[x1] : +#-----| r0_6(glval) = VariableAddress[(unnamed local variable)] : +#-----| r0_7(int *) = Convert : r0_6 +#-----| r0_8(unsigned long) = Constant[1] : +#-----| r0_9(glval) = PointerAdd[4] : r0_7, r0_8 +#-----| mu0_10(int &) = Store[x1] : &:r1674_6, r0_9 +# 1675| v1675_1(void) = NoOp : +# 1672| v1672_4(void) = ReturnVoid : +# 1672| v1672_5(void) = AliasedUse : ~m? +# 1672| v1672_6(void) = ExitFunction : # 1680| void CapturedLambdaMyObj::CapturedLambdaMyObj() # 1680| Block 0 From 12ccf3662a4ea3809e36f891df2dfd418d8a119f Mon Sep 17 00:00:00 2001 From: Robert Marsh Date: Tue, 22 Mar 2022 13:22:37 -0400 Subject: [PATCH 08/19] C#: match IR global variable changes --- .../ir/implementation/raw/internal/IRConstruction.qll | 3 +++ .../ql/src/experimental/ir/internal/IRCSharpLanguage.qll | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/csharp/ql/src/experimental/ir/implementation/raw/internal/IRConstruction.qll b/csharp/ql/src/experimental/ir/implementation/raw/internal/IRConstruction.qll index 032026e7969..b5b007a64d2 100644 --- a/csharp/ql/src/experimental/ir/implementation/raw/internal/IRConstruction.qll +++ b/csharp/ql/src/experimental/ir/implementation/raw/internal/IRConstruction.qll @@ -47,6 +47,9 @@ module Raw { cached predicate functionHasIR(Callable callable) { exists(getTranslatedFunction(callable)) } + cached + predicate varHasIRFunc(Field field) { none() } + cached predicate hasInstruction(TranslatedElement element, InstructionTag tag) { element.hasInstruction(_, tag, _) diff --git a/csharp/ql/src/experimental/ir/internal/IRCSharpLanguage.qll b/csharp/ql/src/experimental/ir/internal/IRCSharpLanguage.qll index 88c27315c2f..aa3983014a7 100644 --- a/csharp/ql/src/experimental/ir/internal/IRCSharpLanguage.qll +++ b/csharp/ql/src/experimental/ir/internal/IRCSharpLanguage.qll @@ -8,6 +8,14 @@ class OpaqueTypeTag = CSharp::ValueOrRefType; class Function = CSharp::Callable; +class GlobalVariable extends CSharp::Field { + GlobalVariable() { + this.isStatic() + } +} + +class Declaration = CSharp::Declaration; + class Location = CSharp::Location; class UnknownLocation = CSharp::EmptyLocation; From 5811d0b2adf61d3a2a3ba3888bcdd02570effcf1 Mon Sep 17 00:00:00 2001 From: Robert Marsh Date: Mon, 28 Mar 2022 14:53:43 -0400 Subject: [PATCH 09/19] C++: add AliasedDefinition to IR global var inits --- .../raw/internal/TranslatedGlobalVar.qll | 42 ++++++++--- .../ir/ir/aliased_ssa_consistency.expected | 12 ---- .../aliased_ssa_consistency_unsound.expected | 12 ---- .../ir/ir/operand_locations.expected | 56 ++++++++------- .../test/library-tests/ir/ir/raw_ir.expected | 70 +++++++++++-------- 5 files changed, 101 insertions(+), 91 deletions(-) diff --git a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedGlobalVar.qll b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedGlobalVar.qll index e600e86bb5a..359dc9ee476 100644 --- a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedGlobalVar.qll +++ b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedGlobalVar.qll @@ -32,6 +32,10 @@ class TranslatedGlobalOrNamespaceVarInit extends TranslatedInstructionContainer, tag = EnterFunctionTag() and type = getVoidType() or + op instanceof Opcode::AliasedDefinition and + tag = AliasedDefinitionTag() and + type = getUnknownType() + or op instanceof Opcode::VariableAddress and tag = InitializerVariableAddressTag() and type = getTypeForGLValue(var.getType()) @@ -40,23 +44,33 @@ class TranslatedGlobalOrNamespaceVarInit extends TranslatedInstructionContainer, tag = ReturnTag() and type = getVoidType() or + op instanceof Opcode::AliasedUse and + tag = AliasedUseTag() and + type = getVoidType() + or op instanceof Opcode::ExitFunction and tag = ExitFunctionTag() and type = getVoidType() } override Instruction getInstructionSuccessor(InstructionTag tag, EdgeKind kind) { - tag = EnterFunctionTag() and kind instanceof GotoEdge and - result = getInstruction(InitializerVariableAddressTag()) - or - tag = InitializerVariableAddressTag() and - kind instanceof GotoEdge and - result = getChild(1).getFirstInstruction() - or - tag = ReturnTag() and - kind instanceof GotoEdge and - result = getInstruction(ExitFunctionTag()) + ( + tag = EnterFunctionTag() and + result = getInstruction(AliasedDefinitionTag()) + or + tag = AliasedDefinitionTag() and + result = getInstruction(InitializerVariableAddressTag()) + or + tag = InitializerVariableAddressTag() and + result = getChild(1).getFirstInstruction() + or + tag = ReturnTag() and + result = getInstruction(AliasedUseTag()) + or + tag = AliasedUseTag() and + result = getInstruction(ExitFunctionTag()) + ) } override Instruction getChildSuccessor(TranslatedElement child) { @@ -64,6 +78,14 @@ class TranslatedGlobalOrNamespaceVarInit extends TranslatedInstructionContainer, result = getInstruction(ReturnTag()) } + final override CppType getInstructionMemoryOperandType( + InstructionTag tag, TypedOperandTag operandTag + ) { + tag = AliasedUseTag() and + operandTag instanceof SideEffectOperandTag and + result = getUnknownType() + } + override IRUserVariable getInstructionVariable(InstructionTag tag) { tag = InitializerVariableAddressTag() and result.getVariable() = var diff --git a/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency.expected b/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency.expected index 2c57b9ae8a4..b131121438c 100644 --- a/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency.expected +++ b/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency.expected @@ -3,10 +3,6 @@ unexpectedOperand duplicateOperand missingPhiOperand missingOperandType -| ir.cpp:1038:12:1038:18 | ChiTotal | Operand 'ChiTotal' of instruction 'Chi' is missing a type in function '$@'. | ir.cpp:1038:6:1038:8 | (lambda [] type at line 1038, col. 12) lam | (lambda [] type at line 1038, col. 12) lam | -| ir.cpp:1695:16:1695:16 | ChiTotal | Operand 'ChiTotal' of instruction 'Chi' is missing a type in function '$@'. | ir.cpp:1695:5:1695:12 | int global_2 | int global_2 | -| ir.cpp:1697:22:1697:22 | ChiTotal | Operand 'ChiTotal' of instruction 'Chi' is missing a type in function '$@'. | ir.cpp:1697:11:1697:18 | int const global_3 | int const global_3 | -| struct_init.cpp:10:7:10:9 | ChiTotal | Operand 'ChiTotal' of instruction 'Chi' is missing a type in function '$@'. | struct_init.cpp:9:13:9:25 | Info infos_in_file[] | Info infos_in_file[] | duplicateChiOperand sideEffectWithoutPrimary instructionWithoutSuccessor @@ -25,14 +21,6 @@ useNotDominatedByDefinition switchInstructionWithoutDefaultEdge notMarkedAsConflated wronglyMarkedAsConflated -| ir.cpp:1038:12:1038:18 | Chi: [...](...){...} | Instruction 'Chi: [...](...){...}' should not be marked as having a conflated result in function '$@'. | ir.cpp:1038:6:1038:8 | (lambda [] type at line 1038, col. 12) lam | (lambda [] type at line 1038, col. 12) lam | -| ir.cpp:1038:12:1038:18 | Chi: [...](...){...} | Instruction 'Chi: [...](...){...}' should not be marked as having a conflated result in function '$@'. | ir.cpp:1038:6:1038:8 | (lambda [] type at line 1038, col. 12) lam | (lambda [] type at line 1038, col. 12) lam | -| ir.cpp:1695:16:1695:16 | Chi: 1 | Instruction 'Chi: 1' should not be marked as having a conflated result in function '$@'. | ir.cpp:1695:5:1695:12 | int global_2 | int global_2 | -| ir.cpp:1697:22:1697:22 | Chi: 2 | Instruction 'Chi: 2' should not be marked as having a conflated result in function '$@'. | ir.cpp:1697:11:1697:18 | int const global_3 | int const global_3 | -| struct_init.cpp:10:7:10:9 | Chi: array to pointer conversion | Instruction 'Chi: array to pointer conversion' should not be marked as having a conflated result in function '$@'. | struct_init.cpp:9:13:9:25 | Info infos_in_file[] | Info infos_in_file[] | -| struct_init.cpp:10:12:10:19 | Chi: handler1 | Instruction 'Chi: handler1' should not be marked as having a conflated result in function '$@'. | struct_init.cpp:9:13:9:25 | Info infos_in_file[] | Info infos_in_file[] | -| struct_init.cpp:11:7:11:9 | Chi: array to pointer conversion | Instruction 'Chi: array to pointer conversion' should not be marked as having a conflated result in function '$@'. | struct_init.cpp:9:13:9:25 | Info infos_in_file[] | Info infos_in_file[] | -| struct_init.cpp:11:12:11:20 | Chi: & ... | Instruction 'Chi: & ...' should not be marked as having a conflated result in function '$@'. | struct_init.cpp:9:13:9:25 | Info infos_in_file[] | Info infos_in_file[] | invalidOverlap nonUniqueEnclosingIRFunction fieldAddressOnNonPointer diff --git a/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency_unsound.expected b/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency_unsound.expected index 2c57b9ae8a4..b131121438c 100644 --- a/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency_unsound.expected +++ b/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency_unsound.expected @@ -3,10 +3,6 @@ unexpectedOperand duplicateOperand missingPhiOperand missingOperandType -| ir.cpp:1038:12:1038:18 | ChiTotal | Operand 'ChiTotal' of instruction 'Chi' is missing a type in function '$@'. | ir.cpp:1038:6:1038:8 | (lambda [] type at line 1038, col. 12) lam | (lambda [] type at line 1038, col. 12) lam | -| ir.cpp:1695:16:1695:16 | ChiTotal | Operand 'ChiTotal' of instruction 'Chi' is missing a type in function '$@'. | ir.cpp:1695:5:1695:12 | int global_2 | int global_2 | -| ir.cpp:1697:22:1697:22 | ChiTotal | Operand 'ChiTotal' of instruction 'Chi' is missing a type in function '$@'. | ir.cpp:1697:11:1697:18 | int const global_3 | int const global_3 | -| struct_init.cpp:10:7:10:9 | ChiTotal | Operand 'ChiTotal' of instruction 'Chi' is missing a type in function '$@'. | struct_init.cpp:9:13:9:25 | Info infos_in_file[] | Info infos_in_file[] | duplicateChiOperand sideEffectWithoutPrimary instructionWithoutSuccessor @@ -25,14 +21,6 @@ useNotDominatedByDefinition switchInstructionWithoutDefaultEdge notMarkedAsConflated wronglyMarkedAsConflated -| ir.cpp:1038:12:1038:18 | Chi: [...](...){...} | Instruction 'Chi: [...](...){...}' should not be marked as having a conflated result in function '$@'. | ir.cpp:1038:6:1038:8 | (lambda [] type at line 1038, col. 12) lam | (lambda [] type at line 1038, col. 12) lam | -| ir.cpp:1038:12:1038:18 | Chi: [...](...){...} | Instruction 'Chi: [...](...){...}' should not be marked as having a conflated result in function '$@'. | ir.cpp:1038:6:1038:8 | (lambda [] type at line 1038, col. 12) lam | (lambda [] type at line 1038, col. 12) lam | -| ir.cpp:1695:16:1695:16 | Chi: 1 | Instruction 'Chi: 1' should not be marked as having a conflated result in function '$@'. | ir.cpp:1695:5:1695:12 | int global_2 | int global_2 | -| ir.cpp:1697:22:1697:22 | Chi: 2 | Instruction 'Chi: 2' should not be marked as having a conflated result in function '$@'. | ir.cpp:1697:11:1697:18 | int const global_3 | int const global_3 | -| struct_init.cpp:10:7:10:9 | Chi: array to pointer conversion | Instruction 'Chi: array to pointer conversion' should not be marked as having a conflated result in function '$@'. | struct_init.cpp:9:13:9:25 | Info infos_in_file[] | Info infos_in_file[] | -| struct_init.cpp:10:12:10:19 | Chi: handler1 | Instruction 'Chi: handler1' should not be marked as having a conflated result in function '$@'. | struct_init.cpp:9:13:9:25 | Info infos_in_file[] | Info infos_in_file[] | -| struct_init.cpp:11:7:11:9 | Chi: array to pointer conversion | Instruction 'Chi: array to pointer conversion' should not be marked as having a conflated result in function '$@'. | struct_init.cpp:9:13:9:25 | Info infos_in_file[] | Info infos_in_file[] | -| struct_init.cpp:11:12:11:20 | Chi: & ... | Instruction 'Chi: & ...' should not be marked as having a conflated result in function '$@'. | struct_init.cpp:9:13:9:25 | Info infos_in_file[] | Info infos_in_file[] | invalidOverlap nonUniqueEnclosingIRFunction fieldAddressOnNonPointer diff --git a/cpp/ql/test/library-tests/ir/ir/operand_locations.expected b/cpp/ql/test/library-tests/ir/ir/operand_locations.expected index a0cfe3bc9d1..205ffaab2c5 100644 --- a/cpp/ql/test/library-tests/ir/ir/operand_locations.expected +++ b/cpp/ql/test/library-tests/ir/ir/operand_locations.expected @@ -4666,15 +4666,16 @@ | ir.cpp:1034:6:1034:20 | ChiTotal | total:m1034_2 | | ir.cpp:1034:6:1034:20 | SideEffect | m1034_3 | | ir.cpp:1035:15:1035:15 | Address | &:r1035_1 | -| ir.cpp:1038:6:1038:8 | Address | &:r1038_2 | -| ir.cpp:1038:12:1038:18 | Address | &:r1038_3 | -| ir.cpp:1038:12:1038:18 | Address | &:r1038_3 | -| ir.cpp:1038:12:1038:18 | ChiPartial | partial:m1038_4 | -| ir.cpp:1038:12:1038:18 | ChiPartial | partial:m1038_7 | -| ir.cpp:1038:12:1038:18 | ChiTotal | total:m1038_5 | -| ir.cpp:1038:12:1038:18 | ChiTotal | total:~m? | -| ir.cpp:1038:12:1038:18 | Load | ~m1038_5 | -| ir.cpp:1038:12:1038:18 | StoreValue | r1038_6 | +| ir.cpp:1038:6:1038:8 | Address | &:r1038_3 | +| ir.cpp:1038:6:1038:8 | SideEffect | ~m1038_9 | +| ir.cpp:1038:12:1038:18 | Address | &:r1038_4 | +| ir.cpp:1038:12:1038:18 | Address | &:r1038_4 | +| ir.cpp:1038:12:1038:18 | ChiPartial | partial:m1038_5 | +| ir.cpp:1038:12:1038:18 | ChiPartial | partial:m1038_8 | +| ir.cpp:1038:12:1038:18 | ChiTotal | total:m1038_2 | +| ir.cpp:1038:12:1038:18 | ChiTotal | total:m1038_6 | +| ir.cpp:1038:12:1038:18 | Load | ~m1038_6 | +| ir.cpp:1038:12:1038:18 | StoreValue | r1038_7 | | ir.cpp:1038:14:1038:14 | Address | &:r1038_5 | | ir.cpp:1038:14:1038:14 | Address | &:r1038_5 | | ir.cpp:1038:14:1038:14 | Address | &:r1038_5 | @@ -7536,14 +7537,16 @@ | ir.cpp:1689:50:1689:50 | Load | m1689_6 | | ir.cpp:1689:50:1689:50 | SideEffect | m1689_3 | | ir.cpp:1689:50:1689:50 | SideEffect | m1689_8 | -| ir.cpp:1695:5:1695:12 | Address | &:r1695_2 | -| ir.cpp:1695:16:1695:16 | ChiPartial | partial:m1695_4 | -| ir.cpp:1695:16:1695:16 | ChiTotal | total:~m? | -| ir.cpp:1695:16:1695:16 | StoreValue | r1695_3 | -| ir.cpp:1697:11:1697:18 | Address | &:r1697_2 | -| ir.cpp:1697:22:1697:22 | ChiPartial | partial:m1697_4 | -| ir.cpp:1697:22:1697:22 | ChiTotal | total:~m? | -| ir.cpp:1697:22:1697:22 | StoreValue | r1697_3 | +| ir.cpp:1695:5:1695:12 | Address | &:r1695_3 | +| ir.cpp:1695:5:1695:12 | SideEffect | ~m1695_6 | +| ir.cpp:1695:16:1695:16 | ChiPartial | partial:m1695_5 | +| ir.cpp:1695:16:1695:16 | ChiTotal | total:m1695_2 | +| ir.cpp:1695:16:1695:16 | StoreValue | r1695_4 | +| ir.cpp:1697:11:1697:18 | Address | &:r1697_3 | +| ir.cpp:1697:11:1697:18 | SideEffect | ~m1697_6 | +| ir.cpp:1697:22:1697:22 | ChiPartial | partial:m1697_5 | +| ir.cpp:1697:22:1697:22 | ChiTotal | total:m1697_2 | +| ir.cpp:1697:22:1697:22 | StoreValue | r1697_4 | | perf-regression.cpp:6:3:6:5 | Address | &:r6_5 | | perf-regression.cpp:6:3:6:5 | Address | &:r6_5 | | perf-regression.cpp:6:3:6:5 | Address | &:r6_7 | @@ -7787,18 +7790,19 @@ | smart_ptr.cpp:47:43:47:63 | SideEffect | ~m47_16 | | smart_ptr.cpp:47:43:47:63 | Unary | r47_5 | | smart_ptr.cpp:47:43:47:63 | Unary | r47_6 | -| struct_init.cpp:9:13:9:25 | Left | r9_2 | -| struct_init.cpp:9:13:9:25 | Left | r9_2 | -| struct_init.cpp:9:31:12:1 | Right | r9_3 | -| struct_init.cpp:9:31:12:1 | Right | r9_5 | -| struct_init.cpp:9:31:12:1 | Unary | r9_4 | -| struct_init.cpp:9:31:12:1 | Unary | r9_4 | -| struct_init.cpp:9:31:12:1 | Unary | r9_6 | -| struct_init.cpp:9:31:12:1 | Unary | r9_6 | +| struct_init.cpp:9:13:9:25 | Left | r9_3 | +| struct_init.cpp:9:13:9:25 | Left | r9_3 | +| struct_init.cpp:9:13:9:25 | SideEffect | ~m11_10 | +| struct_init.cpp:9:31:12:1 | Right | r9_4 | +| struct_init.cpp:9:31:12:1 | Right | r9_6 | +| struct_init.cpp:9:31:12:1 | Unary | r9_5 | +| struct_init.cpp:9:31:12:1 | Unary | r9_5 | +| struct_init.cpp:9:31:12:1 | Unary | r9_7 | +| struct_init.cpp:9:31:12:1 | Unary | r9_7 | | struct_init.cpp:10:5:10:21 | Address | &:r10_1 | | struct_init.cpp:10:5:10:21 | Address | &:r10_6 | | struct_init.cpp:10:7:10:9 | ChiPartial | partial:m10_4 | -| struct_init.cpp:10:7:10:9 | ChiTotal | total:~m? | +| struct_init.cpp:10:7:10:9 | ChiTotal | total:m9_2 | | struct_init.cpp:10:7:10:9 | StoreValue | r10_3 | | struct_init.cpp:10:7:10:9 | Unary | r10_2 | | struct_init.cpp:10:12:10:19 | ChiPartial | partial:m10_8 | diff --git a/cpp/ql/test/library-tests/ir/ir/raw_ir.expected b/cpp/ql/test/library-tests/ir/ir/raw_ir.expected index 3325148a280..683101f8622 100644 --- a/cpp/ql/test/library-tests/ir/ir/raw_ir.expected +++ b/cpp/ql/test/library-tests/ir/ir/raw_ir.expected @@ -5622,14 +5622,16 @@ ir.cpp: # 1038| (lambda [] type at line 1038, col. 12) lam # 1038| Block 0 -# 1038| v1038_1(void) = EnterFunction : -# 1038| r1038_2(glval) = VariableAddress : -# 1038| r1038_3(glval) = VariableAddress : -# 1038| mu1038_4(decltype([...](...){...})) = Uninitialized : &:r1038_3 -# 1038| r1038_5(decltype([...](...){...})) = Load[?] : &:r1038_3, ~m? -# 1038| mu1038_6(decltype([...](...){...})) = Store[?] : &:r1038_2, r1038_5 -# 1038| v1038_7(void) = ReturnVoid : -# 1038| v1038_8(void) = ExitFunction : +# 1038| v1038_1(void) = EnterFunction : +# 1038| mu1038_2(unknown) = AliasedDefinition : +# 1038| r1038_3(glval) = VariableAddress : +# 1038| r1038_4(glval) = VariableAddress : +# 1038| mu1038_5(decltype([...](...){...})) = Uninitialized : &:r1038_4 +# 1038| r1038_6(decltype([...](...){...})) = Load[?] : &:r1038_4, ~m? +# 1038| mu1038_7(decltype([...](...){...})) = Store[?] : &:r1038_3, r1038_6 +# 1038| v1038_8(void) = ReturnVoid : +# 1038| v1038_9(void) = AliasedUse : ~m? +# 1038| v1038_10(void) = ExitFunction : # 1038| void (lambda [] type at line 1038, col. 12)::operator()() const # 1038| Block 0 @@ -8861,21 +8863,25 @@ ir.cpp: # 1695| int global_2 # 1695| Block 0 -# 1695| v1695_1(void) = EnterFunction : -# 1695| r1695_2(glval) = VariableAddress : -# 1695| r1695_3(int) = Constant[1] : -# 1695| mu1695_4(int) = Store[?] : &:r1695_2, r1695_3 -# 1695| v1695_5(void) = ReturnVoid : -# 1695| v1695_6(void) = ExitFunction : +# 1695| v1695_1(void) = EnterFunction : +# 1695| mu1695_2(unknown) = AliasedDefinition : +# 1695| r1695_3(glval) = VariableAddress : +# 1695| r1695_4(int) = Constant[1] : +# 1695| mu1695_5(int) = Store[?] : &:r1695_3, r1695_4 +# 1695| v1695_6(void) = ReturnVoid : +# 1695| v1695_7(void) = AliasedUse : ~m? +# 1695| v1695_8(void) = ExitFunction : # 1697| int const global_3 # 1697| Block 0 -# 1697| v1697_1(void) = EnterFunction : -# 1697| r1697_2(glval) = VariableAddress : -# 1697| r1697_3(int) = Constant[2] : -# 1697| mu1697_4(int) = Store[?] : &:r1697_2, r1697_3 -# 1697| v1697_5(void) = ReturnVoid : -# 1697| v1697_6(void) = ExitFunction : +# 1697| v1697_1(void) = EnterFunction : +# 1697| mu1697_2(unknown) = AliasedDefinition : +# 1697| r1697_3(glval) = VariableAddress : +# 1697| r1697_4(int) = Constant[2] : +# 1697| mu1697_5(int) = Store[?] : &:r1697_3, r1697_4 +# 1697| v1697_6(void) = ReturnVoid : +# 1697| v1697_7(void) = AliasedUse : ~m? +# 1697| v1697_8(void) = ExitFunction : perf-regression.cpp: # 6| void Big::Big() @@ -9101,28 +9107,30 @@ struct_init.cpp: # 9| Info infos_in_file[] # 9| Block 0 # 9| v9_1(void) = EnterFunction : -# 9| r9_2(glval) = VariableAddress : -# 9| r9_3(int) = Constant[0] : -# 9| r9_4(glval) = PointerAdd[16] : r9_2, r9_3 -# 10| r10_1(glval) = FieldAddress[name] : r9_4 +# 9| mu9_2(unknown) = AliasedDefinition : +# 9| r9_3(glval) = VariableAddress : +# 9| r9_4(int) = Constant[0] : +# 9| r9_5(glval) = PointerAdd[16] : r9_3, r9_4 +# 10| r10_1(glval) = FieldAddress[name] : r9_5 # 10| r10_2(glval) = StringConstant : # 10| r10_3(char *) = Convert : r10_2 # 10| mu10_4(char *) = Store[?] : &:r10_1, r10_3 -# 10| r10_5(glval<..(*)(..)>) = FieldAddress[handler] : r9_4 +# 10| r10_5(glval<..(*)(..)>) = FieldAddress[handler] : r9_5 # 10| r10_6(..(*)(..)) = FunctionAddress[handler1] : # 10| mu10_7(..(*)(..)) = Store[?] : &:r10_5, r10_6 -# 9| r9_5(int) = Constant[1] : -# 9| r9_6(glval) = PointerAdd[16] : r9_2, r9_5 -# 11| r11_1(glval) = FieldAddress[name] : r9_6 +# 9| r9_6(int) = Constant[1] : +# 9| r9_7(glval) = PointerAdd[16] : r9_3, r9_6 +# 11| r11_1(glval) = FieldAddress[name] : r9_7 # 11| r11_2(glval) = StringConstant : # 11| r11_3(char *) = Convert : r11_2 # 11| mu11_4(char *) = Store[?] : &:r11_1, r11_3 -# 11| r11_5(glval<..(*)(..)>) = FieldAddress[handler] : r9_6 +# 11| r11_5(glval<..(*)(..)>) = FieldAddress[handler] : r9_7 # 11| r11_6(glval<..()(..)>) = FunctionAddress[handler2] : # 11| r11_7(..(*)(..)) = CopyValue : r11_6 # 11| mu11_8(..(*)(..)) = Store[?] : &:r11_5, r11_7 -# 9| v9_7(void) = ReturnVoid : -# 9| v9_8(void) = ExitFunction : +# 9| v9_8(void) = ReturnVoid : +# 9| v9_9(void) = AliasedUse : ~m? +# 9| v9_10(void) = ExitFunction : # 14| Info* global_pointer From af6a4f31e797d8888b074a7cc9f59b53d38e1fee Mon Sep 17 00:00:00 2001 From: Robert Marsh Date: Mon, 28 Mar 2022 15:20:48 -0400 Subject: [PATCH 10/19] C++: TranslatedInstructionContainer to RootElement --- .../ir/implementation/raw/internal/TranslatedElement.qll | 7 +++++-- .../cpp/ir/implementation/raw/internal/TranslatedExpr.qll | 2 +- .../ir/implementation/raw/internal/TranslatedFunction.qll | 2 +- .../ir/implementation/raw/internal/TranslatedGlobalVar.qll | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedElement.qll b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedElement.qll index a8c4e269a7d..87669bb12a6 100644 --- a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedElement.qll +++ b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedElement.qll @@ -953,8 +953,11 @@ abstract class TranslatedElement extends TTranslatedElement { final TranslatedElement getParent() { result.getAChild() = this } } -abstract class TranslatedInstructionContainer extends TranslatedElement { - TranslatedInstructionContainer() { +/** + * Represents the IR translation of a root element, either a function or a global variable. + */ +abstract class TranslatedRootElement extends TranslatedElement { + TranslatedRootElement() { this instanceof TTranslatedFunction or this instanceof TTranslatedGlobalOrNamespaceVarInit diff --git a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedExpr.qll b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedExpr.qll index 8dcfa174d43..87b79de1c33 100644 --- a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedExpr.qll +++ b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedExpr.qll @@ -93,7 +93,7 @@ abstract class TranslatedExpr extends TranslatedElement { /** * Gets the `TranslatedFunction` containing this expression. */ - final TranslatedInstructionContainer getEnclosingFunction() { + final TranslatedRootElement getEnclosingFunction() { result = getTranslatedFunction(expr.getEnclosingFunction()) or result = getTranslatedVarInit(expr.getEnclosingVariable()) diff --git a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedFunction.qll b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedFunction.qll index 1e2aca25336..b4746ae58de 100644 --- a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedFunction.qll +++ b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedFunction.qll @@ -58,7 +58,7 @@ predicate hasReturnValue(Function func) { not func.getUnspecifiedType() instance * Represents the IR translation of a function. This is the root elements for * all other elements associated with this function. */ -class TranslatedFunction extends TranslatedInstructionContainer, TTranslatedFunction { +class TranslatedFunction extends TranslatedRootElement, TTranslatedFunction { Function func; TranslatedFunction() { this = TTranslatedFunction(func) } diff --git a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedGlobalVar.qll b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedGlobalVar.qll index 359dc9ee476..af02b882386 100644 --- a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedGlobalVar.qll +++ b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedGlobalVar.qll @@ -7,7 +7,7 @@ private import semmle.code.cpp.ir.internal.CppType private import TranslatedInitialization private import InstructionTag -class TranslatedGlobalOrNamespaceVarInit extends TranslatedInstructionContainer, +class TranslatedGlobalOrNamespaceVarInit extends TranslatedRootElement, TTranslatedGlobalOrNamespaceVarInit, InitializationContext { GlobalOrNamespaceVariable var; From 9442be1a27b3589d1ead8164d35693f62be7ba67 Mon Sep 17 00:00:00 2001 From: Robert Marsh Date: Tue, 29 Mar 2022 16:23:57 -0400 Subject: [PATCH 11/19] Autoformat --- .../cpp/ir/implementation/raw/internal/IRConstruction.qll | 2 +- .../cpp/ir/implementation/raw/internal/TranslatedElement.qll | 2 +- csharp/ql/src/experimental/ir/internal/IRCSharpLanguage.qll | 4 +--- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/IRConstruction.qll b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/IRConstruction.qll index 7f6ffa6fec4..3901e1b36fb 100644 --- a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/IRConstruction.qll +++ b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/IRConstruction.qll @@ -34,7 +34,7 @@ module Raw { cached predicate functionHasIR(Function func) { exists(getTranslatedFunction(func)) } - + cached predicate varHasIRFunc(GlobalOrNamespaceVariable var) { any() } // TODO: restrict? diff --git a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedElement.qll b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedElement.qll index 12a765d4f7d..8c53fe086a8 100644 --- a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedElement.qll +++ b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedElement.qll @@ -955,4 +955,4 @@ abstract class TranslatedRootElement extends TranslatedElement { or this instanceof TTranslatedGlobalOrNamespaceVarInit } -} \ No newline at end of file +} diff --git a/csharp/ql/src/experimental/ir/internal/IRCSharpLanguage.qll b/csharp/ql/src/experimental/ir/internal/IRCSharpLanguage.qll index aa3983014a7..11fbe784ca0 100644 --- a/csharp/ql/src/experimental/ir/internal/IRCSharpLanguage.qll +++ b/csharp/ql/src/experimental/ir/internal/IRCSharpLanguage.qll @@ -9,9 +9,7 @@ class OpaqueTypeTag = CSharp::ValueOrRefType; class Function = CSharp::Callable; class GlobalVariable extends CSharp::Field { - GlobalVariable() { - this.isStatic() - } + GlobalVariable() { this.isStatic() } } class Declaration = CSharp::Declaration; From 417b0b535362616d1878e86f6c11b73cc3ad10e0 Mon Sep 17 00:00:00 2001 From: Robert Marsh Date: Wed, 30 Mar 2022 10:23:17 -0400 Subject: [PATCH 12/19] C++: accept test changes for updated extractor --- .../library-tests/ir/ir/PrintAST.expected | 91 +++++-- .../ir/ir/aliased_ssa_consistency.expected | 3 - .../aliased_ssa_consistency_unsound.expected | 3 - .../ir/ir/operand_locations.expected | 142 +++++++++++ .../ir/ir/raw_consistency.expected | 55 ----- .../test/library-tests/ir/ir/raw_ir.expected | 232 ++++++++++-------- .../ir/ir/unaliased_ssa_consistency.expected | 3 - ...unaliased_ssa_consistency_unsound.expected | 3 - 8 files changed, 336 insertions(+), 196 deletions(-) diff --git a/cpp/ql/test/library-tests/ir/ir/PrintAST.expected b/cpp/ql/test/library-tests/ir/ir/PrintAST.expected index 414c2216c6c..1baf73e5747 100644 --- a/cpp/ql/test/library-tests/ir/ir/PrintAST.expected +++ b/cpp/ql/test/library-tests/ir/ir/PrintAST.expected @@ -155,15 +155,21 @@ bad_asts.cpp: # 19| getInitializer(0): [ConstructorFieldInit] constructor init of field x # 19| Type = [IntType] int # 19| ValueCategory = prvalue -# 19| getExpr(): [Literal] Unknown literal +# 19| getExpr(): [FieldAccess] x # 19| Type = [IntType] int -# 19| ValueCategory = prvalue +# 19| ValueCategory = prvalue(load) +# 19| getQualifier(): [VariableAccess] (unnamed parameter 0) +# 19| Type = [LValueReferenceType] const Point & +# 19| ValueCategory = prvalue(load) # 19| getInitializer(1): [ConstructorFieldInit] constructor init of field y # 19| Type = [IntType] int # 19| ValueCategory = prvalue -# 19| getExpr(): [Literal] Unknown literal +# 19| getExpr(): [FieldAccess] y # 19| Type = [IntType] int -# 19| ValueCategory = prvalue +# 19| ValueCategory = prvalue(load) +# 19| getQualifier(): [VariableAccess] (unnamed parameter 0) +# 19| Type = [LValueReferenceType] const Point & +# 19| ValueCategory = prvalue(load) # 19| getEntryPoint(): [BlockStmt] { ... } # 19| getStmt(0): [ReturnStmt] return ... # 19| [MoveConstructor] void Bad::Point::Point(Bad::Point&&) @@ -11645,51 +11651,75 @@ ir.cpp: # 1486| getInitializer(0): [ConstructorFieldInit] constructor init of field i # 1486| Type = [IntType] int # 1486| ValueCategory = prvalue -# 1486| getExpr(): [Literal] Unknown literal +# 1486| getExpr(): [FieldAccess] i # 1486| Type = [IntType] int -# 1486| ValueCategory = prvalue +# 1486| ValueCategory = prvalue(load) +# 1486| getQualifier(): [VariableAccess] (unnamed parameter 0) +# 1486| Type = [LValueReferenceType] const StructuredBindingDataMemberStruct & +# 1486| ValueCategory = prvalue(load) # 1486| getInitializer(1): [ConstructorFieldInit] constructor init of field d # 1486| Type = [DoubleType] double # 1486| ValueCategory = prvalue -# 1486| getExpr(): [Literal] Unknown literal +# 1486| getExpr(): [FieldAccess] d # 1486| Type = [DoubleType] double -# 1486| ValueCategory = prvalue +# 1486| ValueCategory = prvalue(load) +# 1486| getQualifier(): [VariableAccess] (unnamed parameter 0) +# 1486| Type = [LValueReferenceType] const StructuredBindingDataMemberStruct & +# 1486| ValueCategory = prvalue(load) # 1486| getInitializer(2): [ConstructorFieldInit] constructor init of field b # 1486| Type = [IntType] unsigned int # 1486| ValueCategory = prvalue -# 1486| getExpr(): [Literal] Unknown literal +# 1486| getExpr(): [FieldAccess] b # 1486| Type = [IntType] unsigned int -# 1486| ValueCategory = prvalue +# 1486| ValueCategory = prvalue(load) +# 1486| getQualifier(): [VariableAccess] (unnamed parameter 0) +# 1486| Type = [LValueReferenceType] const StructuredBindingDataMemberStruct & +# 1486| ValueCategory = prvalue(load) # 1486| getInitializer(3): [ConstructorFieldInit] constructor init of field r # 1486| Type = [LValueReferenceType] int & # 1486| ValueCategory = prvalue -# 1486| getExpr(): [Literal] Unknown literal +# 1486| getExpr(): [FieldAccess] r # 1486| Type = [LValueReferenceType] int & -# 1486| ValueCategory = prvalue +# 1486| ValueCategory = prvalue(load) +# 1486| getQualifier(): [VariableAccess] (unnamed parameter 0) +# 1486| Type = [LValueReferenceType] const StructuredBindingDataMemberStruct & +# 1486| ValueCategory = prvalue(load) # 1486| getInitializer(4): [ConstructorFieldInit] constructor init of field p # 1486| Type = [IntPointerType] int * # 1486| ValueCategory = prvalue -# 1486| getExpr(): [Literal] Unknown literal +# 1486| getExpr(): [FieldAccess] p # 1486| Type = [IntPointerType] int * -# 1486| ValueCategory = prvalue +# 1486| ValueCategory = prvalue(load) +# 1486| getQualifier(): [VariableAccess] (unnamed parameter 0) +# 1486| Type = [LValueReferenceType] const StructuredBindingDataMemberStruct & +# 1486| ValueCategory = prvalue(load) # 1486| getInitializer(5): [ConstructorFieldInit] constructor init of field xs # 1486| Type = [CTypedefType,NestedTypedefType] ArrayType # 1486| ValueCategory = prvalue -# 1486| getExpr(): [Literal] Unknown literal +# 1486| getExpr(): [FieldAccess] xs # 1486| Type = [CTypedefType,NestedTypedefType] ArrayType -# 1486| ValueCategory = prvalue +# 1486| ValueCategory = prvalue(load) +# 1486| getQualifier(): [VariableAccess] (unnamed parameter 0) +# 1486| Type = [LValueReferenceType] const StructuredBindingDataMemberStruct & +# 1486| ValueCategory = prvalue(load) # 1486| getInitializer(6): [ConstructorFieldInit] constructor init of field r_alt # 1486| Type = [CTypedefType,NestedTypedefType] RefType # 1486| ValueCategory = prvalue -# 1486| getExpr(): [Literal] Unknown literal +# 1486| getExpr(): [FieldAccess] r_alt # 1486| Type = [CTypedefType,NestedTypedefType] RefType -# 1486| ValueCategory = prvalue +# 1486| ValueCategory = prvalue(load) +# 1486| getQualifier(): [VariableAccess] (unnamed parameter 0) +# 1486| Type = [LValueReferenceType] const StructuredBindingDataMemberStruct & +# 1486| ValueCategory = prvalue(load) # 1486| getInitializer(7): [ConstructorFieldInit] constructor init of field m # 1486| Type = [Struct] StructuredBindingDataMemberMemberStruct # 1486| ValueCategory = prvalue -# 1486| getExpr(): [Literal] Unknown literal +# 1486| getExpr(): [FieldAccess] m # 1486| Type = [Struct] StructuredBindingDataMemberMemberStruct -# 1486| ValueCategory = prvalue +# 1486| ValueCategory = prvalue(load) +# 1486| getQualifier(): [VariableAccess] (unnamed parameter 0) +# 1486| Type = [LValueReferenceType] const StructuredBindingDataMemberStruct & +# 1486| ValueCategory = prvalue(load) # 1486| getEntryPoint(): [BlockStmt] { ... } # 1486| getStmt(0): [ReturnStmt] return ... # 1486| [MoveConstructor] void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct(StructuredBindingDataMemberStruct&&) @@ -12066,21 +12096,30 @@ ir.cpp: # 1539| getInitializer(0): [ConstructorFieldInit] constructor init of field i # 1539| Type = [IntType] int # 1539| ValueCategory = prvalue -# 1539| getExpr(): [Literal] Unknown literal +# 1539| getExpr(): [FieldAccess] i # 1539| Type = [IntType] int -# 1539| ValueCategory = prvalue +# 1539| ValueCategory = prvalue(load) +# 1539| getQualifier(): [VariableAccess] (unnamed parameter 0) +# 1539| Type = [LValueReferenceType] const StructuredBindingTupleRefGet & +# 1539| ValueCategory = prvalue(load) # 1539| getInitializer(1): [ConstructorFieldInit] constructor init of field d # 1539| Type = [DoubleType] double # 1539| ValueCategory = prvalue -# 1539| getExpr(): [Literal] Unknown literal +# 1539| getExpr(): [FieldAccess] d # 1539| Type = [DoubleType] double -# 1539| ValueCategory = prvalue +# 1539| ValueCategory = prvalue(load) +# 1539| getQualifier(): [VariableAccess] (unnamed parameter 0) +# 1539| Type = [LValueReferenceType] const StructuredBindingTupleRefGet & +# 1539| ValueCategory = prvalue(load) # 1539| getInitializer(2): [ConstructorFieldInit] constructor init of field r # 1539| Type = [LValueReferenceType] int & # 1539| ValueCategory = prvalue -# 1539| getExpr(): [Literal] Unknown literal +# 1539| getExpr(): [FieldAccess] r # 1539| Type = [LValueReferenceType] int & -# 1539| ValueCategory = prvalue +# 1539| ValueCategory = prvalue(load) +# 1539| getQualifier(): [VariableAccess] (unnamed parameter 0) +# 1539| Type = [LValueReferenceType] const StructuredBindingTupleRefGet & +# 1539| ValueCategory = prvalue(load) # 1539| getEntryPoint(): [BlockStmt] { ... } # 1539| getStmt(0): [ReturnStmt] return ... # 1539| [MoveConstructor] void StructuredBindingTupleRefGet::StructuredBindingTupleRefGet(StructuredBindingTupleRefGet&&) diff --git a/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency.expected b/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency.expected index af812c0f1a0..b131121438c 100644 --- a/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency.expected +++ b/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency.expected @@ -6,9 +6,6 @@ missingOperandType duplicateChiOperand sideEffectWithoutPrimary instructionWithoutSuccessor -| bad_asts.cpp:19:10:19:10 | FieldAddress: constructor init of field x | Instruction 'FieldAddress: constructor init of field x' has no successors in function '$@'. | bad_asts.cpp:19:10:19:10 | void Bad::Point::Point(Bad::Point const&) | void Bad::Point::Point(Bad::Point const&) | -| ir.cpp:1486:8:1486:8 | FieldAddress: constructor init of field i | Instruction 'FieldAddress: constructor init of field i' has no successors in function '$@'. | ir.cpp:1486:8:1486:8 | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct(StructuredBindingDataMemberStruct const&) | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct(StructuredBindingDataMemberStruct const&) | -| ir.cpp:1539:8:1539:8 | FieldAddress: constructor init of field i | Instruction 'FieldAddress: constructor init of field i' has no successors in function '$@'. | ir.cpp:1539:8:1539:8 | void StructuredBindingTupleRefGet::StructuredBindingTupleRefGet(StructuredBindingTupleRefGet const&) | void StructuredBindingTupleRefGet::StructuredBindingTupleRefGet(StructuredBindingTupleRefGet const&) | | ir.cpp:1688:24:1690:5 | FieldAddress: {...} | Instruction 'FieldAddress: {...}' has no successors in function '$@'. | ir.cpp:1683:6:1683:20 | void captured_lambda(int, int&, int&&) | void captured_lambda(int, int&, int&&) | | ir.cpp:1689:28:1689:54 | FieldAddress: {...} | Instruction 'FieldAddress: {...}' has no successors in function '$@'. | ir.cpp:1688:46:1688:46 | void (void captured_lambda(int, int&, int&&))::(lambda [] type at line 1688, col. 25)::operator()() const | void (void captured_lambda(int, int&, int&&))::(lambda [] type at line 1688, col. 25)::operator()() const | ambiguousSuccessors diff --git a/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency_unsound.expected b/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency_unsound.expected index af812c0f1a0..b131121438c 100644 --- a/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency_unsound.expected +++ b/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency_unsound.expected @@ -6,9 +6,6 @@ missingOperandType duplicateChiOperand sideEffectWithoutPrimary instructionWithoutSuccessor -| bad_asts.cpp:19:10:19:10 | FieldAddress: constructor init of field x | Instruction 'FieldAddress: constructor init of field x' has no successors in function '$@'. | bad_asts.cpp:19:10:19:10 | void Bad::Point::Point(Bad::Point const&) | void Bad::Point::Point(Bad::Point const&) | -| ir.cpp:1486:8:1486:8 | FieldAddress: constructor init of field i | Instruction 'FieldAddress: constructor init of field i' has no successors in function '$@'. | ir.cpp:1486:8:1486:8 | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct(StructuredBindingDataMemberStruct const&) | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct(StructuredBindingDataMemberStruct const&) | -| ir.cpp:1539:8:1539:8 | FieldAddress: constructor init of field i | Instruction 'FieldAddress: constructor init of field i' has no successors in function '$@'. | ir.cpp:1539:8:1539:8 | void StructuredBindingTupleRefGet::StructuredBindingTupleRefGet(StructuredBindingTupleRefGet const&) | void StructuredBindingTupleRefGet::StructuredBindingTupleRefGet(StructuredBindingTupleRefGet const&) | | ir.cpp:1688:24:1690:5 | FieldAddress: {...} | Instruction 'FieldAddress: {...}' has no successors in function '$@'. | ir.cpp:1683:6:1683:20 | void captured_lambda(int, int&, int&&) | void captured_lambda(int, int&, int&&) | | ir.cpp:1689:28:1689:54 | FieldAddress: {...} | Instruction 'FieldAddress: {...}' has no successors in function '$@'. | ir.cpp:1688:46:1688:46 | void (void captured_lambda(int, int&, int&&))::(lambda [] type at line 1688, col. 25)::operator()() const | void (void captured_lambda(int, int&, int&&))::(lambda [] type at line 1688, col. 25)::operator()() const | ambiguousSuccessors diff --git a/cpp/ql/test/library-tests/ir/ir/operand_locations.expected b/cpp/ql/test/library-tests/ir/ir/operand_locations.expected index 313bc0797a3..5f7b51cc1c7 100644 --- a/cpp/ql/test/library-tests/ir/ir/operand_locations.expected +++ b/cpp/ql/test/library-tests/ir/ir/operand_locations.expected @@ -44,10 +44,32 @@ | bad_asts.cpp:19:10:19:10 | Address | &:r19_5 | | bad_asts.cpp:19:10:19:10 | Address | &:r19_5 | | bad_asts.cpp:19:10:19:10 | Address | &:r19_7 | +| bad_asts.cpp:19:10:19:10 | Address | &:r19_7 | +| bad_asts.cpp:19:10:19:10 | Address | &:r19_9 | +| bad_asts.cpp:19:10:19:10 | Address | &:r19_10 | +| bad_asts.cpp:19:10:19:10 | Address | &:r19_12 | +| bad_asts.cpp:19:10:19:10 | Address | &:r19_16 | +| bad_asts.cpp:19:10:19:10 | Address | &:r19_17 | +| bad_asts.cpp:19:10:19:10 | Address | &:r19_19 | | bad_asts.cpp:19:10:19:10 | ChiPartial | partial:m19_3 | +| bad_asts.cpp:19:10:19:10 | ChiPartial | partial:m19_14 | +| bad_asts.cpp:19:10:19:10 | ChiPartial | partial:m19_21 | | bad_asts.cpp:19:10:19:10 | ChiTotal | total:m19_2 | +| bad_asts.cpp:19:10:19:10 | ChiTotal | total:m19_8 | +| bad_asts.cpp:19:10:19:10 | ChiTotal | total:m19_15 | +| bad_asts.cpp:19:10:19:10 | Load | m0_2 | +| bad_asts.cpp:19:10:19:10 | Load | m0_2 | | bad_asts.cpp:19:10:19:10 | Load | m19_6 | +| bad_asts.cpp:19:10:19:10 | Load | ~m0_4 | +| bad_asts.cpp:19:10:19:10 | Load | ~m0_4 | +| bad_asts.cpp:19:10:19:10 | SideEffect | m19_3 | +| bad_asts.cpp:19:10:19:10 | SideEffect | m19_22 | +| bad_asts.cpp:19:10:19:10 | StoreValue | r19_13 | +| bad_asts.cpp:19:10:19:10 | StoreValue | r19_20 | | bad_asts.cpp:19:10:19:10 | Unary | m19_6 | +| bad_asts.cpp:19:10:19:10 | Unary | m19_6 | +| bad_asts.cpp:19:10:19:10 | Unary | r19_11 | +| bad_asts.cpp:19:10:19:10 | Unary | r19_18 | | bad_asts.cpp:22:5:22:9 | Address | &:r22_5 | | bad_asts.cpp:22:5:22:9 | Address | &:r22_5 | | bad_asts.cpp:22:5:22:9 | Address | &:r22_7 | @@ -659,6 +681,9 @@ | file://:0:0:0:0 | Address | &:r0_3 | | file://:0:0:0:0 | Address | &:r0_3 | | file://:0:0:0:0 | Address | &:r0_3 | +| file://:0:0:0:0 | Address | &:r0_3 | +| file://:0:0:0:0 | Address | &:r0_3 | +| file://:0:0:0:0 | Address | &:r0_3 | | file://:0:0:0:0 | Address | &:r0_5 | | file://:0:0:0:0 | Address | &:r0_5 | | file://:0:0:0:0 | Address | &:r0_5 | @@ -725,6 +750,9 @@ | file://:0:0:0:0 | SideEffect | m0_4 | | file://:0:0:0:0 | SideEffect | m0_4 | | file://:0:0:0:0 | SideEffect | m0_4 | +| file://:0:0:0:0 | SideEffect | m0_4 | +| file://:0:0:0:0 | SideEffect | m0_4 | +| file://:0:0:0:0 | SideEffect | m0_4 | | file://:0:0:0:0 | SideEffect | m1078_23 | | file://:0:0:0:0 | SideEffect | m1078_23 | | file://:0:0:0:0 | SideEffect | m1084_23 | @@ -6803,15 +6831,97 @@ | ir.cpp:1486:8:1486:8 | Address | &:r1486_7 | | ir.cpp:1486:8:1486:8 | Address | &:r1486_7 | | ir.cpp:1486:8:1486:8 | Address | &:r1486_7 | +| ir.cpp:1486:8:1486:8 | Address | &:r1486_7 | +| ir.cpp:1486:8:1486:8 | Address | &:r1486_9 | +| ir.cpp:1486:8:1486:8 | Address | &:r1486_10 | +| ir.cpp:1486:8:1486:8 | Address | &:r1486_12 | +| ir.cpp:1486:8:1486:8 | Address | &:r1486_16 | +| ir.cpp:1486:8:1486:8 | Address | &:r1486_17 | +| ir.cpp:1486:8:1486:8 | Address | &:r1486_19 | +| ir.cpp:1486:8:1486:8 | Address | &:r1486_23 | +| ir.cpp:1486:8:1486:8 | Address | &:r1486_24 | +| ir.cpp:1486:8:1486:8 | Address | &:r1486_26 | +| ir.cpp:1486:8:1486:8 | Address | &:r1486_30 | +| ir.cpp:1486:8:1486:8 | Address | &:r1486_31 | +| ir.cpp:1486:8:1486:8 | Address | &:r1486_33 | +| ir.cpp:1486:8:1486:8 | Address | &:r1486_37 | +| ir.cpp:1486:8:1486:8 | Address | &:r1486_38 | +| ir.cpp:1486:8:1486:8 | Address | &:r1486_40 | +| ir.cpp:1486:8:1486:8 | Address | &:r1486_44 | +| ir.cpp:1486:8:1486:8 | Address | &:r1486_45 | +| ir.cpp:1486:8:1486:8 | Address | &:r1486_47 | +| ir.cpp:1486:8:1486:8 | Address | &:r1486_51 | +| ir.cpp:1486:8:1486:8 | Address | &:r1486_52 | +| ir.cpp:1486:8:1486:8 | Address | &:r1486_54 | +| ir.cpp:1486:8:1486:8 | Address | &:r1486_58 | +| ir.cpp:1486:8:1486:8 | Address | &:r1486_59 | +| ir.cpp:1486:8:1486:8 | Address | &:r1486_61 | | ir.cpp:1486:8:1486:8 | ChiPartial | partial:m1486_3 | | ir.cpp:1486:8:1486:8 | ChiPartial | partial:m1486_3 | +| ir.cpp:1486:8:1486:8 | ChiPartial | partial:m1486_14 | +| ir.cpp:1486:8:1486:8 | ChiPartial | partial:m1486_21 | +| ir.cpp:1486:8:1486:8 | ChiPartial | partial:m1486_28 | +| ir.cpp:1486:8:1486:8 | ChiPartial | partial:m1486_35 | +| ir.cpp:1486:8:1486:8 | ChiPartial | partial:m1486_42 | +| ir.cpp:1486:8:1486:8 | ChiPartial | partial:m1486_49 | +| ir.cpp:1486:8:1486:8 | ChiPartial | partial:m1486_56 | +| ir.cpp:1486:8:1486:8 | ChiPartial | partial:m1486_63 | | ir.cpp:1486:8:1486:8 | ChiTotal | total:m1486_2 | | ir.cpp:1486:8:1486:8 | ChiTotal | total:m1486_2 | +| ir.cpp:1486:8:1486:8 | ChiTotal | total:m1486_8 | +| ir.cpp:1486:8:1486:8 | ChiTotal | total:m1486_15 | +| ir.cpp:1486:8:1486:8 | ChiTotal | total:m1486_22 | +| ir.cpp:1486:8:1486:8 | ChiTotal | total:m1486_29 | +| ir.cpp:1486:8:1486:8 | ChiTotal | total:m1486_36 | +| ir.cpp:1486:8:1486:8 | ChiTotal | total:m1486_43 | +| ir.cpp:1486:8:1486:8 | ChiTotal | total:m1486_50 | +| ir.cpp:1486:8:1486:8 | ChiTotal | total:m1486_57 | +| ir.cpp:1486:8:1486:8 | Load | m0_2 | +| ir.cpp:1486:8:1486:8 | Load | m0_2 | +| ir.cpp:1486:8:1486:8 | Load | m0_2 | +| ir.cpp:1486:8:1486:8 | Load | m0_2 | +| ir.cpp:1486:8:1486:8 | Load | m0_2 | +| ir.cpp:1486:8:1486:8 | Load | m0_2 | +| ir.cpp:1486:8:1486:8 | Load | m0_2 | +| ir.cpp:1486:8:1486:8 | Load | m0_2 | | ir.cpp:1486:8:1486:8 | Load | m1486_6 | | ir.cpp:1486:8:1486:8 | Load | m1486_6 | +| ir.cpp:1486:8:1486:8 | Load | ~m0_4 | +| ir.cpp:1486:8:1486:8 | Load | ~m0_4 | +| ir.cpp:1486:8:1486:8 | Load | ~m0_4 | +| ir.cpp:1486:8:1486:8 | Load | ~m0_4 | +| ir.cpp:1486:8:1486:8 | Load | ~m0_4 | +| ir.cpp:1486:8:1486:8 | Load | ~m0_4 | +| ir.cpp:1486:8:1486:8 | Load | ~m0_4 | +| ir.cpp:1486:8:1486:8 | Load | ~m0_4 | +| ir.cpp:1486:8:1486:8 | SideEffect | m1486_3 | | ir.cpp:1486:8:1486:8 | SideEffect | m1486_3 | | ir.cpp:1486:8:1486:8 | SideEffect | m1486_8 | +| ir.cpp:1486:8:1486:8 | SideEffect | m1486_64 | +| ir.cpp:1486:8:1486:8 | StoreValue | r1486_13 | +| ir.cpp:1486:8:1486:8 | StoreValue | r1486_20 | +| ir.cpp:1486:8:1486:8 | StoreValue | r1486_27 | +| ir.cpp:1486:8:1486:8 | StoreValue | r1486_34 | +| ir.cpp:1486:8:1486:8 | StoreValue | r1486_41 | +| ir.cpp:1486:8:1486:8 | StoreValue | r1486_48 | +| ir.cpp:1486:8:1486:8 | StoreValue | r1486_55 | +| ir.cpp:1486:8:1486:8 | StoreValue | r1486_62 | | ir.cpp:1486:8:1486:8 | Unary | m1486_6 | +| ir.cpp:1486:8:1486:8 | Unary | m1486_6 | +| ir.cpp:1486:8:1486:8 | Unary | m1486_6 | +| ir.cpp:1486:8:1486:8 | Unary | m1486_6 | +| ir.cpp:1486:8:1486:8 | Unary | m1486_6 | +| ir.cpp:1486:8:1486:8 | Unary | m1486_6 | +| ir.cpp:1486:8:1486:8 | Unary | m1486_6 | +| ir.cpp:1486:8:1486:8 | Unary | m1486_6 | +| ir.cpp:1486:8:1486:8 | Unary | r1486_11 | +| ir.cpp:1486:8:1486:8 | Unary | r1486_18 | +| ir.cpp:1486:8:1486:8 | Unary | r1486_25 | +| ir.cpp:1486:8:1486:8 | Unary | r1486_32 | +| ir.cpp:1486:8:1486:8 | Unary | r1486_39 | +| ir.cpp:1486:8:1486:8 | Unary | r1486_46 | +| ir.cpp:1486:8:1486:8 | Unary | r1486_53 | +| ir.cpp:1486:8:1486:8 | Unary | r1486_60 | | ir.cpp:1499:6:1499:35 | ChiPartial | partial:m1499_3 | | ir.cpp:1499:6:1499:35 | ChiTotal | total:m1499_2 | | ir.cpp:1499:6:1499:35 | SideEffect | ~m1525_7 | @@ -6989,15 +7099,47 @@ | ir.cpp:1539:8:1539:8 | Address | &:r1539_7 | | ir.cpp:1539:8:1539:8 | Address | &:r1539_7 | | ir.cpp:1539:8:1539:8 | Address | &:r1539_7 | +| ir.cpp:1539:8:1539:8 | Address | &:r1539_7 | +| ir.cpp:1539:8:1539:8 | Address | &:r1539_9 | +| ir.cpp:1539:8:1539:8 | Address | &:r1539_10 | +| ir.cpp:1539:8:1539:8 | Address | &:r1539_12 | +| ir.cpp:1539:8:1539:8 | Address | &:r1539_16 | +| ir.cpp:1539:8:1539:8 | Address | &:r1539_17 | +| ir.cpp:1539:8:1539:8 | Address | &:r1539_19 | +| ir.cpp:1539:8:1539:8 | Address | &:r1539_23 | +| ir.cpp:1539:8:1539:8 | Address | &:r1539_24 | +| ir.cpp:1539:8:1539:8 | Address | &:r1539_26 | | ir.cpp:1539:8:1539:8 | ChiPartial | partial:m1539_3 | | ir.cpp:1539:8:1539:8 | ChiPartial | partial:m1539_3 | +| ir.cpp:1539:8:1539:8 | ChiPartial | partial:m1539_14 | +| ir.cpp:1539:8:1539:8 | ChiPartial | partial:m1539_21 | +| ir.cpp:1539:8:1539:8 | ChiPartial | partial:m1539_28 | | ir.cpp:1539:8:1539:8 | ChiTotal | total:m1539_2 | | ir.cpp:1539:8:1539:8 | ChiTotal | total:m1539_2 | +| ir.cpp:1539:8:1539:8 | ChiTotal | total:m1539_8 | +| ir.cpp:1539:8:1539:8 | ChiTotal | total:m1539_15 | +| ir.cpp:1539:8:1539:8 | ChiTotal | total:m1539_22 | +| ir.cpp:1539:8:1539:8 | Load | m0_2 | +| ir.cpp:1539:8:1539:8 | Load | m0_2 | +| ir.cpp:1539:8:1539:8 | Load | m0_2 | | ir.cpp:1539:8:1539:8 | Load | m1539_6 | | ir.cpp:1539:8:1539:8 | Load | m1539_6 | +| ir.cpp:1539:8:1539:8 | Load | ~m0_4 | +| ir.cpp:1539:8:1539:8 | Load | ~m0_4 | +| ir.cpp:1539:8:1539:8 | Load | ~m0_4 | +| ir.cpp:1539:8:1539:8 | SideEffect | m1539_3 | | ir.cpp:1539:8:1539:8 | SideEffect | m1539_3 | | ir.cpp:1539:8:1539:8 | SideEffect | m1539_8 | +| ir.cpp:1539:8:1539:8 | SideEffect | m1539_29 | +| ir.cpp:1539:8:1539:8 | StoreValue | r1539_13 | +| ir.cpp:1539:8:1539:8 | StoreValue | r1539_20 | +| ir.cpp:1539:8:1539:8 | StoreValue | r1539_27 | | ir.cpp:1539:8:1539:8 | Unary | m1539_6 | +| ir.cpp:1539:8:1539:8 | Unary | m1539_6 | +| ir.cpp:1539:8:1539:8 | Unary | m1539_6 | +| ir.cpp:1539:8:1539:8 | Unary | r1539_11 | +| ir.cpp:1539:8:1539:8 | Unary | r1539_18 | +| ir.cpp:1539:8:1539:8 | Unary | r1539_25 | | ir.cpp:1567:60:1567:95 | Address | &:r1567_5 | | ir.cpp:1567:60:1567:95 | Address | &:r1567_5 | | ir.cpp:1567:60:1567:95 | Address | &:r1567_7 | diff --git a/cpp/ql/test/library-tests/ir/ir/raw_consistency.expected b/cpp/ql/test/library-tests/ir/ir/raw_consistency.expected index a1040848326..52173741010 100644 --- a/cpp/ql/test/library-tests/ir/ir/raw_consistency.expected +++ b/cpp/ql/test/library-tests/ir/ir/raw_consistency.expected @@ -1,17 +1,4 @@ missingOperand -| bad_asts.cpp:19:10:19:10 | Store: Unknown literal | Instruction 'Store' is missing an expected operand with tag 'StoreValue' in function '$@'. | bad_asts.cpp:19:10:19:10 | void Bad::Point::Point(Bad::Point const&) | void Bad::Point::Point(Bad::Point const&) | -| bad_asts.cpp:19:10:19:10 | Store: Unknown literal | Instruction 'Store' is missing an expected operand with tag 'StoreValue' in function '$@'. | bad_asts.cpp:19:10:19:10 | void Bad::Point::Point(Bad::Point const&) | void Bad::Point::Point(Bad::Point const&) | -| ir.cpp:1486:8:1486:8 | Store: Unknown literal | Instruction 'Store' is missing an expected operand with tag 'StoreValue' in function '$@'. | ir.cpp:1486:8:1486:8 | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct(StructuredBindingDataMemberStruct const&) | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct(StructuredBindingDataMemberStruct const&) | -| ir.cpp:1486:8:1486:8 | Store: Unknown literal | Instruction 'Store' is missing an expected operand with tag 'StoreValue' in function '$@'. | ir.cpp:1486:8:1486:8 | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct(StructuredBindingDataMemberStruct const&) | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct(StructuredBindingDataMemberStruct const&) | -| ir.cpp:1486:8:1486:8 | Store: Unknown literal | Instruction 'Store' is missing an expected operand with tag 'StoreValue' in function '$@'. | ir.cpp:1486:8:1486:8 | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct(StructuredBindingDataMemberStruct const&) | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct(StructuredBindingDataMemberStruct const&) | -| ir.cpp:1486:8:1486:8 | Store: Unknown literal | Instruction 'Store' is missing an expected operand with tag 'StoreValue' in function '$@'. | ir.cpp:1486:8:1486:8 | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct(StructuredBindingDataMemberStruct const&) | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct(StructuredBindingDataMemberStruct const&) | -| ir.cpp:1486:8:1486:8 | Store: Unknown literal | Instruction 'Store' is missing an expected operand with tag 'StoreValue' in function '$@'. | ir.cpp:1486:8:1486:8 | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct(StructuredBindingDataMemberStruct const&) | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct(StructuredBindingDataMemberStruct const&) | -| ir.cpp:1486:8:1486:8 | Store: Unknown literal | Instruction 'Store' is missing an expected operand with tag 'StoreValue' in function '$@'. | ir.cpp:1486:8:1486:8 | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct(StructuredBindingDataMemberStruct const&) | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct(StructuredBindingDataMemberStruct const&) | -| ir.cpp:1486:8:1486:8 | Store: Unknown literal | Instruction 'Store' is missing an expected operand with tag 'StoreValue' in function '$@'. | ir.cpp:1486:8:1486:8 | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct(StructuredBindingDataMemberStruct const&) | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct(StructuredBindingDataMemberStruct const&) | -| ir.cpp:1486:8:1486:8 | Store: Unknown literal | Instruction 'Store' is missing an expected operand with tag 'StoreValue' in function '$@'. | ir.cpp:1486:8:1486:8 | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct(StructuredBindingDataMemberStruct const&) | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct(StructuredBindingDataMemberStruct const&) | -| ir.cpp:1539:8:1539:8 | Store: Unknown literal | Instruction 'Store' is missing an expected operand with tag 'StoreValue' in function '$@'. | ir.cpp:1539:8:1539:8 | void StructuredBindingTupleRefGet::StructuredBindingTupleRefGet(StructuredBindingTupleRefGet const&) | void StructuredBindingTupleRefGet::StructuredBindingTupleRefGet(StructuredBindingTupleRefGet const&) | -| ir.cpp:1539:8:1539:8 | Store: Unknown literal | Instruction 'Store' is missing an expected operand with tag 'StoreValue' in function '$@'. | ir.cpp:1539:8:1539:8 | void StructuredBindingTupleRefGet::StructuredBindingTupleRefGet(StructuredBindingTupleRefGet const&) | void StructuredBindingTupleRefGet::StructuredBindingTupleRefGet(StructuredBindingTupleRefGet const&) | -| ir.cpp:1539:8:1539:8 | Store: Unknown literal | Instruction 'Store' is missing an expected operand with tag 'StoreValue' in function '$@'. | ir.cpp:1539:8:1539:8 | void StructuredBindingTupleRefGet::StructuredBindingTupleRefGet(StructuredBindingTupleRefGet const&) | void StructuredBindingTupleRefGet::StructuredBindingTupleRefGet(StructuredBindingTupleRefGet const&) | | ir.cpp:1688:24:1690:5 | Store: Unknown literal | Instruction 'Store' is missing an expected operand with tag 'StoreValue' in function '$@'. | ir.cpp:1683:6:1683:20 | void captured_lambda(int, int&, int&&) | void captured_lambda(int, int&, int&&) | | ir.cpp:1688:24:1690:5 | Store: Unknown literal | Instruction 'Store' is missing an expected operand with tag 'StoreValue' in function '$@'. | ir.cpp:1683:6:1683:20 | void captured_lambda(int, int&, int&&) | void captured_lambda(int, int&, int&&) | | ir.cpp:1689:28:1689:54 | Store: Unknown literal | Instruction 'Store' is missing an expected operand with tag 'StoreValue' in function '$@'. | ir.cpp:1688:46:1688:46 | void (void captured_lambda(int, int&, int&&))::(lambda [] type at line 1688, col. 25)::operator()() const | void (void captured_lambda(int, int&, int&&))::(lambda [] type at line 1688, col. 25)::operator()() const | @@ -24,19 +11,6 @@ duplicateChiOperand sideEffectWithoutPrimary instructionWithoutSuccessor | ../../../include/memory.h:68:25:68:33 | CopyValue: (reference to) | Instruction 'CopyValue: (reference to)' has no successors in function '$@'. | ../../../include/memory.h:67:5:67:5 | void std::unique_ptr>::~unique_ptr() | void std::unique_ptr>::~unique_ptr() | -| bad_asts.cpp:19:10:19:10 | FieldAddress: constructor init of field x | Instruction 'FieldAddress: constructor init of field x' has no successors in function '$@'. | bad_asts.cpp:19:10:19:10 | void Bad::Point::Point(Bad::Point const&) | void Bad::Point::Point(Bad::Point const&) | -| bad_asts.cpp:19:10:19:10 | FieldAddress: constructor init of field y | Instruction 'FieldAddress: constructor init of field y' has no successors in function '$@'. | bad_asts.cpp:19:10:19:10 | void Bad::Point::Point(Bad::Point const&) | void Bad::Point::Point(Bad::Point const&) | -| ir.cpp:1486:8:1486:8 | FieldAddress: constructor init of field b | Instruction 'FieldAddress: constructor init of field b' has no successors in function '$@'. | ir.cpp:1486:8:1486:8 | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct(StructuredBindingDataMemberStruct const&) | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct(StructuredBindingDataMemberStruct const&) | -| ir.cpp:1486:8:1486:8 | FieldAddress: constructor init of field d | Instruction 'FieldAddress: constructor init of field d' has no successors in function '$@'. | ir.cpp:1486:8:1486:8 | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct(StructuredBindingDataMemberStruct const&) | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct(StructuredBindingDataMemberStruct const&) | -| ir.cpp:1486:8:1486:8 | FieldAddress: constructor init of field i | Instruction 'FieldAddress: constructor init of field i' has no successors in function '$@'. | ir.cpp:1486:8:1486:8 | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct(StructuredBindingDataMemberStruct const&) | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct(StructuredBindingDataMemberStruct const&) | -| ir.cpp:1486:8:1486:8 | FieldAddress: constructor init of field m | Instruction 'FieldAddress: constructor init of field m' has no successors in function '$@'. | ir.cpp:1486:8:1486:8 | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct(StructuredBindingDataMemberStruct const&) | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct(StructuredBindingDataMemberStruct const&) | -| ir.cpp:1486:8:1486:8 | FieldAddress: constructor init of field p | Instruction 'FieldAddress: constructor init of field p' has no successors in function '$@'. | ir.cpp:1486:8:1486:8 | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct(StructuredBindingDataMemberStruct const&) | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct(StructuredBindingDataMemberStruct const&) | -| ir.cpp:1486:8:1486:8 | FieldAddress: constructor init of field r | Instruction 'FieldAddress: constructor init of field r' has no successors in function '$@'. | ir.cpp:1486:8:1486:8 | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct(StructuredBindingDataMemberStruct const&) | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct(StructuredBindingDataMemberStruct const&) | -| ir.cpp:1486:8:1486:8 | FieldAddress: constructor init of field r_alt | Instruction 'FieldAddress: constructor init of field r_alt' has no successors in function '$@'. | ir.cpp:1486:8:1486:8 | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct(StructuredBindingDataMemberStruct const&) | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct(StructuredBindingDataMemberStruct const&) | -| ir.cpp:1486:8:1486:8 | FieldAddress: constructor init of field xs | Instruction 'FieldAddress: constructor init of field xs' has no successors in function '$@'. | ir.cpp:1486:8:1486:8 | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct(StructuredBindingDataMemberStruct const&) | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct(StructuredBindingDataMemberStruct const&) | -| ir.cpp:1539:8:1539:8 | FieldAddress: constructor init of field d | Instruction 'FieldAddress: constructor init of field d' has no successors in function '$@'. | ir.cpp:1539:8:1539:8 | void StructuredBindingTupleRefGet::StructuredBindingTupleRefGet(StructuredBindingTupleRefGet const&) | void StructuredBindingTupleRefGet::StructuredBindingTupleRefGet(StructuredBindingTupleRefGet const&) | -| ir.cpp:1539:8:1539:8 | FieldAddress: constructor init of field i | Instruction 'FieldAddress: constructor init of field i' has no successors in function '$@'. | ir.cpp:1539:8:1539:8 | void StructuredBindingTupleRefGet::StructuredBindingTupleRefGet(StructuredBindingTupleRefGet const&) | void StructuredBindingTupleRefGet::StructuredBindingTupleRefGet(StructuredBindingTupleRefGet const&) | -| ir.cpp:1539:8:1539:8 | FieldAddress: constructor init of field r | Instruction 'FieldAddress: constructor init of field r' has no successors in function '$@'. | ir.cpp:1539:8:1539:8 | void StructuredBindingTupleRefGet::StructuredBindingTupleRefGet(StructuredBindingTupleRefGet const&) | void StructuredBindingTupleRefGet::StructuredBindingTupleRefGet(StructuredBindingTupleRefGet const&) | | ir.cpp:1688:24:1690:5 | FieldAddress: {...} | Instruction 'FieldAddress: {...}' has no successors in function '$@'. | ir.cpp:1683:6:1683:20 | void captured_lambda(int, int&, int&&) | void captured_lambda(int, int&, int&&) | | ir.cpp:1688:24:1690:5 | FieldAddress: {...} | Instruction 'FieldAddress: {...}' has no successors in function '$@'. | ir.cpp:1683:6:1683:20 | void captured_lambda(int, int&, int&&) | void captured_lambda(int, int&, int&&) | | ir.cpp:1689:28:1689:54 | FieldAddress: {...} | Instruction 'FieldAddress: {...}' has no successors in function '$@'. | ir.cpp:1688:46:1688:46 | void (void captured_lambda(int, int&, int&&))::(lambda [] type at line 1688, col. 25)::operator()() const | void (void captured_lambda(int, int&, int&&))::(lambda [] type at line 1688, col. 25)::operator()() const | @@ -51,36 +25,7 @@ containsLoopOfForwardEdges lostReachability backEdgeCountMismatch useNotDominatedByDefinition -| bad_asts.cpp:19:10:19:10 | Address | Operand 'Address' is not dominated by its definition in function '$@'. | bad_asts.cpp:19:10:19:10 | void Bad::Point::Point(Bad::Point const&) | void Bad::Point::Point(Bad::Point const&) | -| bad_asts.cpp:19:10:19:10 | Address | Operand 'Address' is not dominated by its definition in function '$@'. | bad_asts.cpp:19:10:19:10 | void Bad::Point::Point(Bad::Point const&) | void Bad::Point::Point(Bad::Point const&) | -| bad_asts.cpp:19:10:19:10 | Address | Operand 'Address' is not dominated by its definition in function '$@'. | bad_asts.cpp:19:10:19:10 | void Bad::Point::Point(Bad::Point const&) | void Bad::Point::Point(Bad::Point const&) | -| bad_asts.cpp:19:10:19:10 | Unary | Operand 'Unary' is not dominated by its definition in function '$@'. | bad_asts.cpp:19:10:19:10 | void Bad::Point::Point(Bad::Point const&) | void Bad::Point::Point(Bad::Point const&) | -| file://:0:0:0:0 | Address | Operand 'Address' is not dominated by its definition in function '$@'. | bad_asts.cpp:19:10:19:10 | void Bad::Point::Point(Bad::Point const&) | void Bad::Point::Point(Bad::Point const&) | -| file://:0:0:0:0 | Address | Operand 'Address' is not dominated by its definition in function '$@'. | ir.cpp:1486:8:1486:8 | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct(StructuredBindingDataMemberStruct const&) | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct(StructuredBindingDataMemberStruct const&) | -| file://:0:0:0:0 | Address | Operand 'Address' is not dominated by its definition in function '$@'. | ir.cpp:1539:8:1539:8 | void StructuredBindingTupleRefGet::StructuredBindingTupleRefGet(StructuredBindingTupleRefGet const&) | void StructuredBindingTupleRefGet::StructuredBindingTupleRefGet(StructuredBindingTupleRefGet const&) | -| ir.cpp:1486:8:1486:8 | Address | Operand 'Address' is not dominated by its definition in function '$@'. | ir.cpp:1486:8:1486:8 | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct(StructuredBindingDataMemberStruct const&) | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct(StructuredBindingDataMemberStruct const&) | -| ir.cpp:1486:8:1486:8 | Address | Operand 'Address' is not dominated by its definition in function '$@'. | ir.cpp:1486:8:1486:8 | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct(StructuredBindingDataMemberStruct const&) | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct(StructuredBindingDataMemberStruct const&) | -| ir.cpp:1486:8:1486:8 | Address | Operand 'Address' is not dominated by its definition in function '$@'. | ir.cpp:1486:8:1486:8 | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct(StructuredBindingDataMemberStruct const&) | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct(StructuredBindingDataMemberStruct const&) | -| ir.cpp:1486:8:1486:8 | Address | Operand 'Address' is not dominated by its definition in function '$@'. | ir.cpp:1486:8:1486:8 | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct(StructuredBindingDataMemberStruct const&) | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct(StructuredBindingDataMemberStruct const&) | -| ir.cpp:1486:8:1486:8 | Address | Operand 'Address' is not dominated by its definition in function '$@'. | ir.cpp:1486:8:1486:8 | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct(StructuredBindingDataMemberStruct const&) | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct(StructuredBindingDataMemberStruct const&) | -| ir.cpp:1486:8:1486:8 | Address | Operand 'Address' is not dominated by its definition in function '$@'. | ir.cpp:1486:8:1486:8 | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct(StructuredBindingDataMemberStruct const&) | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct(StructuredBindingDataMemberStruct const&) | -| ir.cpp:1486:8:1486:8 | Address | Operand 'Address' is not dominated by its definition in function '$@'. | ir.cpp:1486:8:1486:8 | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct(StructuredBindingDataMemberStruct const&) | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct(StructuredBindingDataMemberStruct const&) | -| ir.cpp:1486:8:1486:8 | Address | Operand 'Address' is not dominated by its definition in function '$@'. | ir.cpp:1486:8:1486:8 | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct(StructuredBindingDataMemberStruct const&) | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct(StructuredBindingDataMemberStruct const&) | -| ir.cpp:1486:8:1486:8 | Address | Operand 'Address' is not dominated by its definition in function '$@'. | ir.cpp:1486:8:1486:8 | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct(StructuredBindingDataMemberStruct const&) | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct(StructuredBindingDataMemberStruct const&) | | ir.cpp:1486:8:1486:8 | Unary | Operand 'Unary' is not dominated by its definition in function '$@'. | ir.cpp:1486:8:1486:8 | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct() | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct() | -| ir.cpp:1486:8:1486:8 | Unary | Operand 'Unary' is not dominated by its definition in function '$@'. | ir.cpp:1486:8:1486:8 | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct(StructuredBindingDataMemberStruct const&) | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct(StructuredBindingDataMemberStruct const&) | -| ir.cpp:1486:8:1486:8 | Unary | Operand 'Unary' is not dominated by its definition in function '$@'. | ir.cpp:1486:8:1486:8 | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct(StructuredBindingDataMemberStruct const&) | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct(StructuredBindingDataMemberStruct const&) | -| ir.cpp:1486:8:1486:8 | Unary | Operand 'Unary' is not dominated by its definition in function '$@'. | ir.cpp:1486:8:1486:8 | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct(StructuredBindingDataMemberStruct const&) | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct(StructuredBindingDataMemberStruct const&) | -| ir.cpp:1486:8:1486:8 | Unary | Operand 'Unary' is not dominated by its definition in function '$@'. | ir.cpp:1486:8:1486:8 | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct(StructuredBindingDataMemberStruct const&) | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct(StructuredBindingDataMemberStruct const&) | -| ir.cpp:1486:8:1486:8 | Unary | Operand 'Unary' is not dominated by its definition in function '$@'. | ir.cpp:1486:8:1486:8 | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct(StructuredBindingDataMemberStruct const&) | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct(StructuredBindingDataMemberStruct const&) | -| ir.cpp:1486:8:1486:8 | Unary | Operand 'Unary' is not dominated by its definition in function '$@'. | ir.cpp:1486:8:1486:8 | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct(StructuredBindingDataMemberStruct const&) | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct(StructuredBindingDataMemberStruct const&) | -| ir.cpp:1486:8:1486:8 | Unary | Operand 'Unary' is not dominated by its definition in function '$@'. | ir.cpp:1486:8:1486:8 | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct(StructuredBindingDataMemberStruct const&) | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct(StructuredBindingDataMemberStruct const&) | -| ir.cpp:1539:8:1539:8 | Address | Operand 'Address' is not dominated by its definition in function '$@'. | ir.cpp:1539:8:1539:8 | void StructuredBindingTupleRefGet::StructuredBindingTupleRefGet(StructuredBindingTupleRefGet const&) | void StructuredBindingTupleRefGet::StructuredBindingTupleRefGet(StructuredBindingTupleRefGet const&) | -| ir.cpp:1539:8:1539:8 | Address | Operand 'Address' is not dominated by its definition in function '$@'. | ir.cpp:1539:8:1539:8 | void StructuredBindingTupleRefGet::StructuredBindingTupleRefGet(StructuredBindingTupleRefGet const&) | void StructuredBindingTupleRefGet::StructuredBindingTupleRefGet(StructuredBindingTupleRefGet const&) | -| ir.cpp:1539:8:1539:8 | Address | Operand 'Address' is not dominated by its definition in function '$@'. | ir.cpp:1539:8:1539:8 | void StructuredBindingTupleRefGet::StructuredBindingTupleRefGet(StructuredBindingTupleRefGet const&) | void StructuredBindingTupleRefGet::StructuredBindingTupleRefGet(StructuredBindingTupleRefGet const&) | -| ir.cpp:1539:8:1539:8 | Address | Operand 'Address' is not dominated by its definition in function '$@'. | ir.cpp:1539:8:1539:8 | void StructuredBindingTupleRefGet::StructuredBindingTupleRefGet(StructuredBindingTupleRefGet const&) | void StructuredBindingTupleRefGet::StructuredBindingTupleRefGet(StructuredBindingTupleRefGet const&) | -| ir.cpp:1539:8:1539:8 | Unary | Operand 'Unary' is not dominated by its definition in function '$@'. | ir.cpp:1539:8:1539:8 | void StructuredBindingTupleRefGet::StructuredBindingTupleRefGet(StructuredBindingTupleRefGet const&) | void StructuredBindingTupleRefGet::StructuredBindingTupleRefGet(StructuredBindingTupleRefGet const&) | -| ir.cpp:1539:8:1539:8 | Unary | Operand 'Unary' is not dominated by its definition in function '$@'. | ir.cpp:1539:8:1539:8 | void StructuredBindingTupleRefGet::StructuredBindingTupleRefGet(StructuredBindingTupleRefGet const&) | void StructuredBindingTupleRefGet::StructuredBindingTupleRefGet(StructuredBindingTupleRefGet const&) | | ir.cpp:1683:34:1683:34 | Address | Operand 'Address' is not dominated by its definition in function '$@'. | ir.cpp:1683:6:1683:20 | void captured_lambda(int, int&, int&&) | void captured_lambda(int, int&, int&&) | | ir.cpp:1683:43:1683:43 | Address | Operand 'Address' is not dominated by its definition in function '$@'. | ir.cpp:1683:6:1683:20 | void captured_lambda(int, int&, int&&) | void captured_lambda(int, int&, int&&) | | ir.cpp:1688:10:1688:21 | Address | Operand 'Address' is not dominated by its definition in function '$@'. | ir.cpp:1683:6:1683:20 | void captured_lambda(int, int&, int&&) | void captured_lambda(int, int&, int&&) | diff --git a/cpp/ql/test/library-tests/ir/ir/raw_ir.expected b/cpp/ql/test/library-tests/ir/ir/raw_ir.expected index 779e75efc3c..d6d8ec871ee 100644 --- a/cpp/ql/test/library-tests/ir/ir/raw_ir.expected +++ b/cpp/ql/test/library-tests/ir/ir/raw_ir.expected @@ -51,31 +51,35 @@ bad_asts.cpp: # 19| void Bad::Point::Point(Bad::Point const&) # 19| Block 0 -# 19| v19_1(void) = EnterFunction : -# 19| mu19_2(unknown) = AliasedDefinition : -# 19| mu19_3(unknown) = InitializeNonLocal : -# 19| r19_4(glval) = VariableAddress[#this] : -# 19| mu19_5(glval) = InitializeParameter[#this] : &:r19_4 -# 19| r19_6(glval) = Load[#this] : &:r19_4, ~m? -# 19| mu19_7(Point) = InitializeIndirection[#this] : &:r19_6 -#-----| r0_1(glval) = VariableAddress[(unnamed parameter 0)] : -#-----| mu0_2(Point &) = InitializeParameter[(unnamed parameter 0)] : &:r0_1 -#-----| r0_3(Point &) = Load[(unnamed parameter 0)] : &:r0_1, ~m? -#-----| mu0_4(unknown) = InitializeIndirection[(unnamed parameter 0)] : &:r0_3 -# 19| r19_8(glval) = FieldAddress[x] : mu19_5 - -# 19| Block 1 -# 19| mu19_9(int) = Store[?] : &:r19_8 -# 19| r19_10(glval) = FieldAddress[y] : mu19_5 - -# 19| Block 2 -# 19| mu19_11(int) = Store[?] : &:r19_10 -# 19| v19_12(void) = NoOp : -# 19| v19_13(void) = ReturnIndirection[#this] : &:r19_6, ~m? -#-----| v0_5(void) = ReturnIndirection[(unnamed parameter 0)] : &:r0_3, ~m? -# 19| v19_14(void) = ReturnVoid : -# 19| v19_15(void) = AliasedUse : ~m? -# 19| v19_16(void) = ExitFunction : +# 19| v19_1(void) = EnterFunction : +# 19| mu19_2(unknown) = AliasedDefinition : +# 19| mu19_3(unknown) = InitializeNonLocal : +# 19| r19_4(glval) = VariableAddress[#this] : +# 19| mu19_5(glval) = InitializeParameter[#this] : &:r19_4 +# 19| r19_6(glval) = Load[#this] : &:r19_4, ~m? +# 19| mu19_7(Point) = InitializeIndirection[#this] : &:r19_6 +#-----| r0_1(glval) = VariableAddress[(unnamed parameter 0)] : +#-----| mu0_2(Point &) = InitializeParameter[(unnamed parameter 0)] : &:r0_1 +#-----| r0_3(Point &) = Load[(unnamed parameter 0)] : &:r0_1, ~m? +#-----| mu0_4(unknown) = InitializeIndirection[(unnamed parameter 0)] : &:r0_3 +# 19| r19_8(glval) = FieldAddress[x] : mu19_5 +# 19| r19_9(glval) = VariableAddress[(unnamed parameter 0)] : +# 19| r19_10(Point &) = Load[(unnamed parameter 0)] : &:r19_9, ~m? +# 19| r19_11(glval) = FieldAddress[x] : r19_10 +# 19| r19_12(int) = Load[?] : &:r19_11, ~m? +# 19| mu19_13(int) = Store[?] : &:r19_8, r19_12 +# 19| r19_14(glval) = FieldAddress[y] : mu19_5 +# 19| r19_15(glval) = VariableAddress[(unnamed parameter 0)] : +# 19| r19_16(Point &) = Load[(unnamed parameter 0)] : &:r19_15, ~m? +# 19| r19_17(glval) = FieldAddress[y] : r19_16 +# 19| r19_18(int) = Load[?] : &:r19_17, ~m? +# 19| mu19_19(int) = Store[?] : &:r19_14, r19_18 +# 19| v19_20(void) = NoOp : +# 19| v19_21(void) = ReturnIndirection[#this] : &:r19_6, ~m? +#-----| v0_5(void) = ReturnIndirection[(unnamed parameter 0)] : &:r0_3, ~m? +# 19| v19_22(void) = ReturnVoid : +# 19| v19_23(void) = AliasedUse : ~m? +# 19| v19_24(void) = ExitFunction : # 22| void Bad::Point::Point() # 22| Block 0 @@ -8076,55 +8080,71 @@ ir.cpp: # 1486| void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct(StructuredBindingDataMemberStruct const&) # 1486| Block 0 -# 1486| v1486_1(void) = EnterFunction : -# 1486| mu1486_2(unknown) = AliasedDefinition : -# 1486| mu1486_3(unknown) = InitializeNonLocal : -# 1486| r1486_4(glval) = VariableAddress[#this] : -# 1486| mu1486_5(glval) = InitializeParameter[#this] : &:r1486_4 -# 1486| r1486_6(glval) = Load[#this] : &:r1486_4, ~m? -# 1486| mu1486_7(StructuredBindingDataMemberStruct) = InitializeIndirection[#this] : &:r1486_6 -#-----| r0_1(glval) = VariableAddress[(unnamed parameter 0)] : -#-----| mu0_2(StructuredBindingDataMemberStruct &) = InitializeParameter[(unnamed parameter 0)] : &:r0_1 -#-----| r0_3(StructuredBindingDataMemberStruct &) = Load[(unnamed parameter 0)] : &:r0_1, ~m? -#-----| mu0_4(unknown) = InitializeIndirection[(unnamed parameter 0)] : &:r0_3 -# 1486| r1486_8(glval) = FieldAddress[i] : mu1486_5 - -# 1486| Block 1 -# 1486| mu1486_9(int) = Store[?] : &:r1486_8 -# 1486| r1486_10(glval) = FieldAddress[d] : mu1486_5 - -# 1486| Block 2 -# 1486| mu1486_11(double) = Store[?] : &:r1486_10 -# 1486| r1486_12(glval) = FieldAddress[b] : mu1486_5 - -# 1486| Block 3 -# 1486| mu1486_13(unsigned int) = Store[?] : &:r1486_12 -# 1486| r1486_14(glval) = FieldAddress[r] : mu1486_5 - -# 1486| Block 4 -# 1486| mu1486_15(int &) = Store[?] : &:r1486_14 -# 1486| r1486_16(glval) = FieldAddress[p] : mu1486_5 - -# 1486| Block 5 -# 1486| mu1486_17(int *) = Store[?] : &:r1486_16 -# 1486| r1486_18(glval) = FieldAddress[xs] : mu1486_5 - -# 1486| Block 6 -# 1486| mu1486_19(int[2]) = Store[?] : &:r1486_18 -# 1486| r1486_20(glval) = FieldAddress[r_alt] : mu1486_5 - -# 1486| Block 7 -# 1486| mu1486_21(int &) = Store[?] : &:r1486_20 -# 1486| r1486_22(glval) = FieldAddress[m] : mu1486_5 - -# 1486| Block 8 -# 1486| mu1486_23(StructuredBindingDataMemberMemberStruct) = Store[?] : &:r1486_22 -# 1486| v1486_24(void) = NoOp : -# 1486| v1486_25(void) = ReturnIndirection[#this] : &:r1486_6, ~m? -#-----| v0_5(void) = ReturnIndirection[(unnamed parameter 0)] : &:r0_3, ~m? -# 1486| v1486_26(void) = ReturnVoid : -# 1486| v1486_27(void) = AliasedUse : ~m? -# 1486| v1486_28(void) = ExitFunction : +# 1486| v1486_1(void) = EnterFunction : +# 1486| mu1486_2(unknown) = AliasedDefinition : +# 1486| mu1486_3(unknown) = InitializeNonLocal : +# 1486| r1486_4(glval) = VariableAddress[#this] : +# 1486| mu1486_5(glval) = InitializeParameter[#this] : &:r1486_4 +# 1486| r1486_6(glval) = Load[#this] : &:r1486_4, ~m? +# 1486| mu1486_7(StructuredBindingDataMemberStruct) = InitializeIndirection[#this] : &:r1486_6 +#-----| r0_1(glval) = VariableAddress[(unnamed parameter 0)] : +#-----| mu0_2(StructuredBindingDataMemberStruct &) = InitializeParameter[(unnamed parameter 0)] : &:r0_1 +#-----| r0_3(StructuredBindingDataMemberStruct &) = Load[(unnamed parameter 0)] : &:r0_1, ~m? +#-----| mu0_4(unknown) = InitializeIndirection[(unnamed parameter 0)] : &:r0_3 +# 1486| r1486_8(glval) = FieldAddress[i] : mu1486_5 +# 1486| r1486_9(glval) = VariableAddress[(unnamed parameter 0)] : +# 1486| r1486_10(StructuredBindingDataMemberStruct &) = Load[(unnamed parameter 0)] : &:r1486_9, ~m? +# 1486| r1486_11(glval) = FieldAddress[i] : r1486_10 +# 1486| r1486_12(int) = Load[?] : &:r1486_11, ~m? +# 1486| mu1486_13(int) = Store[?] : &:r1486_8, r1486_12 +# 1486| r1486_14(glval) = FieldAddress[d] : mu1486_5 +# 1486| r1486_15(glval) = VariableAddress[(unnamed parameter 0)] : +# 1486| r1486_16(StructuredBindingDataMemberStruct &) = Load[(unnamed parameter 0)] : &:r1486_15, ~m? +# 1486| r1486_17(glval) = FieldAddress[d] : r1486_16 +# 1486| r1486_18(double) = Load[?] : &:r1486_17, ~m? +# 1486| mu1486_19(double) = Store[?] : &:r1486_14, r1486_18 +# 1486| r1486_20(glval) = FieldAddress[b] : mu1486_5 +# 1486| r1486_21(glval) = VariableAddress[(unnamed parameter 0)] : +# 1486| r1486_22(StructuredBindingDataMemberStruct &) = Load[(unnamed parameter 0)] : &:r1486_21, ~m? +# 1486| r1486_23(glval) = FieldAddress[b] : r1486_22 +# 1486| r1486_24(unsigned int) = Load[?] : &:r1486_23, ~m? +# 1486| mu1486_25(unsigned int) = Store[?] : &:r1486_20, r1486_24 +# 1486| r1486_26(glval) = FieldAddress[r] : mu1486_5 +# 1486| r1486_27(glval) = VariableAddress[(unnamed parameter 0)] : +# 1486| r1486_28(StructuredBindingDataMemberStruct &) = Load[(unnamed parameter 0)] : &:r1486_27, ~m? +# 1486| r1486_29(glval) = FieldAddress[r] : r1486_28 +# 1486| r1486_30(int &) = Load[?] : &:r1486_29, ~m? +# 1486| mu1486_31(int &) = Store[?] : &:r1486_26, r1486_30 +# 1486| r1486_32(glval) = FieldAddress[p] : mu1486_5 +# 1486| r1486_33(glval) = VariableAddress[(unnamed parameter 0)] : +# 1486| r1486_34(StructuredBindingDataMemberStruct &) = Load[(unnamed parameter 0)] : &:r1486_33, ~m? +# 1486| r1486_35(glval) = FieldAddress[p] : r1486_34 +# 1486| r1486_36(int *) = Load[?] : &:r1486_35, ~m? +# 1486| mu1486_37(int *) = Store[?] : &:r1486_32, r1486_36 +# 1486| r1486_38(glval) = FieldAddress[xs] : mu1486_5 +# 1486| r1486_39(glval) = VariableAddress[(unnamed parameter 0)] : +# 1486| r1486_40(StructuredBindingDataMemberStruct &) = Load[(unnamed parameter 0)] : &:r1486_39, ~m? +# 1486| r1486_41(glval) = FieldAddress[xs] : r1486_40 +# 1486| r1486_42(int[2]) = Load[?] : &:r1486_41, ~m? +# 1486| mu1486_43(int[2]) = Store[?] : &:r1486_38, r1486_42 +# 1486| r1486_44(glval) = FieldAddress[r_alt] : mu1486_5 +# 1486| r1486_45(glval) = VariableAddress[(unnamed parameter 0)] : +# 1486| r1486_46(StructuredBindingDataMemberStruct &) = Load[(unnamed parameter 0)] : &:r1486_45, ~m? +# 1486| r1486_47(glval) = FieldAddress[r_alt] : r1486_46 +# 1486| r1486_48(int &) = Load[?] : &:r1486_47, ~m? +# 1486| mu1486_49(int &) = Store[?] : &:r1486_44, r1486_48 +# 1486| r1486_50(glval) = FieldAddress[m] : mu1486_5 +# 1486| r1486_51(glval) = VariableAddress[(unnamed parameter 0)] : +# 1486| r1486_52(StructuredBindingDataMemberStruct &) = Load[(unnamed parameter 0)] : &:r1486_51, ~m? +# 1486| r1486_53(glval) = FieldAddress[m] : r1486_52 +# 1486| r1486_54(StructuredBindingDataMemberMemberStruct) = Load[?] : &:r1486_53, ~m? +# 1486| mu1486_55(StructuredBindingDataMemberMemberStruct) = Store[?] : &:r1486_50, r1486_54 +# 1486| v1486_56(void) = NoOp : +# 1486| v1486_57(void) = ReturnIndirection[#this] : &:r1486_6, ~m? +#-----| v0_5(void) = ReturnIndirection[(unnamed parameter 0)] : &:r0_3, ~m? +# 1486| v1486_58(void) = ReturnVoid : +# 1486| v1486_59(void) = AliasedUse : ~m? +# 1486| v1486_60(void) = ExitFunction : # 1499| void data_member_structured_binding() # 1499| Block 0 @@ -8308,35 +8328,41 @@ ir.cpp: # 1539| void StructuredBindingTupleRefGet::StructuredBindingTupleRefGet(StructuredBindingTupleRefGet const&) # 1539| Block 0 -# 1539| v1539_1(void) = EnterFunction : -# 1539| mu1539_2(unknown) = AliasedDefinition : -# 1539| mu1539_3(unknown) = InitializeNonLocal : -# 1539| r1539_4(glval) = VariableAddress[#this] : -# 1539| mu1539_5(glval) = InitializeParameter[#this] : &:r1539_4 -# 1539| r1539_6(glval) = Load[#this] : &:r1539_4, ~m? -# 1539| mu1539_7(StructuredBindingTupleRefGet) = InitializeIndirection[#this] : &:r1539_6 -#-----| r0_1(glval) = VariableAddress[(unnamed parameter 0)] : -#-----| mu0_2(StructuredBindingTupleRefGet &) = InitializeParameter[(unnamed parameter 0)] : &:r0_1 -#-----| r0_3(StructuredBindingTupleRefGet &) = Load[(unnamed parameter 0)] : &:r0_1, ~m? -#-----| mu0_4(unknown) = InitializeIndirection[(unnamed parameter 0)] : &:r0_3 -# 1539| r1539_8(glval) = FieldAddress[i] : mu1539_5 - -# 1539| Block 1 -# 1539| mu1539_9(int) = Store[?] : &:r1539_8 -# 1539| r1539_10(glval) = FieldAddress[d] : mu1539_5 - -# 1539| Block 2 -# 1539| mu1539_11(double) = Store[?] : &:r1539_10 -# 1539| r1539_12(glval) = FieldAddress[r] : mu1539_5 - -# 1539| Block 3 -# 1539| mu1539_13(int &) = Store[?] : &:r1539_12 -# 1539| v1539_14(void) = NoOp : -# 1539| v1539_15(void) = ReturnIndirection[#this] : &:r1539_6, ~m? -#-----| v0_5(void) = ReturnIndirection[(unnamed parameter 0)] : &:r0_3, ~m? -# 1539| v1539_16(void) = ReturnVoid : -# 1539| v1539_17(void) = AliasedUse : ~m? -# 1539| v1539_18(void) = ExitFunction : +# 1539| v1539_1(void) = EnterFunction : +# 1539| mu1539_2(unknown) = AliasedDefinition : +# 1539| mu1539_3(unknown) = InitializeNonLocal : +# 1539| r1539_4(glval) = VariableAddress[#this] : +# 1539| mu1539_5(glval) = InitializeParameter[#this] : &:r1539_4 +# 1539| r1539_6(glval) = Load[#this] : &:r1539_4, ~m? +# 1539| mu1539_7(StructuredBindingTupleRefGet) = InitializeIndirection[#this] : &:r1539_6 +#-----| r0_1(glval) = VariableAddress[(unnamed parameter 0)] : +#-----| mu0_2(StructuredBindingTupleRefGet &) = InitializeParameter[(unnamed parameter 0)] : &:r0_1 +#-----| r0_3(StructuredBindingTupleRefGet &) = Load[(unnamed parameter 0)] : &:r0_1, ~m? +#-----| mu0_4(unknown) = InitializeIndirection[(unnamed parameter 0)] : &:r0_3 +# 1539| r1539_8(glval) = FieldAddress[i] : mu1539_5 +# 1539| r1539_9(glval) = VariableAddress[(unnamed parameter 0)] : +# 1539| r1539_10(StructuredBindingTupleRefGet &) = Load[(unnamed parameter 0)] : &:r1539_9, ~m? +# 1539| r1539_11(glval) = FieldAddress[i] : r1539_10 +# 1539| r1539_12(int) = Load[?] : &:r1539_11, ~m? +# 1539| mu1539_13(int) = Store[?] : &:r1539_8, r1539_12 +# 1539| r1539_14(glval) = FieldAddress[d] : mu1539_5 +# 1539| r1539_15(glval) = VariableAddress[(unnamed parameter 0)] : +# 1539| r1539_16(StructuredBindingTupleRefGet &) = Load[(unnamed parameter 0)] : &:r1539_15, ~m? +# 1539| r1539_17(glval) = FieldAddress[d] : r1539_16 +# 1539| r1539_18(double) = Load[?] : &:r1539_17, ~m? +# 1539| mu1539_19(double) = Store[?] : &:r1539_14, r1539_18 +# 1539| r1539_20(glval) = FieldAddress[r] : mu1539_5 +# 1539| r1539_21(glval) = VariableAddress[(unnamed parameter 0)] : +# 1539| r1539_22(StructuredBindingTupleRefGet &) = Load[(unnamed parameter 0)] : &:r1539_21, ~m? +# 1539| r1539_23(glval) = FieldAddress[r] : r1539_22 +# 1539| r1539_24(int &) = Load[?] : &:r1539_23, ~m? +# 1539| mu1539_25(int &) = Store[?] : &:r1539_20, r1539_24 +# 1539| v1539_26(void) = NoOp : +# 1539| v1539_27(void) = ReturnIndirection[#this] : &:r1539_6, ~m? +#-----| v0_5(void) = ReturnIndirection[(unnamed parameter 0)] : &:r0_3, ~m? +# 1539| v1539_28(void) = ReturnVoid : +# 1539| v1539_29(void) = AliasedUse : ~m? +# 1539| v1539_30(void) = ExitFunction : # 1567| std::tuple_element::type& StructuredBindingTupleRefGet::get() # 1567| Block 0 diff --git a/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency.expected b/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency.expected index af812c0f1a0..b131121438c 100644 --- a/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency.expected +++ b/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency.expected @@ -6,9 +6,6 @@ missingOperandType duplicateChiOperand sideEffectWithoutPrimary instructionWithoutSuccessor -| bad_asts.cpp:19:10:19:10 | FieldAddress: constructor init of field x | Instruction 'FieldAddress: constructor init of field x' has no successors in function '$@'. | bad_asts.cpp:19:10:19:10 | void Bad::Point::Point(Bad::Point const&) | void Bad::Point::Point(Bad::Point const&) | -| ir.cpp:1486:8:1486:8 | FieldAddress: constructor init of field i | Instruction 'FieldAddress: constructor init of field i' has no successors in function '$@'. | ir.cpp:1486:8:1486:8 | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct(StructuredBindingDataMemberStruct const&) | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct(StructuredBindingDataMemberStruct const&) | -| ir.cpp:1539:8:1539:8 | FieldAddress: constructor init of field i | Instruction 'FieldAddress: constructor init of field i' has no successors in function '$@'. | ir.cpp:1539:8:1539:8 | void StructuredBindingTupleRefGet::StructuredBindingTupleRefGet(StructuredBindingTupleRefGet const&) | void StructuredBindingTupleRefGet::StructuredBindingTupleRefGet(StructuredBindingTupleRefGet const&) | | ir.cpp:1688:24:1690:5 | FieldAddress: {...} | Instruction 'FieldAddress: {...}' has no successors in function '$@'. | ir.cpp:1683:6:1683:20 | void captured_lambda(int, int&, int&&) | void captured_lambda(int, int&, int&&) | | ir.cpp:1689:28:1689:54 | FieldAddress: {...} | Instruction 'FieldAddress: {...}' has no successors in function '$@'. | ir.cpp:1688:46:1688:46 | void (void captured_lambda(int, int&, int&&))::(lambda [] type at line 1688, col. 25)::operator()() const | void (void captured_lambda(int, int&, int&&))::(lambda [] type at line 1688, col. 25)::operator()() const | ambiguousSuccessors diff --git a/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency_unsound.expected b/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency_unsound.expected index af812c0f1a0..b131121438c 100644 --- a/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency_unsound.expected +++ b/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency_unsound.expected @@ -6,9 +6,6 @@ missingOperandType duplicateChiOperand sideEffectWithoutPrimary instructionWithoutSuccessor -| bad_asts.cpp:19:10:19:10 | FieldAddress: constructor init of field x | Instruction 'FieldAddress: constructor init of field x' has no successors in function '$@'. | bad_asts.cpp:19:10:19:10 | void Bad::Point::Point(Bad::Point const&) | void Bad::Point::Point(Bad::Point const&) | -| ir.cpp:1486:8:1486:8 | FieldAddress: constructor init of field i | Instruction 'FieldAddress: constructor init of field i' has no successors in function '$@'. | ir.cpp:1486:8:1486:8 | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct(StructuredBindingDataMemberStruct const&) | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct(StructuredBindingDataMemberStruct const&) | -| ir.cpp:1539:8:1539:8 | FieldAddress: constructor init of field i | Instruction 'FieldAddress: constructor init of field i' has no successors in function '$@'. | ir.cpp:1539:8:1539:8 | void StructuredBindingTupleRefGet::StructuredBindingTupleRefGet(StructuredBindingTupleRefGet const&) | void StructuredBindingTupleRefGet::StructuredBindingTupleRefGet(StructuredBindingTupleRefGet const&) | | ir.cpp:1688:24:1690:5 | FieldAddress: {...} | Instruction 'FieldAddress: {...}' has no successors in function '$@'. | ir.cpp:1683:6:1683:20 | void captured_lambda(int, int&, int&&) | void captured_lambda(int, int&, int&&) | | ir.cpp:1689:28:1689:54 | FieldAddress: {...} | Instruction 'FieldAddress: {...}' has no successors in function '$@'. | ir.cpp:1688:46:1688:46 | void (void captured_lambda(int, int&, int&&))::(lambda [] type at line 1688, col. 25)::operator()() const | void (void captured_lambda(int, int&, int&&))::(lambda [] type at line 1688, col. 25)::operator()() const | ambiguousSuccessors From 9d4aac61fd0111931e654c6de6327f41b4f3a893 Mon Sep 17 00:00:00 2001 From: Robert Marsh Date: Wed, 30 Mar 2022 13:20:26 -0400 Subject: [PATCH 13/19] C++: add IR tests for global var with constructor --- .../ir/ir/aliased_ssa_consistency.expected | 6 +++++ .../aliased_ssa_consistency_unsound.expected | 6 +++++ cpp/ql/test/library-tests/ir/ir/ir.cpp | 5 ++++ .../ir/ir/operand_locations.expected | 12 ++++++++++ .../ir/ir/raw_consistency.expected | 6 +++++ .../test/library-tests/ir/ir/raw_ir.expected | 24 +++++++++++++++++++ .../ir/ir/unaliased_ssa_consistency.expected | 6 +++++ ...unaliased_ssa_consistency_unsound.expected | 6 +++++ 8 files changed, 71 insertions(+) diff --git a/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency.expected b/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency.expected index b131121438c..e77a7ae4665 100644 --- a/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency.expected +++ b/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency.expected @@ -13,6 +13,8 @@ unexplainedLoop unnecessaryPhiInstruction memoryOperandDefinitionIsUnmodeled operandAcrossFunctions +| ir.cpp:1705:18:1705:25 | Address | Operand 'Address' is used on instruction 'IndirectMayWriteSideEffect: call to constructor_only' in function '$@', but is defined on instruction 'VariableAddress: global_4' in function '$@'. | file://:0:0:0:0 | | | ir.cpp:1705:18:1705:25 | constructor_only global_4 | constructor_only global_4 | +| ir.cpp:1707:18:1707:25 | Address | Operand 'Address' is used on instruction 'IndirectMayWriteSideEffect: call to constructor_only' in function '$@', but is defined on instruction 'VariableAddress: global_5' in function '$@'. | file://:0:0:0:0 | | | ir.cpp:1707:18:1707:25 | constructor_only global_5 | constructor_only global_5 | instructionWithoutUniqueBlock containsLoopOfForwardEdges lostReachability @@ -23,6 +25,10 @@ notMarkedAsConflated wronglyMarkedAsConflated invalidOverlap nonUniqueEnclosingIRFunction +| ir.cpp:1705:27:1705:28 | CallSideEffect: call to constructor_only | Instruction 'CallSideEffect: call to constructor_only' has 0 results for `getEnclosingIRFunction()` in function '$@'. | file://:0:0:0:0 | | | +| ir.cpp:1705:27:1705:28 | IndirectMayWriteSideEffect: call to constructor_only | Instruction 'IndirectMayWriteSideEffect: call to constructor_only' has 0 results for `getEnclosingIRFunction()` in function '$@'. | file://:0:0:0:0 | | | +| ir.cpp:1707:28:1707:47 | CallSideEffect: call to constructor_only | Instruction 'CallSideEffect: call to constructor_only' has 0 results for `getEnclosingIRFunction()` in function '$@'. | file://:0:0:0:0 | | | +| ir.cpp:1707:28:1707:47 | IndirectMayWriteSideEffect: call to constructor_only | Instruction 'IndirectMayWriteSideEffect: call to constructor_only' has 0 results for `getEnclosingIRFunction()` in function '$@'. | file://:0:0:0:0 | | | fieldAddressOnNonPointer thisArgumentIsNonPointer missingCanonicalLanguageType diff --git a/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency_unsound.expected b/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency_unsound.expected index b131121438c..e77a7ae4665 100644 --- a/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency_unsound.expected +++ b/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency_unsound.expected @@ -13,6 +13,8 @@ unexplainedLoop unnecessaryPhiInstruction memoryOperandDefinitionIsUnmodeled operandAcrossFunctions +| ir.cpp:1705:18:1705:25 | Address | Operand 'Address' is used on instruction 'IndirectMayWriteSideEffect: call to constructor_only' in function '$@', but is defined on instruction 'VariableAddress: global_4' in function '$@'. | file://:0:0:0:0 | | | ir.cpp:1705:18:1705:25 | constructor_only global_4 | constructor_only global_4 | +| ir.cpp:1707:18:1707:25 | Address | Operand 'Address' is used on instruction 'IndirectMayWriteSideEffect: call to constructor_only' in function '$@', but is defined on instruction 'VariableAddress: global_5' in function '$@'. | file://:0:0:0:0 | | | ir.cpp:1707:18:1707:25 | constructor_only global_5 | constructor_only global_5 | instructionWithoutUniqueBlock containsLoopOfForwardEdges lostReachability @@ -23,6 +25,10 @@ notMarkedAsConflated wronglyMarkedAsConflated invalidOverlap nonUniqueEnclosingIRFunction +| ir.cpp:1705:27:1705:28 | CallSideEffect: call to constructor_only | Instruction 'CallSideEffect: call to constructor_only' has 0 results for `getEnclosingIRFunction()` in function '$@'. | file://:0:0:0:0 | | | +| ir.cpp:1705:27:1705:28 | IndirectMayWriteSideEffect: call to constructor_only | Instruction 'IndirectMayWriteSideEffect: call to constructor_only' has 0 results for `getEnclosingIRFunction()` in function '$@'. | file://:0:0:0:0 | | | +| ir.cpp:1707:28:1707:47 | CallSideEffect: call to constructor_only | Instruction 'CallSideEffect: call to constructor_only' has 0 results for `getEnclosingIRFunction()` in function '$@'. | file://:0:0:0:0 | | | +| ir.cpp:1707:28:1707:47 | IndirectMayWriteSideEffect: call to constructor_only | Instruction 'IndirectMayWriteSideEffect: call to constructor_only' has 0 results for `getEnclosingIRFunction()` in function '$@'. | file://:0:0:0:0 | | | fieldAddressOnNonPointer thisArgumentIsNonPointer missingCanonicalLanguageType diff --git a/cpp/ql/test/library-tests/ir/ir/ir.cpp b/cpp/ql/test/library-tests/ir/ir/ir.cpp index bf4d41dbae9..6407aec9350 100644 --- a/cpp/ql/test/library-tests/ir/ir/ir.cpp +++ b/cpp/ql/test/library-tests/ir/ir/ir.cpp @@ -1701,4 +1701,9 @@ int global_1; int global_2 = 1; const int global_3 = 2; + +constructor_only global_4(1); + +constructor_only global_5 = constructor_only(2); + // semmle-extractor-options: -std=c++17 --clang diff --git a/cpp/ql/test/library-tests/ir/ir/operand_locations.expected b/cpp/ql/test/library-tests/ir/ir/operand_locations.expected index 5f7b51cc1c7..09372c93ac7 100644 --- a/cpp/ql/test/library-tests/ir/ir/operand_locations.expected +++ b/cpp/ql/test/library-tests/ir/ir/operand_locations.expected @@ -7733,6 +7733,18 @@ | ir.cpp:1703:22:1703:22 | ChiPartial | partial:m1703_5 | | ir.cpp:1703:22:1703:22 | ChiTotal | total:m1703_2 | | ir.cpp:1703:22:1703:22 | StoreValue | r1703_4 | +| ir.cpp:1705:18:1705:25 | Address | &:r1705_3 | +| ir.cpp:1705:18:1705:25 | Arg(this) | this:r1705_3 | +| ir.cpp:1705:18:1705:25 | SideEffect | ~m1705_2 | +| ir.cpp:1705:27:1705:27 | Arg(0) | 0:r1705_5 | +| ir.cpp:1705:27:1705:28 | CallTarget | func:r1705_4 | +| ir.cpp:1705:27:1705:28 | SideEffect | ~m? | +| ir.cpp:1707:18:1707:25 | Address | &:r1707_3 | +| ir.cpp:1707:18:1707:25 | Arg(this) | this:r1707_3 | +| ir.cpp:1707:18:1707:25 | SideEffect | ~m1707_2 | +| ir.cpp:1707:28:1707:47 | CallTarget | func:r1707_4 | +| ir.cpp:1707:28:1707:47 | SideEffect | ~m? | +| ir.cpp:1707:46:1707:46 | Arg(0) | 0:r1707_5 | | perf-regression.cpp:6:3:6:5 | Address | &:r6_5 | | perf-regression.cpp:6:3:6:5 | Address | &:r6_5 | | perf-regression.cpp:6:3:6:5 | Address | &:r6_7 | diff --git a/cpp/ql/test/library-tests/ir/ir/raw_consistency.expected b/cpp/ql/test/library-tests/ir/ir/raw_consistency.expected index 52173741010..1faa63d0fa6 100644 --- a/cpp/ql/test/library-tests/ir/ir/raw_consistency.expected +++ b/cpp/ql/test/library-tests/ir/ir/raw_consistency.expected @@ -20,6 +20,8 @@ unexplainedLoop unnecessaryPhiInstruction memoryOperandDefinitionIsUnmodeled operandAcrossFunctions +| ir.cpp:1705:18:1705:25 | Address | Operand 'Address' is used on instruction 'IndirectMayWriteSideEffect: call to constructor_only' in function '$@', but is defined on instruction 'VariableAddress: global_4' in function '$@'. | file://:0:0:0:0 | | | ir.cpp:1705:18:1705:25 | constructor_only global_4 | constructor_only global_4 | +| ir.cpp:1707:18:1707:25 | Address | Operand 'Address' is used on instruction 'IndirectMayWriteSideEffect: call to constructor_only' in function '$@', but is defined on instruction 'VariableAddress: global_5' in function '$@'. | file://:0:0:0:0 | | | ir.cpp:1707:18:1707:25 | constructor_only global_5 | constructor_only global_5 | instructionWithoutUniqueBlock containsLoopOfForwardEdges lostReachability @@ -50,6 +52,10 @@ notMarkedAsConflated wronglyMarkedAsConflated invalidOverlap nonUniqueEnclosingIRFunction +| ir.cpp:1705:27:1705:28 | CallSideEffect: call to constructor_only | Instruction 'CallSideEffect: call to constructor_only' has 0 results for `getEnclosingIRFunction()` in function '$@'. | file://:0:0:0:0 | | | +| ir.cpp:1705:27:1705:28 | IndirectMayWriteSideEffect: call to constructor_only | Instruction 'IndirectMayWriteSideEffect: call to constructor_only' has 0 results for `getEnclosingIRFunction()` in function '$@'. | file://:0:0:0:0 | | | +| ir.cpp:1707:28:1707:47 | CallSideEffect: call to constructor_only | Instruction 'CallSideEffect: call to constructor_only' has 0 results for `getEnclosingIRFunction()` in function '$@'. | file://:0:0:0:0 | | | +| ir.cpp:1707:28:1707:47 | IndirectMayWriteSideEffect: call to constructor_only | Instruction 'IndirectMayWriteSideEffect: call to constructor_only' has 0 results for `getEnclosingIRFunction()` in function '$@'. | file://:0:0:0:0 | | | fieldAddressOnNonPointer thisArgumentIsNonPointer missingCanonicalLanguageType diff --git a/cpp/ql/test/library-tests/ir/ir/raw_ir.expected b/cpp/ql/test/library-tests/ir/ir/raw_ir.expected index d6d8ec871ee..8d9d67dbfea 100644 --- a/cpp/ql/test/library-tests/ir/ir/raw_ir.expected +++ b/cpp/ql/test/library-tests/ir/ir/raw_ir.expected @@ -9040,6 +9040,30 @@ ir.cpp: # 1703| v1703_7(void) = AliasedUse : ~m? # 1703| v1703_8(void) = ExitFunction : +# 1705| constructor_only global_4 +# 1705| Block 0 +# 1705| v1705_1(void) = EnterFunction : +# 1705| mu1705_2(unknown) = AliasedDefinition : +# 1705| r1705_3(glval) = VariableAddress : +# 1705| r1705_4(glval) = FunctionAddress[constructor_only] : +# 1705| r1705_5(int) = Constant[1] : +# 1705| v1705_6(void) = Call[constructor_only] : func:r1705_4, this:r1705_3, 0:r1705_5 +# 1705| v1705_7(void) = ReturnVoid : +# 1705| v1705_8(void) = AliasedUse : ~m? +# 1705| v1705_9(void) = ExitFunction : + +# 1707| constructor_only global_5 +# 1707| Block 0 +# 1707| v1707_1(void) = EnterFunction : +# 1707| mu1707_2(unknown) = AliasedDefinition : +# 1707| r1707_3(glval) = VariableAddress : +# 1707| r1707_4(glval) = FunctionAddress[constructor_only] : +# 1707| r1707_5(int) = Constant[2] : +# 1707| v1707_6(void) = Call[constructor_only] : func:r1707_4, this:r1707_3, 0:r1707_5 +# 1707| v1707_7(void) = ReturnVoid : +# 1707| v1707_8(void) = AliasedUse : ~m? +# 1707| v1707_9(void) = ExitFunction : + perf-regression.cpp: # 6| void Big::Big() # 6| Block 0 diff --git a/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency.expected b/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency.expected index b131121438c..e77a7ae4665 100644 --- a/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency.expected +++ b/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency.expected @@ -13,6 +13,8 @@ unexplainedLoop unnecessaryPhiInstruction memoryOperandDefinitionIsUnmodeled operandAcrossFunctions +| ir.cpp:1705:18:1705:25 | Address | Operand 'Address' is used on instruction 'IndirectMayWriteSideEffect: call to constructor_only' in function '$@', but is defined on instruction 'VariableAddress: global_4' in function '$@'. | file://:0:0:0:0 | | | ir.cpp:1705:18:1705:25 | constructor_only global_4 | constructor_only global_4 | +| ir.cpp:1707:18:1707:25 | Address | Operand 'Address' is used on instruction 'IndirectMayWriteSideEffect: call to constructor_only' in function '$@', but is defined on instruction 'VariableAddress: global_5' in function '$@'. | file://:0:0:0:0 | | | ir.cpp:1707:18:1707:25 | constructor_only global_5 | constructor_only global_5 | instructionWithoutUniqueBlock containsLoopOfForwardEdges lostReachability @@ -23,6 +25,10 @@ notMarkedAsConflated wronglyMarkedAsConflated invalidOverlap nonUniqueEnclosingIRFunction +| ir.cpp:1705:27:1705:28 | CallSideEffect: call to constructor_only | Instruction 'CallSideEffect: call to constructor_only' has 0 results for `getEnclosingIRFunction()` in function '$@'. | file://:0:0:0:0 | | | +| ir.cpp:1705:27:1705:28 | IndirectMayWriteSideEffect: call to constructor_only | Instruction 'IndirectMayWriteSideEffect: call to constructor_only' has 0 results for `getEnclosingIRFunction()` in function '$@'. | file://:0:0:0:0 | | | +| ir.cpp:1707:28:1707:47 | CallSideEffect: call to constructor_only | Instruction 'CallSideEffect: call to constructor_only' has 0 results for `getEnclosingIRFunction()` in function '$@'. | file://:0:0:0:0 | | | +| ir.cpp:1707:28:1707:47 | IndirectMayWriteSideEffect: call to constructor_only | Instruction 'IndirectMayWriteSideEffect: call to constructor_only' has 0 results for `getEnclosingIRFunction()` in function '$@'. | file://:0:0:0:0 | | | fieldAddressOnNonPointer thisArgumentIsNonPointer missingCanonicalLanguageType diff --git a/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency_unsound.expected b/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency_unsound.expected index b131121438c..e77a7ae4665 100644 --- a/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency_unsound.expected +++ b/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency_unsound.expected @@ -13,6 +13,8 @@ unexplainedLoop unnecessaryPhiInstruction memoryOperandDefinitionIsUnmodeled operandAcrossFunctions +| ir.cpp:1705:18:1705:25 | Address | Operand 'Address' is used on instruction 'IndirectMayWriteSideEffect: call to constructor_only' in function '$@', but is defined on instruction 'VariableAddress: global_4' in function '$@'. | file://:0:0:0:0 | | | ir.cpp:1705:18:1705:25 | constructor_only global_4 | constructor_only global_4 | +| ir.cpp:1707:18:1707:25 | Address | Operand 'Address' is used on instruction 'IndirectMayWriteSideEffect: call to constructor_only' in function '$@', but is defined on instruction 'VariableAddress: global_5' in function '$@'. | file://:0:0:0:0 | | | ir.cpp:1707:18:1707:25 | constructor_only global_5 | constructor_only global_5 | instructionWithoutUniqueBlock containsLoopOfForwardEdges lostReachability @@ -23,6 +25,10 @@ notMarkedAsConflated wronglyMarkedAsConflated invalidOverlap nonUniqueEnclosingIRFunction +| ir.cpp:1705:27:1705:28 | CallSideEffect: call to constructor_only | Instruction 'CallSideEffect: call to constructor_only' has 0 results for `getEnclosingIRFunction()` in function '$@'. | file://:0:0:0:0 | | | +| ir.cpp:1705:27:1705:28 | IndirectMayWriteSideEffect: call to constructor_only | Instruction 'IndirectMayWriteSideEffect: call to constructor_only' has 0 results for `getEnclosingIRFunction()` in function '$@'. | file://:0:0:0:0 | | | +| ir.cpp:1707:28:1707:47 | CallSideEffect: call to constructor_only | Instruction 'CallSideEffect: call to constructor_only' has 0 results for `getEnclosingIRFunction()` in function '$@'. | file://:0:0:0:0 | | | +| ir.cpp:1707:28:1707:47 | IndirectMayWriteSideEffect: call to constructor_only | Instruction 'IndirectMayWriteSideEffect: call to constructor_only' has 0 results for `getEnclosingIRFunction()` in function '$@'. | file://:0:0:0:0 | | | fieldAddressOnNonPointer thisArgumentIsNonPointer missingCanonicalLanguageType From fb0a848e5a868a9d3ce725a11c263a4c64462114 Mon Sep 17 00:00:00 2001 From: Robert Marsh Date: Wed, 30 Mar 2022 13:32:02 -0400 Subject: [PATCH 14/19] C++: fix inconsistency with global var constructor --- cpp/ql/lib/semmle/code/cpp/exprs/Expr.qll | 3 +++ .../raw/internal/TranslatedCall.qll | 11 ++--------- .../raw/internal/TranslatedExpr.qll | 3 +-- .../ir/ir/aliased_ssa_consistency.expected | 6 ------ .../ir/aliased_ssa_consistency_unsound.expected | 6 ------ .../ir/ir/operand_locations.expected | 16 ++++++++++++---- .../library-tests/ir/ir/raw_consistency.expected | 6 ------ cpp/ql/test/library-tests/ir/ir/raw_ir.expected | 16 ++++++++++------ .../ir/ir/unaliased_ssa_consistency.expected | 6 ------ .../unaliased_ssa_consistency_unsound.expected | 6 ------ 10 files changed, 28 insertions(+), 51 deletions(-) diff --git a/cpp/ql/lib/semmle/code/cpp/exprs/Expr.qll b/cpp/ql/lib/semmle/code/cpp/exprs/Expr.qll index 14399078231..55a59cc9588 100644 --- a/cpp/ql/lib/semmle/code/cpp/exprs/Expr.qll +++ b/cpp/ql/lib/semmle/code/cpp/exprs/Expr.qll @@ -49,6 +49,9 @@ class Expr extends StmtParent, @expr { /** Gets the enclosing variable of this expression, if any. */ Variable getEnclosingVariable() { result = exprEnclosingElement(this) } + /** Gets the enclosing variable or function of this expression. */ + Declaration getEnclosingDeclaration() { result = exprEnclosingElement(this) } + /** Gets a child of this expression. */ Expr getAChild() { exists(int n | result = this.getChild(n)) } diff --git a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedCall.qll b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedCall.qll index 66c601736af..f8960cd205d 100644 --- a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedCall.qll +++ b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedCall.qll @@ -180,7 +180,7 @@ abstract class TranslatedSideEffects extends TranslatedElement { /** DEPRECATED: Alias for getAst */ deprecated override Locatable getAST() { result = getAst() } - final override Function getFunction() { result = getExpr().getEnclosingFunction() } + final override Declaration getFunction() { result = getExpr().getEnclosingDeclaration() } final override TranslatedElement getChild(int i) { result = @@ -375,7 +375,7 @@ abstract class TranslatedSideEffect extends TranslatedElement { kind instanceof GotoEdge } - final override Function getFunction() { result = getParent().getFunction() } + final override Declaration getFunction() { result = getParent().getFunction() } final override Instruction getPrimaryInstructionForSideEffect(InstructionTag tag) { tag = OnlyInstructionTag() and @@ -436,13 +436,6 @@ abstract class TranslatedArgumentSideEffect extends TranslatedSideEffect { result = index } - /** - * Gets the `TranslatedFunction` containing this expression. - */ - final TranslatedFunction getEnclosingFunction() { - result = getTranslatedFunction(call.getEnclosingFunction()) - } - final override predicate sideEffectInstruction(Opcode opcode, CppType type) { opcode = sideEffectOpcode and ( diff --git a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedExpr.qll b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedExpr.qll index 87b79de1c33..249312fd556 100644 --- a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedExpr.qll +++ b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedExpr.qll @@ -81,8 +81,7 @@ abstract class TranslatedExpr extends TranslatedElement { deprecated override Locatable getAST() { result = this.getAst() } final override Declaration getFunction() { - result = expr.getEnclosingFunction() or - result = expr.getEnclosingVariable().(GlobalOrNamespaceVariable) + result = expr.getEnclosingDeclaration() } /** diff --git a/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency.expected b/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency.expected index e77a7ae4665..b131121438c 100644 --- a/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency.expected +++ b/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency.expected @@ -13,8 +13,6 @@ unexplainedLoop unnecessaryPhiInstruction memoryOperandDefinitionIsUnmodeled operandAcrossFunctions -| ir.cpp:1705:18:1705:25 | Address | Operand 'Address' is used on instruction 'IndirectMayWriteSideEffect: call to constructor_only' in function '$@', but is defined on instruction 'VariableAddress: global_4' in function '$@'. | file://:0:0:0:0 | | | ir.cpp:1705:18:1705:25 | constructor_only global_4 | constructor_only global_4 | -| ir.cpp:1707:18:1707:25 | Address | Operand 'Address' is used on instruction 'IndirectMayWriteSideEffect: call to constructor_only' in function '$@', but is defined on instruction 'VariableAddress: global_5' in function '$@'. | file://:0:0:0:0 | | | ir.cpp:1707:18:1707:25 | constructor_only global_5 | constructor_only global_5 | instructionWithoutUniqueBlock containsLoopOfForwardEdges lostReachability @@ -25,10 +23,6 @@ notMarkedAsConflated wronglyMarkedAsConflated invalidOverlap nonUniqueEnclosingIRFunction -| ir.cpp:1705:27:1705:28 | CallSideEffect: call to constructor_only | Instruction 'CallSideEffect: call to constructor_only' has 0 results for `getEnclosingIRFunction()` in function '$@'. | file://:0:0:0:0 | | | -| ir.cpp:1705:27:1705:28 | IndirectMayWriteSideEffect: call to constructor_only | Instruction 'IndirectMayWriteSideEffect: call to constructor_only' has 0 results for `getEnclosingIRFunction()` in function '$@'. | file://:0:0:0:0 | | | -| ir.cpp:1707:28:1707:47 | CallSideEffect: call to constructor_only | Instruction 'CallSideEffect: call to constructor_only' has 0 results for `getEnclosingIRFunction()` in function '$@'. | file://:0:0:0:0 | | | -| ir.cpp:1707:28:1707:47 | IndirectMayWriteSideEffect: call to constructor_only | Instruction 'IndirectMayWriteSideEffect: call to constructor_only' has 0 results for `getEnclosingIRFunction()` in function '$@'. | file://:0:0:0:0 | | | fieldAddressOnNonPointer thisArgumentIsNonPointer missingCanonicalLanguageType diff --git a/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency_unsound.expected b/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency_unsound.expected index e77a7ae4665..b131121438c 100644 --- a/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency_unsound.expected +++ b/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency_unsound.expected @@ -13,8 +13,6 @@ unexplainedLoop unnecessaryPhiInstruction memoryOperandDefinitionIsUnmodeled operandAcrossFunctions -| ir.cpp:1705:18:1705:25 | Address | Operand 'Address' is used on instruction 'IndirectMayWriteSideEffect: call to constructor_only' in function '$@', but is defined on instruction 'VariableAddress: global_4' in function '$@'. | file://:0:0:0:0 | | | ir.cpp:1705:18:1705:25 | constructor_only global_4 | constructor_only global_4 | -| ir.cpp:1707:18:1707:25 | Address | Operand 'Address' is used on instruction 'IndirectMayWriteSideEffect: call to constructor_only' in function '$@', but is defined on instruction 'VariableAddress: global_5' in function '$@'. | file://:0:0:0:0 | | | ir.cpp:1707:18:1707:25 | constructor_only global_5 | constructor_only global_5 | instructionWithoutUniqueBlock containsLoopOfForwardEdges lostReachability @@ -25,10 +23,6 @@ notMarkedAsConflated wronglyMarkedAsConflated invalidOverlap nonUniqueEnclosingIRFunction -| ir.cpp:1705:27:1705:28 | CallSideEffect: call to constructor_only | Instruction 'CallSideEffect: call to constructor_only' has 0 results for `getEnclosingIRFunction()` in function '$@'. | file://:0:0:0:0 | | | -| ir.cpp:1705:27:1705:28 | IndirectMayWriteSideEffect: call to constructor_only | Instruction 'IndirectMayWriteSideEffect: call to constructor_only' has 0 results for `getEnclosingIRFunction()` in function '$@'. | file://:0:0:0:0 | | | -| ir.cpp:1707:28:1707:47 | CallSideEffect: call to constructor_only | Instruction 'CallSideEffect: call to constructor_only' has 0 results for `getEnclosingIRFunction()` in function '$@'. | file://:0:0:0:0 | | | -| ir.cpp:1707:28:1707:47 | IndirectMayWriteSideEffect: call to constructor_only | Instruction 'IndirectMayWriteSideEffect: call to constructor_only' has 0 results for `getEnclosingIRFunction()` in function '$@'. | file://:0:0:0:0 | | | fieldAddressOnNonPointer thisArgumentIsNonPointer missingCanonicalLanguageType diff --git a/cpp/ql/test/library-tests/ir/ir/operand_locations.expected b/cpp/ql/test/library-tests/ir/ir/operand_locations.expected index 09372c93ac7..d4790d61db7 100644 --- a/cpp/ql/test/library-tests/ir/ir/operand_locations.expected +++ b/cpp/ql/test/library-tests/ir/ir/operand_locations.expected @@ -7735,15 +7735,23 @@ | ir.cpp:1703:22:1703:22 | StoreValue | r1703_4 | | ir.cpp:1705:18:1705:25 | Address | &:r1705_3 | | ir.cpp:1705:18:1705:25 | Arg(this) | this:r1705_3 | -| ir.cpp:1705:18:1705:25 | SideEffect | ~m1705_2 | +| ir.cpp:1705:18:1705:25 | SideEffect | ~m1705_10 | | ir.cpp:1705:27:1705:27 | Arg(0) | 0:r1705_5 | | ir.cpp:1705:27:1705:28 | CallTarget | func:r1705_4 | -| ir.cpp:1705:27:1705:28 | SideEffect | ~m? | +| ir.cpp:1705:27:1705:28 | ChiPartial | partial:m1705_7 | +| ir.cpp:1705:27:1705:28 | ChiPartial | partial:m1705_9 | +| ir.cpp:1705:27:1705:28 | ChiTotal | total:m1705_2 | +| ir.cpp:1705:27:1705:28 | ChiTotal | total:m1705_8 | +| ir.cpp:1705:27:1705:28 | SideEffect | ~m1705_2 | | ir.cpp:1707:18:1707:25 | Address | &:r1707_3 | | ir.cpp:1707:18:1707:25 | Arg(this) | this:r1707_3 | -| ir.cpp:1707:18:1707:25 | SideEffect | ~m1707_2 | +| ir.cpp:1707:18:1707:25 | SideEffect | ~m1707_10 | | ir.cpp:1707:28:1707:47 | CallTarget | func:r1707_4 | -| ir.cpp:1707:28:1707:47 | SideEffect | ~m? | +| ir.cpp:1707:28:1707:47 | ChiPartial | partial:m1707_7 | +| ir.cpp:1707:28:1707:47 | ChiPartial | partial:m1707_9 | +| ir.cpp:1707:28:1707:47 | ChiTotal | total:m1707_2 | +| ir.cpp:1707:28:1707:47 | ChiTotal | total:m1707_8 | +| ir.cpp:1707:28:1707:47 | SideEffect | ~m1707_2 | | ir.cpp:1707:46:1707:46 | Arg(0) | 0:r1707_5 | | perf-regression.cpp:6:3:6:5 | Address | &:r6_5 | | perf-regression.cpp:6:3:6:5 | Address | &:r6_5 | diff --git a/cpp/ql/test/library-tests/ir/ir/raw_consistency.expected b/cpp/ql/test/library-tests/ir/ir/raw_consistency.expected index 1faa63d0fa6..52173741010 100644 --- a/cpp/ql/test/library-tests/ir/ir/raw_consistency.expected +++ b/cpp/ql/test/library-tests/ir/ir/raw_consistency.expected @@ -20,8 +20,6 @@ unexplainedLoop unnecessaryPhiInstruction memoryOperandDefinitionIsUnmodeled operandAcrossFunctions -| ir.cpp:1705:18:1705:25 | Address | Operand 'Address' is used on instruction 'IndirectMayWriteSideEffect: call to constructor_only' in function '$@', but is defined on instruction 'VariableAddress: global_4' in function '$@'. | file://:0:0:0:0 | | | ir.cpp:1705:18:1705:25 | constructor_only global_4 | constructor_only global_4 | -| ir.cpp:1707:18:1707:25 | Address | Operand 'Address' is used on instruction 'IndirectMayWriteSideEffect: call to constructor_only' in function '$@', but is defined on instruction 'VariableAddress: global_5' in function '$@'. | file://:0:0:0:0 | | | ir.cpp:1707:18:1707:25 | constructor_only global_5 | constructor_only global_5 | instructionWithoutUniqueBlock containsLoopOfForwardEdges lostReachability @@ -52,10 +50,6 @@ notMarkedAsConflated wronglyMarkedAsConflated invalidOverlap nonUniqueEnclosingIRFunction -| ir.cpp:1705:27:1705:28 | CallSideEffect: call to constructor_only | Instruction 'CallSideEffect: call to constructor_only' has 0 results for `getEnclosingIRFunction()` in function '$@'. | file://:0:0:0:0 | | | -| ir.cpp:1705:27:1705:28 | IndirectMayWriteSideEffect: call to constructor_only | Instruction 'IndirectMayWriteSideEffect: call to constructor_only' has 0 results for `getEnclosingIRFunction()` in function '$@'. | file://:0:0:0:0 | | | -| ir.cpp:1707:28:1707:47 | CallSideEffect: call to constructor_only | Instruction 'CallSideEffect: call to constructor_only' has 0 results for `getEnclosingIRFunction()` in function '$@'. | file://:0:0:0:0 | | | -| ir.cpp:1707:28:1707:47 | IndirectMayWriteSideEffect: call to constructor_only | Instruction 'IndirectMayWriteSideEffect: call to constructor_only' has 0 results for `getEnclosingIRFunction()` in function '$@'. | file://:0:0:0:0 | | | fieldAddressOnNonPointer thisArgumentIsNonPointer missingCanonicalLanguageType diff --git a/cpp/ql/test/library-tests/ir/ir/raw_ir.expected b/cpp/ql/test/library-tests/ir/ir/raw_ir.expected index 8d9d67dbfea..a65f3a338d3 100644 --- a/cpp/ql/test/library-tests/ir/ir/raw_ir.expected +++ b/cpp/ql/test/library-tests/ir/ir/raw_ir.expected @@ -9048,9 +9048,11 @@ ir.cpp: # 1705| r1705_4(glval) = FunctionAddress[constructor_only] : # 1705| r1705_5(int) = Constant[1] : # 1705| v1705_6(void) = Call[constructor_only] : func:r1705_4, this:r1705_3, 0:r1705_5 -# 1705| v1705_7(void) = ReturnVoid : -# 1705| v1705_8(void) = AliasedUse : ~m? -# 1705| v1705_9(void) = ExitFunction : +# 1705| mu1705_7(unknown) = ^CallSideEffect : ~m? +# 1705| mu1705_8(constructor_only) = ^IndirectMayWriteSideEffect[-1] : &:r1705_3 +# 1705| v1705_9(void) = ReturnVoid : +# 1705| v1705_10(void) = AliasedUse : ~m? +# 1705| v1705_11(void) = ExitFunction : # 1707| constructor_only global_5 # 1707| Block 0 @@ -9060,9 +9062,11 @@ ir.cpp: # 1707| r1707_4(glval) = FunctionAddress[constructor_only] : # 1707| r1707_5(int) = Constant[2] : # 1707| v1707_6(void) = Call[constructor_only] : func:r1707_4, this:r1707_3, 0:r1707_5 -# 1707| v1707_7(void) = ReturnVoid : -# 1707| v1707_8(void) = AliasedUse : ~m? -# 1707| v1707_9(void) = ExitFunction : +# 1707| mu1707_7(unknown) = ^CallSideEffect : ~m? +# 1707| mu1707_8(constructor_only) = ^IndirectMayWriteSideEffect[-1] : &:r1707_3 +# 1707| v1707_9(void) = ReturnVoid : +# 1707| v1707_10(void) = AliasedUse : ~m? +# 1707| v1707_11(void) = ExitFunction : perf-regression.cpp: # 6| void Big::Big() diff --git a/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency.expected b/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency.expected index e77a7ae4665..b131121438c 100644 --- a/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency.expected +++ b/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency.expected @@ -13,8 +13,6 @@ unexplainedLoop unnecessaryPhiInstruction memoryOperandDefinitionIsUnmodeled operandAcrossFunctions -| ir.cpp:1705:18:1705:25 | Address | Operand 'Address' is used on instruction 'IndirectMayWriteSideEffect: call to constructor_only' in function '$@', but is defined on instruction 'VariableAddress: global_4' in function '$@'. | file://:0:0:0:0 | | | ir.cpp:1705:18:1705:25 | constructor_only global_4 | constructor_only global_4 | -| ir.cpp:1707:18:1707:25 | Address | Operand 'Address' is used on instruction 'IndirectMayWriteSideEffect: call to constructor_only' in function '$@', but is defined on instruction 'VariableAddress: global_5' in function '$@'. | file://:0:0:0:0 | | | ir.cpp:1707:18:1707:25 | constructor_only global_5 | constructor_only global_5 | instructionWithoutUniqueBlock containsLoopOfForwardEdges lostReachability @@ -25,10 +23,6 @@ notMarkedAsConflated wronglyMarkedAsConflated invalidOverlap nonUniqueEnclosingIRFunction -| ir.cpp:1705:27:1705:28 | CallSideEffect: call to constructor_only | Instruction 'CallSideEffect: call to constructor_only' has 0 results for `getEnclosingIRFunction()` in function '$@'. | file://:0:0:0:0 | | | -| ir.cpp:1705:27:1705:28 | IndirectMayWriteSideEffect: call to constructor_only | Instruction 'IndirectMayWriteSideEffect: call to constructor_only' has 0 results for `getEnclosingIRFunction()` in function '$@'. | file://:0:0:0:0 | | | -| ir.cpp:1707:28:1707:47 | CallSideEffect: call to constructor_only | Instruction 'CallSideEffect: call to constructor_only' has 0 results for `getEnclosingIRFunction()` in function '$@'. | file://:0:0:0:0 | | | -| ir.cpp:1707:28:1707:47 | IndirectMayWriteSideEffect: call to constructor_only | Instruction 'IndirectMayWriteSideEffect: call to constructor_only' has 0 results for `getEnclosingIRFunction()` in function '$@'. | file://:0:0:0:0 | | | fieldAddressOnNonPointer thisArgumentIsNonPointer missingCanonicalLanguageType diff --git a/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency_unsound.expected b/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency_unsound.expected index e77a7ae4665..b131121438c 100644 --- a/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency_unsound.expected +++ b/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency_unsound.expected @@ -13,8 +13,6 @@ unexplainedLoop unnecessaryPhiInstruction memoryOperandDefinitionIsUnmodeled operandAcrossFunctions -| ir.cpp:1705:18:1705:25 | Address | Operand 'Address' is used on instruction 'IndirectMayWriteSideEffect: call to constructor_only' in function '$@', but is defined on instruction 'VariableAddress: global_4' in function '$@'. | file://:0:0:0:0 | | | ir.cpp:1705:18:1705:25 | constructor_only global_4 | constructor_only global_4 | -| ir.cpp:1707:18:1707:25 | Address | Operand 'Address' is used on instruction 'IndirectMayWriteSideEffect: call to constructor_only' in function '$@', but is defined on instruction 'VariableAddress: global_5' in function '$@'. | file://:0:0:0:0 | | | ir.cpp:1707:18:1707:25 | constructor_only global_5 | constructor_only global_5 | instructionWithoutUniqueBlock containsLoopOfForwardEdges lostReachability @@ -25,10 +23,6 @@ notMarkedAsConflated wronglyMarkedAsConflated invalidOverlap nonUniqueEnclosingIRFunction -| ir.cpp:1705:27:1705:28 | CallSideEffect: call to constructor_only | Instruction 'CallSideEffect: call to constructor_only' has 0 results for `getEnclosingIRFunction()` in function '$@'. | file://:0:0:0:0 | | | -| ir.cpp:1705:27:1705:28 | IndirectMayWriteSideEffect: call to constructor_only | Instruction 'IndirectMayWriteSideEffect: call to constructor_only' has 0 results for `getEnclosingIRFunction()` in function '$@'. | file://:0:0:0:0 | | | -| ir.cpp:1707:28:1707:47 | CallSideEffect: call to constructor_only | Instruction 'CallSideEffect: call to constructor_only' has 0 results for `getEnclosingIRFunction()` in function '$@'. | file://:0:0:0:0 | | | -| ir.cpp:1707:28:1707:47 | IndirectMayWriteSideEffect: call to constructor_only | Instruction 'IndirectMayWriteSideEffect: call to constructor_only' has 0 results for `getEnclosingIRFunction()` in function '$@'. | file://:0:0:0:0 | | | fieldAddressOnNonPointer thisArgumentIsNonPointer missingCanonicalLanguageType From e01799827aa16d631ecb6e3eb9fb7e02450b869f Mon Sep 17 00:00:00 2001 From: Robert Marsh Date: Wed, 30 Mar 2022 13:38:25 -0400 Subject: [PATCH 15/19] C++: add test for string global var inits in IR --- .../ir/ir/aliased_ssa_consistency.expected | 1 + .../ir/aliased_ssa_consistency_unsound.expected | 1 + cpp/ql/test/library-tests/ir/ir/ir.cpp | 2 ++ .../library-tests/ir/ir/raw_consistency.expected | 2 ++ cpp/ql/test/library-tests/ir/ir/raw_ir.expected | 16 ++++++++++++++++ .../ir/ir/unaliased_ssa_consistency.expected | 1 + .../unaliased_ssa_consistency_unsound.expected | 1 + 7 files changed, 24 insertions(+) diff --git a/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency.expected b/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency.expected index b131121438c..ad90fc5fb50 100644 --- a/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency.expected +++ b/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency.expected @@ -8,6 +8,7 @@ sideEffectWithoutPrimary instructionWithoutSuccessor | ir.cpp:1688:24:1690:5 | FieldAddress: {...} | Instruction 'FieldAddress: {...}' has no successors in function '$@'. | ir.cpp:1683:6:1683:20 | void captured_lambda(int, int&, int&&) | void captured_lambda(int, int&, int&&) | | ir.cpp:1689:28:1689:54 | FieldAddress: {...} | Instruction 'FieldAddress: {...}' has no successors in function '$@'. | ir.cpp:1688:46:1688:46 | void (void captured_lambda(int, int&, int&&))::(lambda [] type at line 1688, col. 25)::operator()() const | void (void captured_lambda(int, int&, int&&))::(lambda [] type at line 1688, col. 25)::operator()() const | +| ir.cpp:1709:7:1709:19 | VariableAddress: global_string | Instruction 'VariableAddress: global_string' has no successors in function '$@'. | ir.cpp:1709:7:1709:19 | char* global_string | char* global_string | ambiguousSuccessors unexplainedLoop unnecessaryPhiInstruction diff --git a/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency_unsound.expected b/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency_unsound.expected index b131121438c..ad90fc5fb50 100644 --- a/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency_unsound.expected +++ b/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency_unsound.expected @@ -8,6 +8,7 @@ sideEffectWithoutPrimary instructionWithoutSuccessor | ir.cpp:1688:24:1690:5 | FieldAddress: {...} | Instruction 'FieldAddress: {...}' has no successors in function '$@'. | ir.cpp:1683:6:1683:20 | void captured_lambda(int, int&, int&&) | void captured_lambda(int, int&, int&&) | | ir.cpp:1689:28:1689:54 | FieldAddress: {...} | Instruction 'FieldAddress: {...}' has no successors in function '$@'. | ir.cpp:1688:46:1688:46 | void (void captured_lambda(int, int&, int&&))::(lambda [] type at line 1688, col. 25)::operator()() const | void (void captured_lambda(int, int&, int&&))::(lambda [] type at line 1688, col. 25)::operator()() const | +| ir.cpp:1709:7:1709:19 | VariableAddress: global_string | Instruction 'VariableAddress: global_string' has no successors in function '$@'. | ir.cpp:1709:7:1709:19 | char* global_string | char* global_string | ambiguousSuccessors unexplainedLoop unnecessaryPhiInstruction diff --git a/cpp/ql/test/library-tests/ir/ir/ir.cpp b/cpp/ql/test/library-tests/ir/ir/ir.cpp index 6407aec9350..b4a8526471f 100644 --- a/cpp/ql/test/library-tests/ir/ir/ir.cpp +++ b/cpp/ql/test/library-tests/ir/ir/ir.cpp @@ -1706,4 +1706,6 @@ constructor_only global_4(1); constructor_only global_5 = constructor_only(2); +char *global_string = "global string"; + // semmle-extractor-options: -std=c++17 --clang diff --git a/cpp/ql/test/library-tests/ir/ir/raw_consistency.expected b/cpp/ql/test/library-tests/ir/ir/raw_consistency.expected index 52173741010..513524d0685 100644 --- a/cpp/ql/test/library-tests/ir/ir/raw_consistency.expected +++ b/cpp/ql/test/library-tests/ir/ir/raw_consistency.expected @@ -15,6 +15,8 @@ instructionWithoutSuccessor | ir.cpp:1688:24:1690:5 | FieldAddress: {...} | Instruction 'FieldAddress: {...}' has no successors in function '$@'. | ir.cpp:1683:6:1683:20 | void captured_lambda(int, int&, int&&) | void captured_lambda(int, int&, int&&) | | ir.cpp:1689:28:1689:54 | FieldAddress: {...} | Instruction 'FieldAddress: {...}' has no successors in function '$@'. | ir.cpp:1688:46:1688:46 | void (void captured_lambda(int, int&, int&&))::(lambda [] type at line 1688, col. 25)::operator()() const | void (void captured_lambda(int, int&, int&&))::(lambda [] type at line 1688, col. 25)::operator()() const | | ir.cpp:1689:28:1689:54 | FieldAddress: {...} | Instruction 'FieldAddress: {...}' has no successors in function '$@'. | ir.cpp:1688:46:1688:46 | void (void captured_lambda(int, int&, int&&))::(lambda [] type at line 1688, col. 25)::operator()() const | void (void captured_lambda(int, int&, int&&))::(lambda [] type at line 1688, col. 25)::operator()() const | +| ir.cpp:1709:7:1709:19 | VariableAddress: global_string | Instruction 'VariableAddress: global_string' has no successors in function '$@'. | ir.cpp:1709:7:1709:19 | char* global_string | char* global_string | +| ir.cpp:1709:23:1709:37 | Convert: (char *)... | Instruction 'Convert: (char *)...' has no successors in function '$@'. | ir.cpp:1709:7:1709:19 | char* global_string | char* global_string | ambiguousSuccessors unexplainedLoop unnecessaryPhiInstruction diff --git a/cpp/ql/test/library-tests/ir/ir/raw_ir.expected b/cpp/ql/test/library-tests/ir/ir/raw_ir.expected index a65f3a338d3..b97d31232d0 100644 --- a/cpp/ql/test/library-tests/ir/ir/raw_ir.expected +++ b/cpp/ql/test/library-tests/ir/ir/raw_ir.expected @@ -9068,6 +9068,22 @@ ir.cpp: # 1707| v1707_10(void) = AliasedUse : ~m? # 1707| v1707_11(void) = ExitFunction : +# 1709| char* global_string +# 1709| Block 0 +# 1709| v1709_1(void) = EnterFunction : +# 1709| mu1709_2(unknown) = AliasedDefinition : +# 1709| r1709_3(glval) = VariableAddress : + +# 1709| Block 1 +# 1709| v1709_4(void) = ReturnVoid : +# 1709| v1709_5(void) = AliasedUse : ~m? +# 1709| v1709_6(void) = ExitFunction : + +# 1709| Block 2 +# 1709| r1709_7(glval) = StringConstant : +# 1709| r1709_8(char *) = Convert : r1709_7 +# 1709| r1709_9(char *) = Convert : r1709_8 + perf-regression.cpp: # 6| void Big::Big() # 6| Block 0 diff --git a/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency.expected b/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency.expected index b131121438c..ad90fc5fb50 100644 --- a/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency.expected +++ b/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency.expected @@ -8,6 +8,7 @@ sideEffectWithoutPrimary instructionWithoutSuccessor | ir.cpp:1688:24:1690:5 | FieldAddress: {...} | Instruction 'FieldAddress: {...}' has no successors in function '$@'. | ir.cpp:1683:6:1683:20 | void captured_lambda(int, int&, int&&) | void captured_lambda(int, int&, int&&) | | ir.cpp:1689:28:1689:54 | FieldAddress: {...} | Instruction 'FieldAddress: {...}' has no successors in function '$@'. | ir.cpp:1688:46:1688:46 | void (void captured_lambda(int, int&, int&&))::(lambda [] type at line 1688, col. 25)::operator()() const | void (void captured_lambda(int, int&, int&&))::(lambda [] type at line 1688, col. 25)::operator()() const | +| ir.cpp:1709:7:1709:19 | VariableAddress: global_string | Instruction 'VariableAddress: global_string' has no successors in function '$@'. | ir.cpp:1709:7:1709:19 | char* global_string | char* global_string | ambiguousSuccessors unexplainedLoop unnecessaryPhiInstruction diff --git a/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency_unsound.expected b/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency_unsound.expected index b131121438c..ad90fc5fb50 100644 --- a/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency_unsound.expected +++ b/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency_unsound.expected @@ -8,6 +8,7 @@ sideEffectWithoutPrimary instructionWithoutSuccessor | ir.cpp:1688:24:1690:5 | FieldAddress: {...} | Instruction 'FieldAddress: {...}' has no successors in function '$@'. | ir.cpp:1683:6:1683:20 | void captured_lambda(int, int&, int&&) | void captured_lambda(int, int&, int&&) | | ir.cpp:1689:28:1689:54 | FieldAddress: {...} | Instruction 'FieldAddress: {...}' has no successors in function '$@'. | ir.cpp:1688:46:1688:46 | void (void captured_lambda(int, int&, int&&))::(lambda [] type at line 1688, col. 25)::operator()() const | void (void captured_lambda(int, int&, int&&))::(lambda [] type at line 1688, col. 25)::operator()() const | +| ir.cpp:1709:7:1709:19 | VariableAddress: global_string | Instruction 'VariableAddress: global_string' has no successors in function '$@'. | ir.cpp:1709:7:1709:19 | char* global_string | char* global_string | ambiguousSuccessors unexplainedLoop unnecessaryPhiInstruction From 3ce7c521d105e227d457665ad67bc4640c543caf Mon Sep 17 00:00:00 2001 From: Robert Marsh Date: Wed, 30 Mar 2022 14:01:59 -0400 Subject: [PATCH 16/19] C++: fix IR global var init for string constants --- .../raw/internal/IRConstruction.qll | 8 +++---- .../raw/internal/TranslatedGlobalVar.qll | 2 +- .../ir/ir/aliased_ssa_consistency.expected | 1 - .../aliased_ssa_consistency_unsound.expected | 1 - .../ir/ir/operand_locations.expected | 7 ++++++ .../ir/ir/raw_consistency.expected | 2 -- .../test/library-tests/ir/ir/raw_ir.expected | 23 ++++++++----------- .../ir/ir/unaliased_ssa_consistency.expected | 1 - ...unaliased_ssa_consistency_unsound.expected | 1 - 9 files changed, 22 insertions(+), 24 deletions(-) diff --git a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/IRConstruction.qll b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/IRConstruction.qll index 3901e1b36fb..ddd9ab50635 100644 --- a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/IRConstruction.qll +++ b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/IRConstruction.qll @@ -49,18 +49,18 @@ module Raw { } cached - predicate hasTempVariable(Function func, Locatable ast, TempVariableTag tag, CppType type) { + predicate hasTempVariable(Declaration decl, Locatable ast, TempVariableTag tag, CppType type) { exists(TranslatedElement element | element.getAst() = ast and - func = element.getFunction() and + decl = element.getFunction() and element.hasTempVariable(tag, type) ) } cached - predicate hasStringLiteral(Function func, Locatable ast, CppType type, StringLiteral literal) { + predicate hasStringLiteral(Declaration decl, Locatable ast, CppType type, StringLiteral literal) { literal = ast and - literal.getEnclosingFunction() = func and + literal.getEnclosingDeclaration() = decl and getTypeForPRValue(literal.getType()) = type } diff --git a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedGlobalVar.qll b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedGlobalVar.qll index af02b882386..3ff29c0ea91 100644 --- a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedGlobalVar.qll +++ b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedGlobalVar.qll @@ -24,7 +24,7 @@ class TranslatedGlobalOrNamespaceVarInit extends TranslatedRootElement, override Instruction getFirstInstruction() { result = this.getInstruction(EnterFunctionTag()) } override TranslatedElement getChild(int n) { - n = 1 and result = getTranslatedInitialization(var.getInitializer().getExpr()) + n = 1 and result = getTranslatedInitialization(var.getInitializer().getExpr().getFullyConverted()) } override predicate hasInstruction(Opcode op, InstructionTag tag, CppType type) { diff --git a/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency.expected b/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency.expected index ad90fc5fb50..b131121438c 100644 --- a/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency.expected +++ b/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency.expected @@ -8,7 +8,6 @@ sideEffectWithoutPrimary instructionWithoutSuccessor | ir.cpp:1688:24:1690:5 | FieldAddress: {...} | Instruction 'FieldAddress: {...}' has no successors in function '$@'. | ir.cpp:1683:6:1683:20 | void captured_lambda(int, int&, int&&) | void captured_lambda(int, int&, int&&) | | ir.cpp:1689:28:1689:54 | FieldAddress: {...} | Instruction 'FieldAddress: {...}' has no successors in function '$@'. | ir.cpp:1688:46:1688:46 | void (void captured_lambda(int, int&, int&&))::(lambda [] type at line 1688, col. 25)::operator()() const | void (void captured_lambda(int, int&, int&&))::(lambda [] type at line 1688, col. 25)::operator()() const | -| ir.cpp:1709:7:1709:19 | VariableAddress: global_string | Instruction 'VariableAddress: global_string' has no successors in function '$@'. | ir.cpp:1709:7:1709:19 | char* global_string | char* global_string | ambiguousSuccessors unexplainedLoop unnecessaryPhiInstruction diff --git a/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency_unsound.expected b/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency_unsound.expected index ad90fc5fb50..b131121438c 100644 --- a/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency_unsound.expected +++ b/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency_unsound.expected @@ -8,7 +8,6 @@ sideEffectWithoutPrimary instructionWithoutSuccessor | ir.cpp:1688:24:1690:5 | FieldAddress: {...} | Instruction 'FieldAddress: {...}' has no successors in function '$@'. | ir.cpp:1683:6:1683:20 | void captured_lambda(int, int&, int&&) | void captured_lambda(int, int&, int&&) | | ir.cpp:1689:28:1689:54 | FieldAddress: {...} | Instruction 'FieldAddress: {...}' has no successors in function '$@'. | ir.cpp:1688:46:1688:46 | void (void captured_lambda(int, int&, int&&))::(lambda [] type at line 1688, col. 25)::operator()() const | void (void captured_lambda(int, int&, int&&))::(lambda [] type at line 1688, col. 25)::operator()() const | -| ir.cpp:1709:7:1709:19 | VariableAddress: global_string | Instruction 'VariableAddress: global_string' has no successors in function '$@'. | ir.cpp:1709:7:1709:19 | char* global_string | char* global_string | ambiguousSuccessors unexplainedLoop unnecessaryPhiInstruction diff --git a/cpp/ql/test/library-tests/ir/ir/operand_locations.expected b/cpp/ql/test/library-tests/ir/ir/operand_locations.expected index d4790d61db7..cf3459029be 100644 --- a/cpp/ql/test/library-tests/ir/ir/operand_locations.expected +++ b/cpp/ql/test/library-tests/ir/ir/operand_locations.expected @@ -7753,6 +7753,13 @@ | ir.cpp:1707:28:1707:47 | ChiTotal | total:m1707_8 | | ir.cpp:1707:28:1707:47 | SideEffect | ~m1707_2 | | ir.cpp:1707:46:1707:46 | Arg(0) | 0:r1707_5 | +| ir.cpp:1709:7:1709:19 | Address | &:r1709_3 | +| ir.cpp:1709:7:1709:19 | SideEffect | ~m1709_8 | +| ir.cpp:1709:23:1709:37 | ChiPartial | partial:m1709_7 | +| ir.cpp:1709:23:1709:37 | ChiTotal | total:m1709_2 | +| ir.cpp:1709:23:1709:37 | StoreValue | r1709_6 | +| ir.cpp:1709:23:1709:37 | Unary | r1709_4 | +| ir.cpp:1709:23:1709:37 | Unary | r1709_5 | | perf-regression.cpp:6:3:6:5 | Address | &:r6_5 | | perf-regression.cpp:6:3:6:5 | Address | &:r6_5 | | perf-regression.cpp:6:3:6:5 | Address | &:r6_7 | diff --git a/cpp/ql/test/library-tests/ir/ir/raw_consistency.expected b/cpp/ql/test/library-tests/ir/ir/raw_consistency.expected index 513524d0685..52173741010 100644 --- a/cpp/ql/test/library-tests/ir/ir/raw_consistency.expected +++ b/cpp/ql/test/library-tests/ir/ir/raw_consistency.expected @@ -15,8 +15,6 @@ instructionWithoutSuccessor | ir.cpp:1688:24:1690:5 | FieldAddress: {...} | Instruction 'FieldAddress: {...}' has no successors in function '$@'. | ir.cpp:1683:6:1683:20 | void captured_lambda(int, int&, int&&) | void captured_lambda(int, int&, int&&) | | ir.cpp:1689:28:1689:54 | FieldAddress: {...} | Instruction 'FieldAddress: {...}' has no successors in function '$@'. | ir.cpp:1688:46:1688:46 | void (void captured_lambda(int, int&, int&&))::(lambda [] type at line 1688, col. 25)::operator()() const | void (void captured_lambda(int, int&, int&&))::(lambda [] type at line 1688, col. 25)::operator()() const | | ir.cpp:1689:28:1689:54 | FieldAddress: {...} | Instruction 'FieldAddress: {...}' has no successors in function '$@'. | ir.cpp:1688:46:1688:46 | void (void captured_lambda(int, int&, int&&))::(lambda [] type at line 1688, col. 25)::operator()() const | void (void captured_lambda(int, int&, int&&))::(lambda [] type at line 1688, col. 25)::operator()() const | -| ir.cpp:1709:7:1709:19 | VariableAddress: global_string | Instruction 'VariableAddress: global_string' has no successors in function '$@'. | ir.cpp:1709:7:1709:19 | char* global_string | char* global_string | -| ir.cpp:1709:23:1709:37 | Convert: (char *)... | Instruction 'Convert: (char *)...' has no successors in function '$@'. | ir.cpp:1709:7:1709:19 | char* global_string | char* global_string | ambiguousSuccessors unexplainedLoop unnecessaryPhiInstruction diff --git a/cpp/ql/test/library-tests/ir/ir/raw_ir.expected b/cpp/ql/test/library-tests/ir/ir/raw_ir.expected index b97d31232d0..a544454d456 100644 --- a/cpp/ql/test/library-tests/ir/ir/raw_ir.expected +++ b/cpp/ql/test/library-tests/ir/ir/raw_ir.expected @@ -9070,19 +9070,16 @@ ir.cpp: # 1709| char* global_string # 1709| Block 0 -# 1709| v1709_1(void) = EnterFunction : -# 1709| mu1709_2(unknown) = AliasedDefinition : -# 1709| r1709_3(glval) = VariableAddress : - -# 1709| Block 1 -# 1709| v1709_4(void) = ReturnVoid : -# 1709| v1709_5(void) = AliasedUse : ~m? -# 1709| v1709_6(void) = ExitFunction : - -# 1709| Block 2 -# 1709| r1709_7(glval) = StringConstant : -# 1709| r1709_8(char *) = Convert : r1709_7 -# 1709| r1709_9(char *) = Convert : r1709_8 +# 1709| v1709_1(void) = EnterFunction : +# 1709| mu1709_2(unknown) = AliasedDefinition : +# 1709| r1709_3(glval) = VariableAddress : +# 1709| r1709_4(glval) = StringConstant : +# 1709| r1709_5(char *) = Convert : r1709_4 +# 1709| r1709_6(char *) = Convert : r1709_5 +# 1709| mu1709_7(char *) = Store[?] : &:r1709_3, r1709_6 +# 1709| v1709_8(void) = ReturnVoid : +# 1709| v1709_9(void) = AliasedUse : ~m? +# 1709| v1709_10(void) = ExitFunction : perf-regression.cpp: # 6| void Big::Big() diff --git a/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency.expected b/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency.expected index ad90fc5fb50..b131121438c 100644 --- a/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency.expected +++ b/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency.expected @@ -8,7 +8,6 @@ sideEffectWithoutPrimary instructionWithoutSuccessor | ir.cpp:1688:24:1690:5 | FieldAddress: {...} | Instruction 'FieldAddress: {...}' has no successors in function '$@'. | ir.cpp:1683:6:1683:20 | void captured_lambda(int, int&, int&&) | void captured_lambda(int, int&, int&&) | | ir.cpp:1689:28:1689:54 | FieldAddress: {...} | Instruction 'FieldAddress: {...}' has no successors in function '$@'. | ir.cpp:1688:46:1688:46 | void (void captured_lambda(int, int&, int&&))::(lambda [] type at line 1688, col. 25)::operator()() const | void (void captured_lambda(int, int&, int&&))::(lambda [] type at line 1688, col. 25)::operator()() const | -| ir.cpp:1709:7:1709:19 | VariableAddress: global_string | Instruction 'VariableAddress: global_string' has no successors in function '$@'. | ir.cpp:1709:7:1709:19 | char* global_string | char* global_string | ambiguousSuccessors unexplainedLoop unnecessaryPhiInstruction diff --git a/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency_unsound.expected b/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency_unsound.expected index ad90fc5fb50..b131121438c 100644 --- a/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency_unsound.expected +++ b/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency_unsound.expected @@ -8,7 +8,6 @@ sideEffectWithoutPrimary instructionWithoutSuccessor | ir.cpp:1688:24:1690:5 | FieldAddress: {...} | Instruction 'FieldAddress: {...}' has no successors in function '$@'. | ir.cpp:1683:6:1683:20 | void captured_lambda(int, int&, int&&) | void captured_lambda(int, int&, int&&) | | ir.cpp:1689:28:1689:54 | FieldAddress: {...} | Instruction 'FieldAddress: {...}' has no successors in function '$@'. | ir.cpp:1688:46:1688:46 | void (void captured_lambda(int, int&, int&&))::(lambda [] type at line 1688, col. 25)::operator()() const | void (void captured_lambda(int, int&, int&&))::(lambda [] type at line 1688, col. 25)::operator()() const | -| ir.cpp:1709:7:1709:19 | VariableAddress: global_string | Instruction 'VariableAddress: global_string' has no successors in function '$@'. | ir.cpp:1709:7:1709:19 | char* global_string | char* global_string | ambiguousSuccessors unexplainedLoop unnecessaryPhiInstruction From 0e3e35f2335fe3bea59fd92b71f619fdd2e85f02 Mon Sep 17 00:00:00 2001 From: Robert Marsh Date: Tue, 12 Apr 2022 11:21:41 -0400 Subject: [PATCH 17/19] C++: don't dump global vars without initializers --- cpp/ql/test/library-tests/ir/ir/PrintConfig.qll | 9 ++++++++- cpp/ql/test/library-tests/ir/ir/raw_ir.expected | 8 -------- cpp/ql/test/library-tests/ir/ir/raw_ir.ql | 2 +- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/cpp/ql/test/library-tests/ir/ir/PrintConfig.qll b/cpp/ql/test/library-tests/ir/ir/PrintConfig.qll index ccf243386fe..a9167597691 100644 --- a/cpp/ql/test/library-tests/ir/ir/PrintConfig.qll +++ b/cpp/ql/test/library-tests/ir/ir/PrintConfig.qll @@ -12,4 +12,11 @@ predicate locationIsInStandardHeaders(Location loc) { * * This predicate excludes functions defined in standard headers. */ -predicate shouldDumpFunction(Function func) { not locationIsInStandardHeaders(func.getLocation()) } +predicate shouldDumpFunction(Declaration decl) { + not locationIsInStandardHeaders(decl.getLocation()) and + ( + not decl instanceof Variable + or + decl.(GlobalOrNamespaceVariable).hasInitializer() + ) +} diff --git a/cpp/ql/test/library-tests/ir/ir/raw_ir.expected b/cpp/ql/test/library-tests/ir/ir/raw_ir.expected index a544454d456..f13340ca360 100644 --- a/cpp/ql/test/library-tests/ir/ir/raw_ir.expected +++ b/cpp/ql/test/library-tests/ir/ir/raw_ir.expected @@ -139,8 +139,6 @@ bad_asts.cpp: # 30| v30_6(void) = ExitFunction : clang.cpp: -# 3| int globalInt - # 5| int* globalIntAddress() # 5| Block 0 # 5| v5_1(void) = EnterFunction : @@ -2226,8 +2224,6 @@ ir.cpp: # 341| v341_11(void) = AliasedUse : ~m? # 341| v341_12(void) = ExitFunction : -# 346| int g - # 348| int* AddressOf() # 348| Block 0 # 348| v348_1(void) = EnterFunction : @@ -9016,8 +9012,6 @@ ir.cpp: # 1693| v1693_6(void) = AliasedUse : ~m? # 1693| v1693_7(void) = ExitFunction : -# 1699| int global_1 - # 1701| int global_2 # 1701| Block 0 # 1701| v1701_1(void) = EnterFunction : @@ -9330,8 +9324,6 @@ struct_init.cpp: # 9| v9_9(void) = AliasedUse : ~m? # 9| v9_10(void) = ExitFunction : -# 14| Info* global_pointer - # 16| void let_info_escape(Info*) # 16| Block 0 # 16| v16_1(void) = EnterFunction : diff --git a/cpp/ql/test/library-tests/ir/ir/raw_ir.ql b/cpp/ql/test/library-tests/ir/ir/raw_ir.ql index 4e64ca4153b..55493a7e136 100644 --- a/cpp/ql/test/library-tests/ir/ir/raw_ir.ql +++ b/cpp/ql/test/library-tests/ir/ir/raw_ir.ql @@ -8,6 +8,6 @@ private import PrintConfig private class PrintConfig extends PrintIRConfiguration { override predicate shouldPrintFunction(Declaration decl) { - shouldDumpFunction(decl) or decl instanceof GlobalOrNamespaceVariable + shouldDumpFunction(decl) } } From f94fcf11cd6d4b84f6501c7d4c563680e04e993a Mon Sep 17 00:00:00 2001 From: Robert Marsh Date: Tue, 19 Apr 2022 13:06:48 -0400 Subject: [PATCH 18/19] C++: accept dataflow test changes --- .../dataflow-ir-consistency.expected | 16 + .../library-tests/ir/ir/PrintAST.expected | 174 ++++-- .../ir/ir/aliased_ssa_consistency.expected | 6 - .../aliased_ssa_consistency_unsound.expected | 6 - .../ir/ir/operand_locations.expected | 378 +++++++++--- .../ir/ir/raw_consistency.expected | 68 --- .../test/library-tests/ir/ir/raw_ir.expected | 570 ++++++++++-------- .../ir/ir/unaliased_ssa_consistency.expected | 6 - ...unaliased_ssa_consistency_unsound.expected | 6 - .../aliased_ssa_consistency.expected | 4 + .../dataflow-ir-consistency.expected | 46 ++ .../diff_ir_expr.expected | 3 - .../GlobalValueNumbering/ir_gvn.expected | 55 ++ 13 files changed, 859 insertions(+), 479 deletions(-) diff --git a/cpp/ql/test/library-tests/dataflow/dataflow-tests/dataflow-ir-consistency.expected b/cpp/ql/test/library-tests/dataflow/dataflow-tests/dataflow-ir-consistency.expected index 6b3e01b0e77..76fb37f9cab 100644 --- a/cpp/ql/test/library-tests/dataflow/dataflow-tests/dataflow-ir-consistency.expected +++ b/cpp/ql/test/library-tests/dataflow/dataflow-tests/dataflow-ir-consistency.expected @@ -1,4 +1,18 @@ uniqueEnclosingCallable +| globals.cpp:9:5:9:19 | Address | Node should have one enclosing callable but has 0. | +| globals.cpp:9:5:9:19 | VariableAddress | Node should have one enclosing callable but has 0. | +| globals.cpp:9:5:9:19 | VariableAddress [post update] | Node should have one enclosing callable but has 0. | +| globals.cpp:9:23:9:23 | 0 | Node should have one enclosing callable but has 0. | +| globals.cpp:9:23:9:23 | ChiPartial | Node should have one enclosing callable but has 0. | +| globals.cpp:9:23:9:23 | Store | Node should have one enclosing callable but has 0. | +| globals.cpp:9:23:9:23 | StoreValue | Node should have one enclosing callable but has 0. | +| globals.cpp:16:12:16:26 | Address | Node should have one enclosing callable but has 0. | +| globals.cpp:16:12:16:26 | VariableAddress | Node should have one enclosing callable but has 0. | +| globals.cpp:16:12:16:26 | VariableAddress [post update] | Node should have one enclosing callable but has 0. | +| globals.cpp:16:30:16:30 | 0 | Node should have one enclosing callable but has 0. | +| globals.cpp:16:30:16:30 | ChiPartial | Node should have one enclosing callable but has 0. | +| globals.cpp:16:30:16:30 | Store | Node should have one enclosing callable but has 0. | +| globals.cpp:16:30:16:30 | StoreValue | Node should have one enclosing callable but has 0. | uniqueType uniqueNodeLocation | BarrierGuard.cpp:2:11:2:13 | (unnamed parameter 0) | Node should have one location but has 6. | @@ -199,7 +213,9 @@ postWithInFlow | example.c:28:22:28:25 | & ... [post update] | PostUpdateNode should not be the target of local flow. | | example.c:28:23:28:25 | pos [post update] | PostUpdateNode should not be the target of local flow. | | globals.cpp:5:9:5:13 | VariableAddress [post update] | PostUpdateNode should not be the target of local flow. | +| globals.cpp:9:5:9:19 | VariableAddress [post update] | PostUpdateNode should not be the target of local flow. | | globals.cpp:13:5:13:19 | flowTestGlobal1 [post update] | PostUpdateNode should not be the target of local flow. | +| globals.cpp:16:12:16:26 | VariableAddress [post update] | PostUpdateNode should not be the target of local flow. | | globals.cpp:23:5:23:19 | flowTestGlobal2 [post update] | PostUpdateNode should not be the target of local flow. | | lambdas.cpp:8:6:8:6 | VariableAddress [post update] | PostUpdateNode should not be the target of local flow. | | lambdas.cpp:9:6:9:6 | VariableAddress [post update] | PostUpdateNode should not be the target of local flow. | diff --git a/cpp/ql/test/library-tests/ir/ir/PrintAST.expected b/cpp/ql/test/library-tests/ir/ir/PrintAST.expected index 4be286cd197..af029bf3748 100644 --- a/cpp/ql/test/library-tests/ir/ir/PrintAST.expected +++ b/cpp/ql/test/library-tests/ir/ir/PrintAST.expected @@ -155,21 +155,27 @@ bad_asts.cpp: # 19| getInitializer(0): [ConstructorFieldInit] constructor init of field x # 19| Type = [IntType] int # 19| ValueCategory = prvalue -# 19| getExpr(): [FieldAccess] x +# 19| getExpr(): [ReferenceFieldAccess] x # 19| Type = [IntType] int # 19| ValueCategory = prvalue(load) # 19| getQualifier(): [VariableAccess] (unnamed parameter 0) # 19| Type = [LValueReferenceType] const Point & # 19| ValueCategory = prvalue(load) +# 19| getQualifier().getFullyConverted(): [ReferenceDereferenceExpr] (reference dereference) +# 19| Type = [SpecifiedType] const Point +# 19| ValueCategory = lvalue # 19| getInitializer(1): [ConstructorFieldInit] constructor init of field y # 19| Type = [IntType] int # 19| ValueCategory = prvalue -# 19| getExpr(): [FieldAccess] y +# 19| getExpr(): [ReferenceFieldAccess] y # 19| Type = [IntType] int # 19| ValueCategory = prvalue(load) # 19| getQualifier(): [VariableAccess] (unnamed parameter 0) # 19| Type = [LValueReferenceType] const Point & # 19| ValueCategory = prvalue(load) +# 19| getQualifier().getFullyConverted(): [ReferenceDereferenceExpr] (reference dereference) +# 19| Type = [SpecifiedType] const Point +# 19| ValueCategory = lvalue # 19| getEntryPoint(): [BlockStmt] { ... } # 19| getStmt(0): [ReturnStmt] return ... # 19| [MoveConstructor] void Bad::Point::Point(Bad::Point&&) @@ -11651,75 +11657,99 @@ ir.cpp: # 1486| getInitializer(0): [ConstructorFieldInit] constructor init of field i # 1486| Type = [IntType] int # 1486| ValueCategory = prvalue -# 1486| getExpr(): [FieldAccess] i +# 1486| getExpr(): [ReferenceFieldAccess] i # 1486| Type = [IntType] int # 1486| ValueCategory = prvalue(load) # 1486| getQualifier(): [VariableAccess] (unnamed parameter 0) # 1486| Type = [LValueReferenceType] const StructuredBindingDataMemberStruct & # 1486| ValueCategory = prvalue(load) +# 1486| getQualifier().getFullyConverted(): [ReferenceDereferenceExpr] (reference dereference) +# 1486| Type = [SpecifiedType] const StructuredBindingDataMemberStruct +# 1486| ValueCategory = lvalue # 1486| getInitializer(1): [ConstructorFieldInit] constructor init of field d # 1486| Type = [DoubleType] double # 1486| ValueCategory = prvalue -# 1486| getExpr(): [FieldAccess] d +# 1486| getExpr(): [ReferenceFieldAccess] d # 1486| Type = [DoubleType] double # 1486| ValueCategory = prvalue(load) # 1486| getQualifier(): [VariableAccess] (unnamed parameter 0) # 1486| Type = [LValueReferenceType] const StructuredBindingDataMemberStruct & # 1486| ValueCategory = prvalue(load) +# 1486| getQualifier().getFullyConverted(): [ReferenceDereferenceExpr] (reference dereference) +# 1486| Type = [SpecifiedType] const StructuredBindingDataMemberStruct +# 1486| ValueCategory = lvalue # 1486| getInitializer(2): [ConstructorFieldInit] constructor init of field b # 1486| Type = [IntType] unsigned int # 1486| ValueCategory = prvalue -# 1486| getExpr(): [FieldAccess] b +# 1486| getExpr(): [ReferenceFieldAccess] b # 1486| Type = [IntType] unsigned int # 1486| ValueCategory = prvalue(load) # 1486| getQualifier(): [VariableAccess] (unnamed parameter 0) # 1486| Type = [LValueReferenceType] const StructuredBindingDataMemberStruct & # 1486| ValueCategory = prvalue(load) +# 1486| getQualifier().getFullyConverted(): [ReferenceDereferenceExpr] (reference dereference) +# 1486| Type = [SpecifiedType] const StructuredBindingDataMemberStruct +# 1486| ValueCategory = lvalue # 1486| getInitializer(3): [ConstructorFieldInit] constructor init of field r # 1486| Type = [LValueReferenceType] int & # 1486| ValueCategory = prvalue -# 1486| getExpr(): [FieldAccess] r +# 1486| getExpr(): [ReferenceFieldAccess] r # 1486| Type = [LValueReferenceType] int & # 1486| ValueCategory = prvalue(load) # 1486| getQualifier(): [VariableAccess] (unnamed parameter 0) # 1486| Type = [LValueReferenceType] const StructuredBindingDataMemberStruct & # 1486| ValueCategory = prvalue(load) +# 1486| getQualifier().getFullyConverted(): [ReferenceDereferenceExpr] (reference dereference) +# 1486| Type = [SpecifiedType] const StructuredBindingDataMemberStruct +# 1486| ValueCategory = lvalue # 1486| getInitializer(4): [ConstructorFieldInit] constructor init of field p # 1486| Type = [IntPointerType] int * # 1486| ValueCategory = prvalue -# 1486| getExpr(): [FieldAccess] p +# 1486| getExpr(): [ReferenceFieldAccess] p # 1486| Type = [IntPointerType] int * # 1486| ValueCategory = prvalue(load) # 1486| getQualifier(): [VariableAccess] (unnamed parameter 0) # 1486| Type = [LValueReferenceType] const StructuredBindingDataMemberStruct & # 1486| ValueCategory = prvalue(load) +# 1486| getQualifier().getFullyConverted(): [ReferenceDereferenceExpr] (reference dereference) +# 1486| Type = [SpecifiedType] const StructuredBindingDataMemberStruct +# 1486| ValueCategory = lvalue # 1486| getInitializer(5): [ConstructorFieldInit] constructor init of field xs # 1486| Type = [CTypedefType,NestedTypedefType] ArrayType # 1486| ValueCategory = prvalue -# 1486| getExpr(): [FieldAccess] xs +# 1486| getExpr(): [ReferenceFieldAccess] xs # 1486| Type = [CTypedefType,NestedTypedefType] ArrayType # 1486| ValueCategory = prvalue(load) # 1486| getQualifier(): [VariableAccess] (unnamed parameter 0) # 1486| Type = [LValueReferenceType] const StructuredBindingDataMemberStruct & # 1486| ValueCategory = prvalue(load) +# 1486| getQualifier().getFullyConverted(): [ReferenceDereferenceExpr] (reference dereference) +# 1486| Type = [SpecifiedType] const StructuredBindingDataMemberStruct +# 1486| ValueCategory = lvalue # 1486| getInitializer(6): [ConstructorFieldInit] constructor init of field r_alt # 1486| Type = [CTypedefType,NestedTypedefType] RefType # 1486| ValueCategory = prvalue -# 1486| getExpr(): [FieldAccess] r_alt +# 1486| getExpr(): [ReferenceFieldAccess] r_alt # 1486| Type = [CTypedefType,NestedTypedefType] RefType # 1486| ValueCategory = prvalue(load) # 1486| getQualifier(): [VariableAccess] (unnamed parameter 0) # 1486| Type = [LValueReferenceType] const StructuredBindingDataMemberStruct & # 1486| ValueCategory = prvalue(load) +# 1486| getQualifier().getFullyConverted(): [ReferenceDereferenceExpr] (reference dereference) +# 1486| Type = [SpecifiedType] const StructuredBindingDataMemberStruct +# 1486| ValueCategory = lvalue # 1486| getInitializer(7): [ConstructorFieldInit] constructor init of field m # 1486| Type = [Struct] StructuredBindingDataMemberMemberStruct # 1486| ValueCategory = prvalue -# 1486| getExpr(): [FieldAccess] m +# 1486| getExpr(): [ReferenceFieldAccess] m # 1486| Type = [Struct] StructuredBindingDataMemberMemberStruct # 1486| ValueCategory = prvalue(load) # 1486| getQualifier(): [VariableAccess] (unnamed parameter 0) # 1486| Type = [LValueReferenceType] const StructuredBindingDataMemberStruct & # 1486| ValueCategory = prvalue(load) +# 1486| getQualifier().getFullyConverted(): [ReferenceDereferenceExpr] (reference dereference) +# 1486| Type = [SpecifiedType] const StructuredBindingDataMemberStruct +# 1486| ValueCategory = lvalue # 1486| getEntryPoint(): [BlockStmt] { ... } # 1486| getStmt(0): [ReturnStmt] return ... # 1486| [MoveConstructor] void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct(StructuredBindingDataMemberStruct&&) @@ -12096,30 +12126,39 @@ ir.cpp: # 1539| getInitializer(0): [ConstructorFieldInit] constructor init of field i # 1539| Type = [IntType] int # 1539| ValueCategory = prvalue -# 1539| getExpr(): [FieldAccess] i +# 1539| getExpr(): [ReferenceFieldAccess] i # 1539| Type = [IntType] int # 1539| ValueCategory = prvalue(load) # 1539| getQualifier(): [VariableAccess] (unnamed parameter 0) # 1539| Type = [LValueReferenceType] const StructuredBindingTupleRefGet & # 1539| ValueCategory = prvalue(load) +# 1539| getQualifier().getFullyConverted(): [ReferenceDereferenceExpr] (reference dereference) +# 1539| Type = [SpecifiedType] const StructuredBindingTupleRefGet +# 1539| ValueCategory = lvalue # 1539| getInitializer(1): [ConstructorFieldInit] constructor init of field d # 1539| Type = [DoubleType] double # 1539| ValueCategory = prvalue -# 1539| getExpr(): [FieldAccess] d +# 1539| getExpr(): [ReferenceFieldAccess] d # 1539| Type = [DoubleType] double # 1539| ValueCategory = prvalue(load) # 1539| getQualifier(): [VariableAccess] (unnamed parameter 0) # 1539| Type = [LValueReferenceType] const StructuredBindingTupleRefGet & # 1539| ValueCategory = prvalue(load) +# 1539| getQualifier().getFullyConverted(): [ReferenceDereferenceExpr] (reference dereference) +# 1539| Type = [SpecifiedType] const StructuredBindingTupleRefGet +# 1539| ValueCategory = lvalue # 1539| getInitializer(2): [ConstructorFieldInit] constructor init of field r # 1539| Type = [LValueReferenceType] int & # 1539| ValueCategory = prvalue -# 1539| getExpr(): [FieldAccess] r +# 1539| getExpr(): [ReferenceFieldAccess] r # 1539| Type = [LValueReferenceType] int & # 1539| ValueCategory = prvalue(load) # 1539| getQualifier(): [VariableAccess] (unnamed parameter 0) # 1539| Type = [LValueReferenceType] const StructuredBindingTupleRefGet & # 1539| ValueCategory = prvalue(load) +# 1539| getQualifier().getFullyConverted(): [ReferenceDereferenceExpr] (reference dereference) +# 1539| Type = [SpecifiedType] const StructuredBindingTupleRefGet +# 1539| ValueCategory = lvalue # 1539| getEntryPoint(): [BlockStmt] { ... } # 1539| getStmt(0): [ReturnStmt] return ... # 1539| [MoveConstructor] void StructuredBindingTupleRefGet::StructuredBindingTupleRefGet(StructuredBindingTupleRefGet&&) @@ -12981,12 +13020,12 @@ ir.cpp: # 1688| getInitializer(): [ClassAggregateLiteral] {...} # 1688| Type = [Closure,LocalClass] decltype([...](...){...}) # 1688| ValueCategory = prvalue -# 1688| getFieldExpr(obj1): [Literal] Unknown literal -# 1688| Type = [SpecifiedType] const CapturedLambdaMyObj -# 1688| ValueCategory = prvalue -# 1688| getFieldExpr(obj2): [Literal] Unknown literal +# 1688| getFieldExpr(obj1): [VariableAccess] obj1 +# 1688| Type = [LValueReferenceType] const CapturedLambdaMyObj & +# 1688| ValueCategory = prvalue(load) +# 1688| getFieldExpr(obj2): [VariableAccess] obj2 # 1688| Type = [Class] CapturedLambdaMyObj -# 1688| ValueCategory = prvalue +# 1688| ValueCategory = prvalue(load) # 1688| getFieldExpr(x): [VariableAccess] x # 1688| Type = [IntType] int # 1688| ValueCategory = prvalue(load) @@ -12996,6 +13035,9 @@ ir.cpp: # 1688| getFieldExpr(z): [VariableAccess] z # 1688| Type = [RValueReferenceType] int && # 1688| ValueCategory = prvalue(load) +#-----| getFieldExpr(obj1).getFullyConverted(): [ReferenceDereferenceExpr] (reference dereference) +#-----| Type = [SpecifiedType] const CapturedLambdaMyObj +#-----| ValueCategory = prvalue(load) # 1690| getFieldExpr(y).getFullyConverted(): [ReferenceDereferenceExpr] (reference dereference) # 1690| Type = [IntType] int # 1690| ValueCategory = prvalue(load) @@ -13030,12 +13072,18 @@ ir.cpp: # 1689| getInitializer(): [ClassAggregateLiteral] {...} # 1689| Type = [Closure,LocalClass] decltype([...](...){...}) # 1689| ValueCategory = prvalue -# 1689| getFieldExpr(obj1): [Literal] Unknown literal +# 1689| getFieldExpr(obj1): [PointerFieldAccess] obj1 # 1689| Type = [SpecifiedType] const CapturedLambdaMyObj -# 1689| ValueCategory = prvalue -# 1689| getFieldExpr(obj2): [Literal] Unknown literal +# 1689| ValueCategory = prvalue(load) +# 1689| getQualifier(): [ThisExpr] this +# 1689| Type = [PointerType] lambda [] type at line 1689, col. 29 * +# 1689| ValueCategory = prvalue(load) +# 1689| getFieldExpr(obj2): [PointerFieldAccess] obj2 # 1689| Type = [Class] CapturedLambdaMyObj -# 1689| ValueCategory = prvalue +# 1689| ValueCategory = prvalue(load) +# 1689| getQualifier(): [ThisExpr] this +# 1689| Type = [PointerType] lambda [] type at line 1689, col. 29 * +# 1689| ValueCategory = prvalue(load) # 1689| getFieldExpr(x): [PointerFieldAccess] x # 1689| Type = [IntType] int # 1689| ValueCategory = prvalue(load) @@ -13112,9 +13160,12 @@ ir.cpp: # 1702| getInitializer(): [ClassAggregateLiteral] {...} # 1702| Type = [Closure,LocalClass] decltype([...](...){...}) # 1702| ValueCategory = prvalue -# 1702| getFieldExpr((captured this)): [Literal] Unknown literal +# 1702| getFieldExpr((captured this)): [PointerDereferenceExpr] * ... # 1702| Type = [SpecifiedType] const TrivialLambdaClass -# 1702| ValueCategory = prvalue +# 1702| ValueCategory = prvalue(load) +# 1702| getOperand(): [ThisExpr] this +# 1702| Type = [SpecifiedType] const TrivialLambdaClass *const +# 1702| ValueCategory = prvalue(load) # 1709| getStmt(1): [ReturnStmt] return ... # 1702| [CopyAssignmentOperator] (void TrivialLambdaClass::m() const)::(lambda [] type at line 1702, col. 26)& (void TrivialLambdaClass::m() const)::(lambda [] type at line 1702, col. 26)::operator=((void TrivialLambdaClass::m() const)::(lambda [] type at line 1702, col. 26) const&) # 1702| : @@ -13156,9 +13207,12 @@ ir.cpp: # 1705| getInitializer(): [ClassAggregateLiteral] {...} # 1705| Type = [Closure,LocalClass] decltype([...](...){...}) # 1705| ValueCategory = prvalue -# 1705| getFieldExpr((captured this)): [Literal] Unknown literal +# 1705| getFieldExpr((captured this)): [PointerFieldAccess] (captured this) # 1705| Type = [SpecifiedType] const TrivialLambdaClass -# 1705| ValueCategory = prvalue +# 1705| ValueCategory = prvalue(load) +# 1705| getQualifier(): [ThisExpr] this +# 1705| Type = [PointerType] lambda [] type at line 1705, col. 30 * +# 1705| ValueCategory = prvalue(load) # 1708| getStmt(2): [ReturnStmt] return ... # 1705| [CopyAssignmentOperator] (void (void TrivialLambdaClass::m() const)::(lambda [] type at line 1702, col. 26)::operator()() const)::(lambda [] type at line 1705, col. 30)& (void (void TrivialLambdaClass::m() const)::(lambda [] type at line 1702, col. 26)::operator()() const)::(lambda [] type at line 1705, col. 30)::operator=((void (void TrivialLambdaClass::m() const)::(lambda [] type at line 1702, col. 26)::operator()() const)::(lambda [] type at line 1705, col. 30) const&) # 1705| : @@ -13234,21 +13288,30 @@ ir.cpp: # 1716| getInitializer(): [ClassAggregateLiteral] {...} # 1716| Type = [Closure,LocalClass] decltype([...](...){...}) # 1716| ValueCategory = prvalue -# 1716| getFieldExpr(p1): [Literal] Unknown literal +# 1716| getFieldExpr(p1): [VariableAccess] p1 # 1716| Type = [Class] TrivialLambdaClass -# 1716| ValueCategory = prvalue -# 1716| getFieldExpr(p2): [Literal] Unknown literal -# 1716| Type = [Class] TrivialLambdaClass -# 1716| ValueCategory = prvalue -# 1716| getFieldExpr(p3): [Literal] Unknown literal -# 1716| Type = [Class] TrivialLambdaClass -# 1716| ValueCategory = prvalue -# 1716| getFieldExpr(l1): [Literal] Unknown literal +# 1716| ValueCategory = prvalue(load) +# 1716| getFieldExpr(p2): [VariableAccess] p2 +# 1716| Type = [LValueReferenceType] TrivialLambdaClass & +# 1716| ValueCategory = prvalue(load) +# 1716| getFieldExpr(p3): [VariableAccess] p3 +# 1716| Type = [RValueReferenceType] TrivialLambdaClass && +# 1716| ValueCategory = prvalue(load) +# 1716| getFieldExpr(l1): [VariableAccess] l1 # 1716| Type = [SpecifiedType] const TrivialLambdaClass -# 1716| ValueCategory = prvalue -# 1716| getFieldExpr(l2): [Literal] Unknown literal -# 1716| Type = [SpecifiedType] const TrivialLambdaClass -# 1716| ValueCategory = prvalue +# 1716| ValueCategory = prvalue(load) +# 1716| getFieldExpr(l2): [VariableAccess] l2 +# 1716| Type = [LValueReferenceType] const TrivialLambdaClass & +# 1716| ValueCategory = prvalue(load) +#-----| getFieldExpr(p2).getFullyConverted(): [ReferenceDereferenceExpr] (reference dereference) +#-----| Type = [Class] TrivialLambdaClass +#-----| ValueCategory = prvalue(load) +#-----| getFieldExpr(p3).getFullyConverted(): [ReferenceDereferenceExpr] (reference dereference) +#-----| Type = [Class] TrivialLambdaClass +#-----| ValueCategory = prvalue(load) +#-----| getFieldExpr(l2).getFullyConverted(): [ReferenceDereferenceExpr] (reference dereference) +#-----| Type = [SpecifiedType] const TrivialLambdaClass +#-----| ValueCategory = prvalue(load) # 1719| getStmt(3): [ReturnStmt] return ... # 1716| [CopyAssignmentOperator] (void captured_lambda2(TrivialLambdaClass, TrivialLambdaClass&, TrivialLambdaClass&&))::(lambda [] type at line 1716, col. 21)& (void captured_lambda2(TrivialLambdaClass, TrivialLambdaClass&, TrivialLambdaClass&&))::(lambda [] type at line 1716, col. 21)::operator=((void captured_lambda2(TrivialLambdaClass, TrivialLambdaClass&, TrivialLambdaClass&&))::(lambda [] type at line 1716, col. 21) const&) # 1716| : @@ -13277,9 +13340,12 @@ ir.cpp: # 1717| getInitializer(): [ClassAggregateLiteral] {...} # 1717| Type = [Closure,LocalClass] decltype([...](...){...}) # 1717| ValueCategory = prvalue -# 1717| getFieldExpr(p1): [Literal] Unknown literal +# 1717| getFieldExpr(p1): [PointerFieldAccess] p1 # 1717| Type = [Class] TrivialLambdaClass -# 1717| ValueCategory = prvalue +# 1717| ValueCategory = prvalue(load) +# 1717| getQualifier(): [ThisExpr] this +# 1717| Type = [PointerType] lambda [] type at line 1717, col. 25 * +# 1717| ValueCategory = prvalue(load) # 1718| getStmt(1): [ReturnStmt] return ... # 1717| [CopyAssignmentOperator] (void (void captured_lambda2(TrivialLambdaClass, TrivialLambdaClass&, TrivialLambdaClass&&))::(lambda [] type at line 1716, col. 21)::operator()() const)::(lambda [] type at line 1717, col. 25)& (void (void captured_lambda2(TrivialLambdaClass, TrivialLambdaClass&, TrivialLambdaClass&&))::(lambda [] type at line 1716, col. 21)::operator()() const)::(lambda [] type at line 1717, col. 25)::operator=((void (void captured_lambda2(TrivialLambdaClass, TrivialLambdaClass&, TrivialLambdaClass&&))::(lambda [] type at line 1716, col. 21)::operator()() const)::(lambda [] type at line 1717, col. 25) const&) # 1717| : @@ -13371,6 +13437,19 @@ ir.cpp: # 1736| getInitializer(0): [ConstructorDirectInit] call to CopyConstructorWithImplicitArgumentClass # 1736| Type = [VoidType] void # 1736| ValueCategory = prvalue +# 1736| getArgument(0): [VariableAccess] (unnamed parameter 0) +# 1736| Type = [LValueReferenceType] const CopyConstructorTestNonVirtualClass & +# 1736| ValueCategory = prvalue(load) +# 1736| getArgument(0).getFullyConverted(): [ReferenceToExpr] (reference to) +# 1736| Type = [LValueReferenceType] const CopyConstructorWithImplicitArgumentClass & +# 1736| ValueCategory = prvalue +# 1736| getExpr(): [CStyleCast] (const CopyConstructorWithImplicitArgumentClass)... +# 1736| Conversion = [BaseClassConversion] base class conversion +# 1736| Type = [SpecifiedType] const CopyConstructorWithImplicitArgumentClass +# 1736| ValueCategory = lvalue +# 1736| getExpr(): [ReferenceDereferenceExpr] (reference dereference) +# 1736| Type = [SpecifiedType] const CopyConstructorTestNonVirtualClass +# 1736| ValueCategory = lvalue # 1736| getInitializer(1): (no string representation) # 1736| Type = [VirtualBaseClass] CopyConstructorWithBitwiseCopyClass # 1736| ValueCategory = prvalue @@ -13407,6 +13486,19 @@ ir.cpp: # 1743| getInitializer(0): [ConstructorVirtualInit] call to CopyConstructorWithImplicitArgumentClass # 1743| Type = [VoidType] void # 1743| ValueCategory = prvalue +# 1743| getArgument(0): [VariableAccess] (unnamed parameter 0) +# 1743| Type = [LValueReferenceType] const CopyConstructorTestVirtualClass & +# 1743| ValueCategory = prvalue(load) +# 1743| getArgument(0).getFullyConverted(): [ReferenceToExpr] (reference to) +# 1743| Type = [LValueReferenceType] const CopyConstructorWithImplicitArgumentClass & +# 1743| ValueCategory = prvalue +# 1743| getExpr(): [CStyleCast] (const CopyConstructorWithImplicitArgumentClass)... +# 1743| Conversion = [BaseClassConversion] base class conversion +# 1743| Type = [SpecifiedType] const CopyConstructorWithImplicitArgumentClass +# 1743| ValueCategory = lvalue +# 1743| getExpr(): [ReferenceDereferenceExpr] (reference dereference) +# 1743| Type = [SpecifiedType] const CopyConstructorTestVirtualClass +# 1743| ValueCategory = lvalue # 1743| getInitializer(1): (no string representation) # 1743| Type = [VirtualBaseClass] CopyConstructorWithBitwiseCopyClass # 1743| ValueCategory = prvalue diff --git a/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency.expected b/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency.expected index 5cccae1da93..31e5b01229c 100644 --- a/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency.expected +++ b/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency.expected @@ -6,12 +6,6 @@ missingOperandType duplicateChiOperand sideEffectWithoutPrimary instructionWithoutSuccessor -| ir.cpp:1688:24:1690:5 | FieldAddress: {...} | Instruction 'FieldAddress: {...}' has no successors in function '$@'. | ir.cpp:1683:6:1683:20 | void captured_lambda(int, int&, int&&) | void captured_lambda(int, int&, int&&) | -| ir.cpp:1689:28:1689:54 | FieldAddress: {...} | Instruction 'FieldAddress: {...}' has no successors in function '$@'. | ir.cpp:1688:46:1688:46 | void (void captured_lambda(int, int&, int&&))::(lambda [] type at line 1688, col. 25)::operator()() const | void (void captured_lambda(int, int&, int&&))::(lambda [] type at line 1688, col. 25)::operator()() const | -| ir.cpp:1702:25:1708:9 | FieldAddress: {...} | Instruction 'FieldAddress: {...}' has no successors in function '$@'. | ir.cpp:1701:10:1701:10 | void TrivialLambdaClass::m() const | void TrivialLambdaClass::m() const | -| ir.cpp:1705:29:1707:13 | FieldAddress: {...} | Instruction 'FieldAddress: {...}' has no successors in function '$@'. | ir.cpp:1702:34:1702:34 | void (void TrivialLambdaClass::m() const)::(lambda [] type at line 1702, col. 26)::operator()() const | void (void TrivialLambdaClass::m() const)::(lambda [] type at line 1702, col. 26)::operator()() const | -| ir.cpp:1716:20:1718:5 | FieldAddress: {...} | Instruction 'FieldAddress: {...}' has no successors in function '$@'. | ir.cpp:1712:6:1712:21 | void captured_lambda2(TrivialLambdaClass, TrivialLambdaClass&, TrivialLambdaClass&&) | void captured_lambda2(TrivialLambdaClass, TrivialLambdaClass&, TrivialLambdaClass&&) | -| ir.cpp:1717:24:1717:31 | FieldAddress: {...} | Instruction 'FieldAddress: {...}' has no successors in function '$@'. | ir.cpp:1716:42:1716:42 | void (void captured_lambda2(TrivialLambdaClass, TrivialLambdaClass&, TrivialLambdaClass&&))::(lambda [] type at line 1716, col. 21)::operator()() const | void (void captured_lambda2(TrivialLambdaClass, TrivialLambdaClass&, TrivialLambdaClass&&))::(lambda [] type at line 1716, col. 21)::operator()() const | ambiguousSuccessors unexplainedLoop unnecessaryPhiInstruction diff --git a/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency_unsound.expected b/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency_unsound.expected index 5cccae1da93..31e5b01229c 100644 --- a/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency_unsound.expected +++ b/cpp/ql/test/library-tests/ir/ir/aliased_ssa_consistency_unsound.expected @@ -6,12 +6,6 @@ missingOperandType duplicateChiOperand sideEffectWithoutPrimary instructionWithoutSuccessor -| ir.cpp:1688:24:1690:5 | FieldAddress: {...} | Instruction 'FieldAddress: {...}' has no successors in function '$@'. | ir.cpp:1683:6:1683:20 | void captured_lambda(int, int&, int&&) | void captured_lambda(int, int&, int&&) | -| ir.cpp:1689:28:1689:54 | FieldAddress: {...} | Instruction 'FieldAddress: {...}' has no successors in function '$@'. | ir.cpp:1688:46:1688:46 | void (void captured_lambda(int, int&, int&&))::(lambda [] type at line 1688, col. 25)::operator()() const | void (void captured_lambda(int, int&, int&&))::(lambda [] type at line 1688, col. 25)::operator()() const | -| ir.cpp:1702:25:1708:9 | FieldAddress: {...} | Instruction 'FieldAddress: {...}' has no successors in function '$@'. | ir.cpp:1701:10:1701:10 | void TrivialLambdaClass::m() const | void TrivialLambdaClass::m() const | -| ir.cpp:1705:29:1707:13 | FieldAddress: {...} | Instruction 'FieldAddress: {...}' has no successors in function '$@'. | ir.cpp:1702:34:1702:34 | void (void TrivialLambdaClass::m() const)::(lambda [] type at line 1702, col. 26)::operator()() const | void (void TrivialLambdaClass::m() const)::(lambda [] type at line 1702, col. 26)::operator()() const | -| ir.cpp:1716:20:1718:5 | FieldAddress: {...} | Instruction 'FieldAddress: {...}' has no successors in function '$@'. | ir.cpp:1712:6:1712:21 | void captured_lambda2(TrivialLambdaClass, TrivialLambdaClass&, TrivialLambdaClass&&) | void captured_lambda2(TrivialLambdaClass, TrivialLambdaClass&, TrivialLambdaClass&&) | -| ir.cpp:1717:24:1717:31 | FieldAddress: {...} | Instruction 'FieldAddress: {...}' has no successors in function '$@'. | ir.cpp:1716:42:1716:42 | void (void captured_lambda2(TrivialLambdaClass, TrivialLambdaClass&, TrivialLambdaClass&&))::(lambda [] type at line 1716, col. 21)::operator()() const | void (void captured_lambda2(TrivialLambdaClass, TrivialLambdaClass&, TrivialLambdaClass&&))::(lambda [] type at line 1716, col. 21)::operator()() const | ambiguousSuccessors unexplainedLoop unnecessaryPhiInstruction diff --git a/cpp/ql/test/library-tests/ir/ir/operand_locations.expected b/cpp/ql/test/library-tests/ir/ir/operand_locations.expected index 2cc1cb037f0..dc0b45826ee 100644 --- a/cpp/ql/test/library-tests/ir/ir/operand_locations.expected +++ b/cpp/ql/test/library-tests/ir/ir/operand_locations.expected @@ -47,29 +47,31 @@ | bad_asts.cpp:19:10:19:10 | Address | &:r19_7 | | bad_asts.cpp:19:10:19:10 | Address | &:r19_9 | | bad_asts.cpp:19:10:19:10 | Address | &:r19_10 | -| bad_asts.cpp:19:10:19:10 | Address | &:r19_12 | -| bad_asts.cpp:19:10:19:10 | Address | &:r19_16 | +| bad_asts.cpp:19:10:19:10 | Address | &:r19_13 | | bad_asts.cpp:19:10:19:10 | Address | &:r19_17 | -| bad_asts.cpp:19:10:19:10 | Address | &:r19_19 | +| bad_asts.cpp:19:10:19:10 | Address | &:r19_18 | +| bad_asts.cpp:19:10:19:10 | Address | &:r19_21 | | bad_asts.cpp:19:10:19:10 | ChiPartial | partial:m19_3 | -| bad_asts.cpp:19:10:19:10 | ChiPartial | partial:m19_14 | -| bad_asts.cpp:19:10:19:10 | ChiPartial | partial:m19_21 | +| bad_asts.cpp:19:10:19:10 | ChiPartial | partial:m19_15 | +| bad_asts.cpp:19:10:19:10 | ChiPartial | partial:m19_23 | | bad_asts.cpp:19:10:19:10 | ChiTotal | total:m19_2 | | bad_asts.cpp:19:10:19:10 | ChiTotal | total:m19_8 | -| bad_asts.cpp:19:10:19:10 | ChiTotal | total:m19_15 | +| bad_asts.cpp:19:10:19:10 | ChiTotal | total:m19_16 | | bad_asts.cpp:19:10:19:10 | Load | m0_2 | | bad_asts.cpp:19:10:19:10 | Load | m0_2 | | bad_asts.cpp:19:10:19:10 | Load | m19_6 | | bad_asts.cpp:19:10:19:10 | Load | ~m0_4 | | bad_asts.cpp:19:10:19:10 | Load | ~m0_4 | | bad_asts.cpp:19:10:19:10 | SideEffect | m19_3 | -| bad_asts.cpp:19:10:19:10 | SideEffect | m19_22 | -| bad_asts.cpp:19:10:19:10 | StoreValue | r19_13 | -| bad_asts.cpp:19:10:19:10 | StoreValue | r19_20 | +| bad_asts.cpp:19:10:19:10 | SideEffect | m19_24 | +| bad_asts.cpp:19:10:19:10 | StoreValue | r19_14 | +| bad_asts.cpp:19:10:19:10 | StoreValue | r19_22 | | bad_asts.cpp:19:10:19:10 | Unary | m19_6 | | bad_asts.cpp:19:10:19:10 | Unary | m19_6 | | bad_asts.cpp:19:10:19:10 | Unary | r19_11 | -| bad_asts.cpp:19:10:19:10 | Unary | r19_18 | +| bad_asts.cpp:19:10:19:10 | Unary | r19_12 | +| bad_asts.cpp:19:10:19:10 | Unary | r19_19 | +| bad_asts.cpp:19:10:19:10 | Unary | r19_20 | | bad_asts.cpp:22:5:22:9 | Address | &:r22_5 | | bad_asts.cpp:22:5:22:9 | Address | &:r22_5 | | bad_asts.cpp:22:5:22:9 | Address | &:r22_7 | @@ -724,15 +726,23 @@ | file://:0:0:0:0 | Arg(0) | 0:r0_15 | | file://:0:0:0:0 | CallTarget | func:r0_1 | | file://:0:0:0:0 | ChiPartial | partial:m0_2 | +| file://:0:0:0:0 | ChiPartial | partial:m0_2 | +| file://:0:0:0:0 | ChiPartial | partial:m0_2 | | file://:0:0:0:0 | ChiPartial | partial:m0_3 | | file://:0:0:0:0 | ChiPartial | partial:m0_5 | +| file://:0:0:0:0 | ChiPartial | partial:m0_5 | +| file://:0:0:0:0 | ChiPartial | partial:m0_8 | | file://:0:0:0:0 | ChiPartial | partial:m0_11 | | file://:0:0:0:0 | ChiPartial | partial:m0_11 | +| file://:0:0:0:0 | ChiTotal | total:m0_3 | | file://:0:0:0:0 | ChiTotal | total:m0_4 | | file://:0:0:0:0 | ChiTotal | total:m754_8 | | file://:0:0:0:0 | ChiTotal | total:m763_8 | | file://:0:0:0:0 | ChiTotal | total:m1043_10 | | file://:0:0:0:0 | ChiTotal | total:m1240_4 | +| file://:0:0:0:0 | ChiTotal | total:m1688_3 | +| file://:0:0:0:0 | ChiTotal | total:m1716_8 | +| file://:0:0:0:0 | ChiTotal | total:m1716_19 | | file://:0:0:0:0 | Left | r0_2 | | file://:0:0:0:0 | Left | r0_4 | | file://:0:0:0:0 | Left | r0_7 | @@ -751,7 +761,11 @@ | file://:0:0:0:0 | Load | m763_6 | | file://:0:0:0:0 | Load | m1466_4 | | file://:0:0:0:0 | Load | m1466_4 | +| file://:0:0:0:0 | Load | m1685_9 | +| file://:0:0:0:0 | Load | m1714_7 | | file://:0:0:0:0 | Load | ~m1444_6 | +| file://:0:0:0:0 | Load | ~m1712_10 | +| file://:0:0:0:0 | Load | ~m1712_14 | | file://:0:0:0:0 | Right | r0_3 | | file://:0:0:0:0 | Right | r0_5 | | file://:0:0:0:0 | Right | r0_8 | @@ -788,9 +802,13 @@ | file://:0:0:0:0 | StoreValue | r0_1 | | file://:0:0:0:0 | StoreValue | r0_1 | | file://:0:0:0:0 | StoreValue | r0_1 | +| file://:0:0:0:0 | StoreValue | r0_1 | +| file://:0:0:0:0 | StoreValue | r0_1 | | file://:0:0:0:0 | StoreValue | r0_3 | | file://:0:0:0:0 | StoreValue | r0_4 | +| file://:0:0:0:0 | StoreValue | r0_4 | | file://:0:0:0:0 | StoreValue | r0_6 | +| file://:0:0:0:0 | StoreValue | r0_7 | | file://:0:0:0:0 | StoreValue | r0_9 | | file://:0:0:0:0 | StoreValue | r0_13 | | file://:0:0:0:0 | StoreValue | r0_13 | @@ -6846,48 +6864,48 @@ | ir.cpp:1486:8:1486:8 | Address | &:r1486_7 | | ir.cpp:1486:8:1486:8 | Address | &:r1486_9 | | ir.cpp:1486:8:1486:8 | Address | &:r1486_10 | -| ir.cpp:1486:8:1486:8 | Address | &:r1486_12 | -| ir.cpp:1486:8:1486:8 | Address | &:r1486_16 | +| ir.cpp:1486:8:1486:8 | Address | &:r1486_13 | | ir.cpp:1486:8:1486:8 | Address | &:r1486_17 | -| ir.cpp:1486:8:1486:8 | Address | &:r1486_19 | -| ir.cpp:1486:8:1486:8 | Address | &:r1486_23 | -| ir.cpp:1486:8:1486:8 | Address | &:r1486_24 | +| ir.cpp:1486:8:1486:8 | Address | &:r1486_18 | +| ir.cpp:1486:8:1486:8 | Address | &:r1486_21 | +| ir.cpp:1486:8:1486:8 | Address | &:r1486_25 | | ir.cpp:1486:8:1486:8 | Address | &:r1486_26 | -| ir.cpp:1486:8:1486:8 | Address | &:r1486_30 | -| ir.cpp:1486:8:1486:8 | Address | &:r1486_31 | +| ir.cpp:1486:8:1486:8 | Address | &:r1486_29 | | ir.cpp:1486:8:1486:8 | Address | &:r1486_33 | +| ir.cpp:1486:8:1486:8 | Address | &:r1486_34 | | ir.cpp:1486:8:1486:8 | Address | &:r1486_37 | -| ir.cpp:1486:8:1486:8 | Address | &:r1486_38 | -| ir.cpp:1486:8:1486:8 | Address | &:r1486_40 | -| ir.cpp:1486:8:1486:8 | Address | &:r1486_44 | +| ir.cpp:1486:8:1486:8 | Address | &:r1486_41 | +| ir.cpp:1486:8:1486:8 | Address | &:r1486_42 | | ir.cpp:1486:8:1486:8 | Address | &:r1486_45 | -| ir.cpp:1486:8:1486:8 | Address | &:r1486_47 | -| ir.cpp:1486:8:1486:8 | Address | &:r1486_51 | -| ir.cpp:1486:8:1486:8 | Address | &:r1486_52 | -| ir.cpp:1486:8:1486:8 | Address | &:r1486_54 | +| ir.cpp:1486:8:1486:8 | Address | &:r1486_49 | +| ir.cpp:1486:8:1486:8 | Address | &:r1486_50 | +| ir.cpp:1486:8:1486:8 | Address | &:r1486_53 | +| ir.cpp:1486:8:1486:8 | Address | &:r1486_57 | | ir.cpp:1486:8:1486:8 | Address | &:r1486_58 | -| ir.cpp:1486:8:1486:8 | Address | &:r1486_59 | | ir.cpp:1486:8:1486:8 | Address | &:r1486_61 | +| ir.cpp:1486:8:1486:8 | Address | &:r1486_65 | +| ir.cpp:1486:8:1486:8 | Address | &:r1486_66 | +| ir.cpp:1486:8:1486:8 | Address | &:r1486_69 | | ir.cpp:1486:8:1486:8 | ChiPartial | partial:m1486_3 | | ir.cpp:1486:8:1486:8 | ChiPartial | partial:m1486_3 | -| ir.cpp:1486:8:1486:8 | ChiPartial | partial:m1486_14 | -| ir.cpp:1486:8:1486:8 | ChiPartial | partial:m1486_21 | -| ir.cpp:1486:8:1486:8 | ChiPartial | partial:m1486_28 | -| ir.cpp:1486:8:1486:8 | ChiPartial | partial:m1486_35 | -| ir.cpp:1486:8:1486:8 | ChiPartial | partial:m1486_42 | -| ir.cpp:1486:8:1486:8 | ChiPartial | partial:m1486_49 | -| ir.cpp:1486:8:1486:8 | ChiPartial | partial:m1486_56 | +| ir.cpp:1486:8:1486:8 | ChiPartial | partial:m1486_15 | +| ir.cpp:1486:8:1486:8 | ChiPartial | partial:m1486_23 | +| ir.cpp:1486:8:1486:8 | ChiPartial | partial:m1486_31 | +| ir.cpp:1486:8:1486:8 | ChiPartial | partial:m1486_39 | +| ir.cpp:1486:8:1486:8 | ChiPartial | partial:m1486_47 | +| ir.cpp:1486:8:1486:8 | ChiPartial | partial:m1486_55 | | ir.cpp:1486:8:1486:8 | ChiPartial | partial:m1486_63 | +| ir.cpp:1486:8:1486:8 | ChiPartial | partial:m1486_71 | | ir.cpp:1486:8:1486:8 | ChiTotal | total:m1486_2 | | ir.cpp:1486:8:1486:8 | ChiTotal | total:m1486_2 | | ir.cpp:1486:8:1486:8 | ChiTotal | total:m1486_8 | -| ir.cpp:1486:8:1486:8 | ChiTotal | total:m1486_15 | -| ir.cpp:1486:8:1486:8 | ChiTotal | total:m1486_22 | -| ir.cpp:1486:8:1486:8 | ChiTotal | total:m1486_29 | -| ir.cpp:1486:8:1486:8 | ChiTotal | total:m1486_36 | -| ir.cpp:1486:8:1486:8 | ChiTotal | total:m1486_43 | -| ir.cpp:1486:8:1486:8 | ChiTotal | total:m1486_50 | -| ir.cpp:1486:8:1486:8 | ChiTotal | total:m1486_57 | +| ir.cpp:1486:8:1486:8 | ChiTotal | total:m1486_16 | +| ir.cpp:1486:8:1486:8 | ChiTotal | total:m1486_24 | +| ir.cpp:1486:8:1486:8 | ChiTotal | total:m1486_32 | +| ir.cpp:1486:8:1486:8 | ChiTotal | total:m1486_40 | +| ir.cpp:1486:8:1486:8 | ChiTotal | total:m1486_48 | +| ir.cpp:1486:8:1486:8 | ChiTotal | total:m1486_56 | +| ir.cpp:1486:8:1486:8 | ChiTotal | total:m1486_64 | | ir.cpp:1486:8:1486:8 | Load | m0_2 | | ir.cpp:1486:8:1486:8 | Load | m0_2 | | ir.cpp:1486:8:1486:8 | Load | m0_2 | @@ -6909,15 +6927,15 @@ | ir.cpp:1486:8:1486:8 | SideEffect | m1486_3 | | ir.cpp:1486:8:1486:8 | SideEffect | m1486_3 | | ir.cpp:1486:8:1486:8 | SideEffect | m1486_8 | -| ir.cpp:1486:8:1486:8 | SideEffect | m1486_64 | -| ir.cpp:1486:8:1486:8 | StoreValue | r1486_13 | -| ir.cpp:1486:8:1486:8 | StoreValue | r1486_20 | -| ir.cpp:1486:8:1486:8 | StoreValue | r1486_27 | -| ir.cpp:1486:8:1486:8 | StoreValue | r1486_34 | -| ir.cpp:1486:8:1486:8 | StoreValue | r1486_41 | -| ir.cpp:1486:8:1486:8 | StoreValue | r1486_48 | -| ir.cpp:1486:8:1486:8 | StoreValue | r1486_55 | +| ir.cpp:1486:8:1486:8 | SideEffect | m1486_72 | +| ir.cpp:1486:8:1486:8 | StoreValue | r1486_14 | +| ir.cpp:1486:8:1486:8 | StoreValue | r1486_22 | +| ir.cpp:1486:8:1486:8 | StoreValue | r1486_30 | +| ir.cpp:1486:8:1486:8 | StoreValue | r1486_38 | +| ir.cpp:1486:8:1486:8 | StoreValue | r1486_46 | +| ir.cpp:1486:8:1486:8 | StoreValue | r1486_54 | | ir.cpp:1486:8:1486:8 | StoreValue | r1486_62 | +| ir.cpp:1486:8:1486:8 | StoreValue | r1486_70 | | ir.cpp:1486:8:1486:8 | Unary | m1486_6 | | ir.cpp:1486:8:1486:8 | Unary | m1486_6 | | ir.cpp:1486:8:1486:8 | Unary | m1486_6 | @@ -6927,13 +6945,21 @@ | ir.cpp:1486:8:1486:8 | Unary | m1486_6 | | ir.cpp:1486:8:1486:8 | Unary | m1486_6 | | ir.cpp:1486:8:1486:8 | Unary | r1486_11 | -| ir.cpp:1486:8:1486:8 | Unary | r1486_18 | -| ir.cpp:1486:8:1486:8 | Unary | r1486_25 | -| ir.cpp:1486:8:1486:8 | Unary | r1486_32 | -| ir.cpp:1486:8:1486:8 | Unary | r1486_39 | -| ir.cpp:1486:8:1486:8 | Unary | r1486_46 | -| ir.cpp:1486:8:1486:8 | Unary | r1486_53 | +| ir.cpp:1486:8:1486:8 | Unary | r1486_12 | +| ir.cpp:1486:8:1486:8 | Unary | r1486_19 | +| ir.cpp:1486:8:1486:8 | Unary | r1486_20 | +| ir.cpp:1486:8:1486:8 | Unary | r1486_27 | +| ir.cpp:1486:8:1486:8 | Unary | r1486_28 | +| ir.cpp:1486:8:1486:8 | Unary | r1486_35 | +| ir.cpp:1486:8:1486:8 | Unary | r1486_36 | +| ir.cpp:1486:8:1486:8 | Unary | r1486_43 | +| ir.cpp:1486:8:1486:8 | Unary | r1486_44 | +| ir.cpp:1486:8:1486:8 | Unary | r1486_51 | +| ir.cpp:1486:8:1486:8 | Unary | r1486_52 | +| ir.cpp:1486:8:1486:8 | Unary | r1486_59 | | ir.cpp:1486:8:1486:8 | Unary | r1486_60 | +| ir.cpp:1486:8:1486:8 | Unary | r1486_67 | +| ir.cpp:1486:8:1486:8 | Unary | r1486_68 | | ir.cpp:1499:6:1499:35 | ChiPartial | partial:m1499_3 | | ir.cpp:1499:6:1499:35 | ChiTotal | total:m1499_2 | | ir.cpp:1499:6:1499:35 | SideEffect | ~m1525_7 | @@ -7114,23 +7140,23 @@ | ir.cpp:1539:8:1539:8 | Address | &:r1539_7 | | ir.cpp:1539:8:1539:8 | Address | &:r1539_9 | | ir.cpp:1539:8:1539:8 | Address | &:r1539_10 | -| ir.cpp:1539:8:1539:8 | Address | &:r1539_12 | -| ir.cpp:1539:8:1539:8 | Address | &:r1539_16 | +| ir.cpp:1539:8:1539:8 | Address | &:r1539_13 | | ir.cpp:1539:8:1539:8 | Address | &:r1539_17 | -| ir.cpp:1539:8:1539:8 | Address | &:r1539_19 | -| ir.cpp:1539:8:1539:8 | Address | &:r1539_23 | -| ir.cpp:1539:8:1539:8 | Address | &:r1539_24 | +| ir.cpp:1539:8:1539:8 | Address | &:r1539_18 | +| ir.cpp:1539:8:1539:8 | Address | &:r1539_21 | +| ir.cpp:1539:8:1539:8 | Address | &:r1539_25 | | ir.cpp:1539:8:1539:8 | Address | &:r1539_26 | +| ir.cpp:1539:8:1539:8 | Address | &:r1539_29 | | ir.cpp:1539:8:1539:8 | ChiPartial | partial:m1539_3 | | ir.cpp:1539:8:1539:8 | ChiPartial | partial:m1539_3 | -| ir.cpp:1539:8:1539:8 | ChiPartial | partial:m1539_14 | -| ir.cpp:1539:8:1539:8 | ChiPartial | partial:m1539_21 | -| ir.cpp:1539:8:1539:8 | ChiPartial | partial:m1539_28 | +| ir.cpp:1539:8:1539:8 | ChiPartial | partial:m1539_15 | +| ir.cpp:1539:8:1539:8 | ChiPartial | partial:m1539_23 | +| ir.cpp:1539:8:1539:8 | ChiPartial | partial:m1539_31 | | ir.cpp:1539:8:1539:8 | ChiTotal | total:m1539_2 | | ir.cpp:1539:8:1539:8 | ChiTotal | total:m1539_2 | | ir.cpp:1539:8:1539:8 | ChiTotal | total:m1539_8 | -| ir.cpp:1539:8:1539:8 | ChiTotal | total:m1539_15 | -| ir.cpp:1539:8:1539:8 | ChiTotal | total:m1539_22 | +| ir.cpp:1539:8:1539:8 | ChiTotal | total:m1539_16 | +| ir.cpp:1539:8:1539:8 | ChiTotal | total:m1539_24 | | ir.cpp:1539:8:1539:8 | Load | m0_2 | | ir.cpp:1539:8:1539:8 | Load | m0_2 | | ir.cpp:1539:8:1539:8 | Load | m0_2 | @@ -7142,16 +7168,19 @@ | ir.cpp:1539:8:1539:8 | SideEffect | m1539_3 | | ir.cpp:1539:8:1539:8 | SideEffect | m1539_3 | | ir.cpp:1539:8:1539:8 | SideEffect | m1539_8 | -| ir.cpp:1539:8:1539:8 | SideEffect | m1539_29 | -| ir.cpp:1539:8:1539:8 | StoreValue | r1539_13 | -| ir.cpp:1539:8:1539:8 | StoreValue | r1539_20 | -| ir.cpp:1539:8:1539:8 | StoreValue | r1539_27 | +| ir.cpp:1539:8:1539:8 | SideEffect | m1539_32 | +| ir.cpp:1539:8:1539:8 | StoreValue | r1539_14 | +| ir.cpp:1539:8:1539:8 | StoreValue | r1539_22 | +| ir.cpp:1539:8:1539:8 | StoreValue | r1539_30 | | ir.cpp:1539:8:1539:8 | Unary | m1539_6 | | ir.cpp:1539:8:1539:8 | Unary | m1539_6 | | ir.cpp:1539:8:1539:8 | Unary | m1539_6 | | ir.cpp:1539:8:1539:8 | Unary | r1539_11 | -| ir.cpp:1539:8:1539:8 | Unary | r1539_18 | -| ir.cpp:1539:8:1539:8 | Unary | r1539_25 | +| ir.cpp:1539:8:1539:8 | Unary | r1539_12 | +| ir.cpp:1539:8:1539:8 | Unary | r1539_19 | +| ir.cpp:1539:8:1539:8 | Unary | r1539_20 | +| ir.cpp:1539:8:1539:8 | Unary | r1539_27 | +| ir.cpp:1539:8:1539:8 | Unary | r1539_28 | | ir.cpp:1567:60:1567:95 | Address | &:r1567_5 | | ir.cpp:1567:60:1567:95 | Address | &:r1567_5 | | ir.cpp:1567:60:1567:95 | Address | &:r1567_7 | @@ -7674,15 +7703,20 @@ | ir.cpp:1680:5:1680:23 | SideEffect | m1680_8 | | ir.cpp:1683:6:1683:20 | ChiPartial | partial:m1683_3 | | ir.cpp:1683:6:1683:20 | ChiTotal | total:m1683_2 | +| ir.cpp:1683:6:1683:20 | SideEffect | ~m1686_6 | | ir.cpp:1683:26:1683:26 | Address | &:r1683_5 | | ir.cpp:1683:34:1683:34 | Address | &:r1683_7 | | ir.cpp:1683:34:1683:34 | Address | &:r1683_7 | | ir.cpp:1683:34:1683:34 | Address | &:r1683_9 | +| ir.cpp:1683:34:1683:34 | Address | &:r1683_9 | | ir.cpp:1683:34:1683:34 | Load | m1683_8 | +| ir.cpp:1683:34:1683:34 | SideEffect | m1683_10 | | ir.cpp:1683:43:1683:43 | Address | &:r1683_11 | | ir.cpp:1683:43:1683:43 | Address | &:r1683_11 | | ir.cpp:1683:43:1683:43 | Address | &:r1683_13 | +| ir.cpp:1683:43:1683:43 | Address | &:r1683_13 | | ir.cpp:1683:43:1683:43 | Load | m1683_12 | +| ir.cpp:1683:43:1683:43 | SideEffect | m1683_14 | | ir.cpp:1685:17:1685:20 | Address | &:r1685_1 | | ir.cpp:1685:24:1685:44 | Address | &:r1685_2 | | ir.cpp:1685:24:1685:44 | Address | &:r1685_2 | @@ -7705,16 +7739,104 @@ | ir.cpp:1686:16:1686:37 | ChiTotal | total:m1685_7 | | ir.cpp:1686:16:1686:37 | ChiTotal | total:m1686_2 | | ir.cpp:1686:16:1686:37 | SideEffect | ~m1685_7 | +| ir.cpp:1688:10:1688:21 | Address | &:r1688_1 | | ir.cpp:1688:24:1690:5 | Address | &:r1688_2 | +| ir.cpp:1688:24:1690:5 | Address | &:r1688_2 | +| ir.cpp:1688:24:1690:5 | Address | &:r1688_4 | +| ir.cpp:1688:24:1690:5 | Address | &:r1688_5 | +| ir.cpp:1688:24:1690:5 | Address | &:r1688_6 | +| ir.cpp:1688:24:1690:5 | Address | &:r1688_7 | +| ir.cpp:1688:24:1690:5 | Address | &:r1688_8 | +| ir.cpp:1688:24:1690:5 | Address | &:r1688_12 | +| ir.cpp:1688:24:1690:5 | Address | &:r1688_17 | +| ir.cpp:1688:24:1690:5 | Address | &:r1688_20 | +| ir.cpp:1688:24:1690:5 | ChiPartial | partial:m1688_10 | +| ir.cpp:1688:24:1690:5 | ChiTotal | total:m0_3 | +| ir.cpp:1688:24:1690:5 | Load | m1685_12 | +| ir.cpp:1688:24:1690:5 | Load | m1686_8 | +| ir.cpp:1688:24:1690:5 | Load | m1690_6 | +| ir.cpp:1688:24:1690:5 | StoreValue | r1688_9 | +| ir.cpp:1688:24:1690:5 | StoreValue | r1688_23 | | ir.cpp:1688:24:1690:5 | Unary | r1688_2 | +| ir.cpp:1688:24:1690:5 | Unary | r1688_2 | +| ir.cpp:1688:24:1690:5 | Unary | r1688_2 | +| ir.cpp:1688:24:1690:5 | Unary | r1688_2 | +| ir.cpp:1688:24:1690:5 | Unary | r1688_2 | +| ir.cpp:1688:38:1688:38 | Address | &:r1688_13 | +| ir.cpp:1688:38:1688:38 | ChiPartial | partial:m1688_15 | +| ir.cpp:1688:38:1688:38 | ChiTotal | total:m1688_11 | +| ir.cpp:1688:38:1688:38 | Load | m1683_6 | +| ir.cpp:1688:38:1688:38 | StoreValue | r1688_14 | +| ir.cpp:1688:41:1688:41 | Address | &:r1688_18 | +| ir.cpp:1688:41:1688:41 | Address | &:r1688_19 | +| ir.cpp:1688:41:1688:41 | Load | m1683_8 | +| ir.cpp:1688:44:1688:44 | Address | &:r1688_21 | +| ir.cpp:1688:44:1688:44 | Address | &:r1688_22 | +| ir.cpp:1688:44:1688:44 | Load | m1683_12 | | ir.cpp:1688:46:1688:46 | Address | &:r1688_5 | | ir.cpp:1688:46:1688:46 | Address | &:r1688_5 | | ir.cpp:1688:46:1688:46 | Address | &:r1688_7 | +| ir.cpp:1688:46:1688:46 | Address | &:r1688_7 | | ir.cpp:1688:46:1688:46 | ChiPartial | partial:m1688_3 | | ir.cpp:1688:46:1688:46 | ChiTotal | total:m1688_2 | | ir.cpp:1688:46:1688:46 | Load | m1688_6 | +| ir.cpp:1688:46:1688:46 | SideEffect | m1688_3 | +| ir.cpp:1688:46:1688:46 | SideEffect | m1688_8 | +| ir.cpp:1689:14:1689:25 | Address | &:r1689_1 | | ir.cpp:1689:28:1689:54 | Address | &:r1689_2 | +| ir.cpp:1689:28:1689:54 | Address | &:r1689_2 | +| ir.cpp:1689:28:1689:54 | Address | &:r1689_4 | +| ir.cpp:1689:28:1689:54 | Address | &:r1689_5 | +| ir.cpp:1689:28:1689:54 | Address | &:r1689_7 | +| ir.cpp:1689:28:1689:54 | Address | &:r1689_11 | +| ir.cpp:1689:28:1689:54 | Address | &:r1689_12 | +| ir.cpp:1689:28:1689:54 | Address | &:r1689_14 | +| ir.cpp:1689:28:1689:54 | Address | &:r1689_18 | +| ir.cpp:1689:28:1689:54 | Address | &:r1689_19 | +| ir.cpp:1689:28:1689:54 | Address | &:r1689_21 | +| ir.cpp:1689:28:1689:54 | Address | &:r1689_25 | +| ir.cpp:1689:28:1689:54 | Address | &:r1689_26 | +| ir.cpp:1689:28:1689:54 | Address | &:r1689_28 | +| ir.cpp:1689:28:1689:54 | Address | &:r1689_32 | +| ir.cpp:1689:28:1689:54 | Address | &:r1689_33 | +| ir.cpp:1689:28:1689:54 | Address | &:r1689_35 | +| ir.cpp:1689:28:1689:54 | ChiPartial | partial:m1689_9 | +| ir.cpp:1689:28:1689:54 | ChiPartial | partial:m1689_16 | +| ir.cpp:1689:28:1689:54 | ChiPartial | partial:m1689_23 | +| ir.cpp:1689:28:1689:54 | ChiPartial | partial:m1689_30 | +| ir.cpp:1689:28:1689:54 | ChiPartial | partial:m1689_37 | +| ir.cpp:1689:28:1689:54 | ChiTotal | total:m1689_3 | +| ir.cpp:1689:28:1689:54 | ChiTotal | total:m1689_10 | +| ir.cpp:1689:28:1689:54 | ChiTotal | total:m1689_17 | +| ir.cpp:1689:28:1689:54 | ChiTotal | total:m1689_24 | +| ir.cpp:1689:28:1689:54 | ChiTotal | total:m1689_31 | +| ir.cpp:1689:28:1689:54 | Load | m1688_6 | +| ir.cpp:1689:28:1689:54 | Load | m1688_6 | +| ir.cpp:1689:28:1689:54 | Load | m1688_6 | +| ir.cpp:1689:28:1689:54 | Load | m1688_6 | +| ir.cpp:1689:28:1689:54 | Load | m1688_6 | +| ir.cpp:1689:28:1689:54 | Load | m1689_38 | +| ir.cpp:1689:28:1689:54 | Load | ~m1688_8 | +| ir.cpp:1689:28:1689:54 | Load | ~m1688_8 | +| ir.cpp:1689:28:1689:54 | Load | ~m1688_8 | +| ir.cpp:1689:28:1689:54 | Load | ~m1688_8 | +| ir.cpp:1689:28:1689:54 | Load | ~m1688_8 | +| ir.cpp:1689:28:1689:54 | StoreValue | r1689_8 | +| ir.cpp:1689:28:1689:54 | StoreValue | r1689_15 | +| ir.cpp:1689:28:1689:54 | StoreValue | r1689_22 | +| ir.cpp:1689:28:1689:54 | StoreValue | r1689_29 | +| ir.cpp:1689:28:1689:54 | StoreValue | r1689_36 | +| ir.cpp:1689:28:1689:54 | StoreValue | r1689_39 | | ir.cpp:1689:28:1689:54 | Unary | r1689_2 | +| ir.cpp:1689:28:1689:54 | Unary | r1689_2 | +| ir.cpp:1689:28:1689:54 | Unary | r1689_2 | +| ir.cpp:1689:28:1689:54 | Unary | r1689_2 | +| ir.cpp:1689:28:1689:54 | Unary | r1689_2 | +| ir.cpp:1689:28:1689:54 | Unary | r1689_6 | +| ir.cpp:1689:28:1689:54 | Unary | r1689_13 | +| ir.cpp:1689:28:1689:54 | Unary | r1689_20 | +| ir.cpp:1689:28:1689:54 | Unary | r1689_27 | +| ir.cpp:1689:28:1689:54 | Unary | r1689_34 | | ir.cpp:1689:50:1689:50 | Address | &:r1689_5 | | ir.cpp:1689:50:1689:50 | Address | &:r1689_5 | | ir.cpp:1689:50:1689:50 | Address | &:r1689_7 | @@ -7724,6 +7846,14 @@ | ir.cpp:1689:50:1689:50 | Load | m1689_6 | | ir.cpp:1689:50:1689:50 | SideEffect | m1689_3 | | ir.cpp:1689:50:1689:50 | SideEffect | m1689_8 | +| ir.cpp:1690:6:1690:6 | ChiPartial | partial:m1690_2 | +| ir.cpp:1690:6:1690:6 | ChiPartial | partial:m1690_5 | +| ir.cpp:1690:6:1690:6 | ChiTotal | total:m1688_16 | +| ir.cpp:1690:6:1690:6 | ChiTotal | total:m1690_3 | +| ir.cpp:1690:6:1690:6 | Load | ~m1683_10 | +| ir.cpp:1690:6:1690:6 | Load | ~m1683_14 | +| ir.cpp:1690:6:1690:6 | StoreValue | r1690_1 | +| ir.cpp:1690:6:1690:6 | StoreValue | r1690_4 | | ir.cpp:1693:5:1693:21 | Address | &:r1693_5 | | ir.cpp:1693:5:1693:21 | ChiPartial | partial:m1693_3 | | ir.cpp:1693:5:1693:21 | ChiTotal | total:m1693_2 | @@ -7738,17 +7868,33 @@ | ir.cpp:1701:10:1701:10 | Address | &:r1701_5 | | ir.cpp:1701:10:1701:10 | Address | &:r1701_5 | | ir.cpp:1701:10:1701:10 | Address | &:r1701_7 | +| ir.cpp:1701:10:1701:10 | Address | &:r1701_7 | | ir.cpp:1701:10:1701:10 | ChiPartial | partial:m1701_3 | | ir.cpp:1701:10:1701:10 | ChiTotal | total:m1701_2 | | ir.cpp:1701:10:1701:10 | Load | m1701_6 | +| ir.cpp:1701:10:1701:10 | SideEffect | m1701_3 | +| ir.cpp:1701:10:1701:10 | SideEffect | m1701_8 | +| ir.cpp:1702:14:1702:22 | Address | &:r1702_1 | | ir.cpp:1702:25:1708:9 | Address | &:r1702_2 | +| ir.cpp:1702:25:1708:9 | Address | &:r1702_2 | +| ir.cpp:1702:25:1708:9 | Address | &:r1702_4 | +| ir.cpp:1702:25:1708:9 | Address | &:r1702_5 | +| ir.cpp:1702:25:1708:9 | Address | &:r1702_6 | +| ir.cpp:1702:25:1708:9 | Load | m1701_6 | +| ir.cpp:1702:25:1708:9 | Load | ~m1701_8 | +| ir.cpp:1702:25:1708:9 | Load | ~m1702_8 | +| ir.cpp:1702:25:1708:9 | StoreValue | r1702_7 | +| ir.cpp:1702:25:1708:9 | StoreValue | r1702_9 | | ir.cpp:1702:25:1708:9 | Unary | r1702_2 | | ir.cpp:1702:34:1702:34 | Address | &:r1702_5 | | ir.cpp:1702:34:1702:34 | Address | &:r1702_5 | | ir.cpp:1702:34:1702:34 | Address | &:r1702_7 | +| ir.cpp:1702:34:1702:34 | Address | &:r1702_7 | | ir.cpp:1702:34:1702:34 | ChiPartial | partial:m1702_3 | | ir.cpp:1702:34:1702:34 | ChiTotal | total:m1702_2 | | ir.cpp:1702:34:1702:34 | Load | m1702_6 | +| ir.cpp:1702:34:1702:34 | SideEffect | m1702_8 | +| ir.cpp:1702:34:1702:34 | SideEffect | ~m1703_8 | | ir.cpp:1703:13:1703:13 | Address | &:r1703_1 | | ir.cpp:1703:13:1703:13 | Address | &:r1703_4 | | ir.cpp:1703:13:1703:13 | Arg(this) | this:r1703_4 | @@ -7760,8 +7906,19 @@ | ir.cpp:1703:13:1703:13 | SideEffect | ~m1702_8 | | ir.cpp:1703:13:1703:13 | Unary | r1703_2 | | ir.cpp:1703:13:1703:13 | Unary | r1703_3 | +| ir.cpp:1705:18:1705:26 | Address | &:r1705_1 | | ir.cpp:1705:29:1707:13 | Address | &:r1705_2 | +| ir.cpp:1705:29:1707:13 | Address | &:r1705_2 | +| ir.cpp:1705:29:1707:13 | Address | &:r1705_4 | +| ir.cpp:1705:29:1707:13 | Address | &:r1705_5 | +| ir.cpp:1705:29:1707:13 | Address | &:r1705_7 | +| ir.cpp:1705:29:1707:13 | Load | m1702_6 | +| ir.cpp:1705:29:1707:13 | Load | ~m1702_8 | +| ir.cpp:1705:29:1707:13 | Load | ~m1705_9 | +| ir.cpp:1705:29:1707:13 | StoreValue | r1705_8 | +| ir.cpp:1705:29:1707:13 | StoreValue | r1705_10 | | ir.cpp:1705:29:1707:13 | Unary | r1705_2 | +| ir.cpp:1705:29:1707:13 | Unary | r1705_6 | | ir.cpp:1705:38:1705:38 | Address | &:r1705_5 | | ir.cpp:1705:38:1705:38 | Address | &:r1705_5 | | ir.cpp:1705:38:1705:38 | Address | &:r1705_7 | @@ -7784,15 +7941,20 @@ | ir.cpp:1706:17:1706:17 | Unary | r1706_3 | | ir.cpp:1712:6:1712:21 | ChiPartial | partial:m1712_3 | | ir.cpp:1712:6:1712:21 | ChiTotal | total:m1712_2 | +| ir.cpp:1712:6:1712:21 | SideEffect | m1712_3 | | ir.cpp:1712:42:1712:43 | Address | &:r1712_5 | | ir.cpp:1712:66:1712:67 | Address | &:r1712_7 | | ir.cpp:1712:66:1712:67 | Address | &:r1712_7 | | ir.cpp:1712:66:1712:67 | Address | &:r1712_9 | +| ir.cpp:1712:66:1712:67 | Address | &:r1712_9 | | ir.cpp:1712:66:1712:67 | Load | m1712_8 | +| ir.cpp:1712:66:1712:67 | SideEffect | m1712_10 | | ir.cpp:1712:91:1712:92 | Address | &:r1712_11 | | ir.cpp:1712:91:1712:92 | Address | &:r1712_11 | | ir.cpp:1712:91:1712:92 | Address | &:r1712_13 | +| ir.cpp:1712:91:1712:92 | Address | &:r1712_13 | | ir.cpp:1712:91:1712:92 | Load | m1712_12 | +| ir.cpp:1712:91:1712:92 | SideEffect | m1712_14 | | ir.cpp:1713:30:1713:31 | Address | &:r1713_1 | | ir.cpp:1714:31:1714:32 | Address | &:r1714_1 | | ir.cpp:1714:36:1714:55 | Address | &:r1714_2 | @@ -7804,16 +7966,62 @@ | ir.cpp:1714:36:1714:55 | StoreValue | r1714_9 | | ir.cpp:1714:36:1714:55 | Unary | r1714_2 | | ir.cpp:1714:36:1714:55 | Unary | r1714_8 | +| ir.cpp:1716:10:1716:17 | Address | &:r1716_1 | | ir.cpp:1716:20:1718:5 | Address | &:r1716_2 | +| ir.cpp:1716:20:1718:5 | Address | &:r1716_2 | +| ir.cpp:1716:20:1718:5 | Address | &:r1716_4 | +| ir.cpp:1716:20:1718:5 | Address | &:r1716_5 | +| ir.cpp:1716:20:1718:5 | Address | &:r1716_9 | +| ir.cpp:1716:20:1718:5 | Address | &:r1716_10 | +| ir.cpp:1716:20:1718:5 | Address | &:r1716_11 | +| ir.cpp:1716:20:1718:5 | Address | &:r1716_12 | +| ir.cpp:1716:20:1718:5 | Address | &:r1716_13 | +| ir.cpp:1716:20:1718:5 | Address | &:r1716_14 | +| ir.cpp:1716:20:1718:5 | Address | &:r1716_15 | +| ir.cpp:1716:20:1718:5 | Address | &:r1716_16 | +| ir.cpp:1716:20:1718:5 | Address | &:r1716_20 | +| ir.cpp:1716:20:1718:5 | Address | &:r1716_21 | +| ir.cpp:1716:20:1718:5 | Address | &:r1716_22 | +| ir.cpp:1716:20:1718:5 | ChiPartial | partial:m1716_7 | +| ir.cpp:1716:20:1718:5 | ChiPartial | partial:m1716_18 | +| ir.cpp:1716:20:1718:5 | ChiTotal | total:m0_6 | +| ir.cpp:1716:20:1718:5 | ChiTotal | total:m1716_3 | +| ir.cpp:1716:20:1718:5 | Load | m0_9 | +| ir.cpp:1716:20:1718:5 | Load | m1712_6 | +| ir.cpp:1716:20:1718:5 | Load | m1712_8 | +| ir.cpp:1716:20:1718:5 | Load | m1712_12 | +| ir.cpp:1716:20:1718:5 | Load | m1713_2 | +| ir.cpp:1716:20:1718:5 | Load | m1714_10 | +| ir.cpp:1716:20:1718:5 | StoreValue | r1716_6 | +| ir.cpp:1716:20:1718:5 | StoreValue | r1716_17 | +| ir.cpp:1716:20:1718:5 | StoreValue | r1716_23 | +| ir.cpp:1716:20:1718:5 | Unary | r1716_2 | +| ir.cpp:1716:20:1718:5 | Unary | r1716_2 | +| ir.cpp:1716:20:1718:5 | Unary | r1716_2 | +| ir.cpp:1716:20:1718:5 | Unary | r1716_2 | | ir.cpp:1716:20:1718:5 | Unary | r1716_2 | | ir.cpp:1716:42:1716:42 | Address | &:r1716_5 | | ir.cpp:1716:42:1716:42 | Address | &:r1716_5 | | ir.cpp:1716:42:1716:42 | Address | &:r1716_7 | +| ir.cpp:1716:42:1716:42 | Address | &:r1716_7 | | ir.cpp:1716:42:1716:42 | ChiPartial | partial:m1716_3 | | ir.cpp:1716:42:1716:42 | ChiTotal | total:m1716_2 | | ir.cpp:1716:42:1716:42 | Load | m1716_6 | +| ir.cpp:1716:42:1716:42 | SideEffect | m1716_3 | +| ir.cpp:1716:42:1716:42 | SideEffect | m1716_8 | +| ir.cpp:1717:14:1717:21 | Address | &:r1717_1 | | ir.cpp:1717:24:1717:31 | Address | &:r1717_2 | +| ir.cpp:1717:24:1717:31 | Address | &:r1717_2 | +| ir.cpp:1717:24:1717:31 | Address | &:r1717_4 | +| ir.cpp:1717:24:1717:31 | Address | &:r1717_5 | +| ir.cpp:1717:24:1717:31 | Address | &:r1717_7 | +| ir.cpp:1717:24:1717:31 | Load | m1716_6 | +| ir.cpp:1717:24:1717:31 | Load | ~m1716_8 | +| ir.cpp:1717:24:1717:31 | Load | ~m1717_9 | +| ir.cpp:1717:24:1717:31 | StoreValue | r1717_8 | +| ir.cpp:1717:24:1717:31 | StoreValue | r1717_10 | | ir.cpp:1717:24:1717:31 | Unary | r1717_2 | +| ir.cpp:1717:24:1717:31 | Unary | r1717_6 | | ir.cpp:1717:30:1717:30 | Address | &:r1717_5 | | ir.cpp:1717:30:1717:30 | Address | &:r1717_5 | | ir.cpp:1717:30:1717:30 | Address | &:r1717_7 | @@ -7874,19 +8082,27 @@ | ir.cpp:1736:7:1736:7 | Address | &:r1736_7 | | ir.cpp:1736:7:1736:7 | Address | &:r1736_7 | | ir.cpp:1736:7:1736:7 | Address | &:r1736_9 | +| ir.cpp:1736:7:1736:7 | Address | &:r1736_11 | +| ir.cpp:1736:7:1736:7 | Address | &:r1736_15 | +| ir.cpp:1736:7:1736:7 | Arg(0) | 0:r1736_15 | | ir.cpp:1736:7:1736:7 | Arg(this) | this:r1736_9 | | ir.cpp:1736:7:1736:7 | CallTarget | func:r1736_10 | | ir.cpp:1736:7:1736:7 | ChiPartial | partial:m1736_3 | -| ir.cpp:1736:7:1736:7 | ChiPartial | partial:m1736_12 | -| ir.cpp:1736:7:1736:7 | ChiPartial | partial:m1736_14 | +| ir.cpp:1736:7:1736:7 | ChiPartial | partial:m1736_17 | +| ir.cpp:1736:7:1736:7 | ChiPartial | partial:m1736_20 | | ir.cpp:1736:7:1736:7 | ChiTotal | total:m1736_2 | | ir.cpp:1736:7:1736:7 | ChiTotal | total:m1736_4 | | ir.cpp:1736:7:1736:7 | ChiTotal | total:m1736_8 | +| ir.cpp:1736:7:1736:7 | Load | m0_2 | | ir.cpp:1736:7:1736:7 | Load | m1736_6 | -| ir.cpp:1736:7:1736:7 | SideEffect | m1736_15 | +| ir.cpp:1736:7:1736:7 | SideEffect | m1736_21 | +| ir.cpp:1736:7:1736:7 | SideEffect | ~m0_4 | | ir.cpp:1736:7:1736:7 | SideEffect | ~m1736_4 | -| ir.cpp:1736:7:1736:7 | SideEffect | ~m1736_13 | +| ir.cpp:1736:7:1736:7 | SideEffect | ~m1736_18 | | ir.cpp:1736:7:1736:7 | Unary | m1736_6 | +| ir.cpp:1736:7:1736:7 | Unary | r1736_12 | +| ir.cpp:1736:7:1736:7 | Unary | r1736_13 | +| ir.cpp:1736:7:1736:7 | Unary | r1736_14 | | ir.cpp:1740:5:1740:38 | Address | &:r1740_5 | | ir.cpp:1740:5:1740:38 | Address | &:r1740_5 | | ir.cpp:1740:5:1740:38 | Address | &:r1740_7 | @@ -7919,19 +8135,27 @@ | ir.cpp:1743:7:1743:7 | Address | &:r1743_7 | | ir.cpp:1743:7:1743:7 | Address | &:r1743_7 | | ir.cpp:1743:7:1743:7 | Address | &:r1743_9 | +| ir.cpp:1743:7:1743:7 | Address | &:r1743_11 | +| ir.cpp:1743:7:1743:7 | Address | &:r1743_15 | +| ir.cpp:1743:7:1743:7 | Arg(0) | 0:r1743_15 | | ir.cpp:1743:7:1743:7 | Arg(this) | this:r1743_9 | | ir.cpp:1743:7:1743:7 | CallTarget | func:r1743_10 | | ir.cpp:1743:7:1743:7 | ChiPartial | partial:m1743_3 | -| ir.cpp:1743:7:1743:7 | ChiPartial | partial:m1743_12 | -| ir.cpp:1743:7:1743:7 | ChiPartial | partial:m1743_14 | +| ir.cpp:1743:7:1743:7 | ChiPartial | partial:m1743_17 | +| ir.cpp:1743:7:1743:7 | ChiPartial | partial:m1743_20 | | ir.cpp:1743:7:1743:7 | ChiTotal | total:m1743_2 | | ir.cpp:1743:7:1743:7 | ChiTotal | total:m1743_4 | -| ir.cpp:1743:7:1743:7 | ChiTotal | total:m1743_13 | +| ir.cpp:1743:7:1743:7 | ChiTotal | total:m1743_18 | +| ir.cpp:1743:7:1743:7 | Load | m0_2 | | ir.cpp:1743:7:1743:7 | Load | m1743_6 | | ir.cpp:1743:7:1743:7 | SideEffect | m1743_8 | +| ir.cpp:1743:7:1743:7 | SideEffect | ~m0_4 | | ir.cpp:1743:7:1743:7 | SideEffect | ~m1743_4 | -| ir.cpp:1743:7:1743:7 | SideEffect | ~m1743_15 | +| ir.cpp:1743:7:1743:7 | SideEffect | ~m1743_21 | | ir.cpp:1743:7:1743:7 | Unary | m1743_6 | +| ir.cpp:1743:7:1743:7 | Unary | r1743_12 | +| ir.cpp:1743:7:1743:7 | Unary | r1743_13 | +| ir.cpp:1743:7:1743:7 | Unary | r1743_14 | | ir.cpp:1747:5:1747:35 | Address | &:r1747_5 | | ir.cpp:1747:5:1747:35 | Address | &:r1747_5 | | ir.cpp:1747:5:1747:35 | Address | &:r1747_7 | diff --git a/cpp/ql/test/library-tests/ir/ir/raw_consistency.expected b/cpp/ql/test/library-tests/ir/ir/raw_consistency.expected index 55ed92a2efb..9575759051e 100644 --- a/cpp/ql/test/library-tests/ir/ir/raw_consistency.expected +++ b/cpp/ql/test/library-tests/ir/ir/raw_consistency.expected @@ -1,16 +1,4 @@ missingOperand -| ir.cpp:1688:24:1690:5 | Store: Unknown literal | Instruction 'Store' is missing an expected operand with tag 'StoreValue' in function '$@'. | ir.cpp:1683:6:1683:20 | void captured_lambda(int, int&, int&&) | void captured_lambda(int, int&, int&&) | -| ir.cpp:1688:24:1690:5 | Store: Unknown literal | Instruction 'Store' is missing an expected operand with tag 'StoreValue' in function '$@'. | ir.cpp:1683:6:1683:20 | void captured_lambda(int, int&, int&&) | void captured_lambda(int, int&, int&&) | -| ir.cpp:1689:28:1689:54 | Store: Unknown literal | Instruction 'Store' is missing an expected operand with tag 'StoreValue' in function '$@'. | ir.cpp:1688:46:1688:46 | void (void captured_lambda(int, int&, int&&))::(lambda [] type at line 1688, col. 25)::operator()() const | void (void captured_lambda(int, int&, int&&))::(lambda [] type at line 1688, col. 25)::operator()() const | -| ir.cpp:1689:28:1689:54 | Store: Unknown literal | Instruction 'Store' is missing an expected operand with tag 'StoreValue' in function '$@'. | ir.cpp:1688:46:1688:46 | void (void captured_lambda(int, int&, int&&))::(lambda [] type at line 1688, col. 25)::operator()() const | void (void captured_lambda(int, int&, int&&))::(lambda [] type at line 1688, col. 25)::operator()() const | -| ir.cpp:1702:25:1708:9 | Store: Unknown literal | Instruction 'Store' is missing an expected operand with tag 'StoreValue' in function '$@'. | ir.cpp:1701:10:1701:10 | void TrivialLambdaClass::m() const | void TrivialLambdaClass::m() const | -| ir.cpp:1705:29:1707:13 | Store: Unknown literal | Instruction 'Store' is missing an expected operand with tag 'StoreValue' in function '$@'. | ir.cpp:1702:34:1702:34 | void (void TrivialLambdaClass::m() const)::(lambda [] type at line 1702, col. 26)::operator()() const | void (void TrivialLambdaClass::m() const)::(lambda [] type at line 1702, col. 26)::operator()() const | -| ir.cpp:1716:20:1718:5 | Store: Unknown literal | Instruction 'Store' is missing an expected operand with tag 'StoreValue' in function '$@'. | ir.cpp:1712:6:1712:21 | void captured_lambda2(TrivialLambdaClass, TrivialLambdaClass&, TrivialLambdaClass&&) | void captured_lambda2(TrivialLambdaClass, TrivialLambdaClass&, TrivialLambdaClass&&) | -| ir.cpp:1716:20:1718:5 | Store: Unknown literal | Instruction 'Store' is missing an expected operand with tag 'StoreValue' in function '$@'. | ir.cpp:1712:6:1712:21 | void captured_lambda2(TrivialLambdaClass, TrivialLambdaClass&, TrivialLambdaClass&&) | void captured_lambda2(TrivialLambdaClass, TrivialLambdaClass&, TrivialLambdaClass&&) | -| ir.cpp:1716:20:1718:5 | Store: Unknown literal | Instruction 'Store' is missing an expected operand with tag 'StoreValue' in function '$@'. | ir.cpp:1712:6:1712:21 | void captured_lambda2(TrivialLambdaClass, TrivialLambdaClass&, TrivialLambdaClass&&) | void captured_lambda2(TrivialLambdaClass, TrivialLambdaClass&, TrivialLambdaClass&&) | -| ir.cpp:1716:20:1718:5 | Store: Unknown literal | Instruction 'Store' is missing an expected operand with tag 'StoreValue' in function '$@'. | ir.cpp:1712:6:1712:21 | void captured_lambda2(TrivialLambdaClass, TrivialLambdaClass&, TrivialLambdaClass&&) | void captured_lambda2(TrivialLambdaClass, TrivialLambdaClass&, TrivialLambdaClass&&) | -| ir.cpp:1716:20:1718:5 | Store: Unknown literal | Instruction 'Store' is missing an expected operand with tag 'StoreValue' in function '$@'. | ir.cpp:1712:6:1712:21 | void captured_lambda2(TrivialLambdaClass, TrivialLambdaClass&, TrivialLambdaClass&&) | void captured_lambda2(TrivialLambdaClass, TrivialLambdaClass&, TrivialLambdaClass&&) | -| ir.cpp:1717:24:1717:31 | Store: Unknown literal | Instruction 'Store' is missing an expected operand with tag 'StoreValue' in function '$@'. | ir.cpp:1716:42:1716:42 | void (void captured_lambda2(TrivialLambdaClass, TrivialLambdaClass&, TrivialLambdaClass&&))::(lambda [] type at line 1716, col. 21)::operator()() const | void (void captured_lambda2(TrivialLambdaClass, TrivialLambdaClass&, TrivialLambdaClass&&))::(lambda [] type at line 1716, col. 21)::operator()() const | unexpectedOperand duplicateOperand missingPhiOperand @@ -19,18 +7,6 @@ duplicateChiOperand sideEffectWithoutPrimary instructionWithoutSuccessor | ../../../include/memory.h:68:25:68:33 | CopyValue: (reference to) | Instruction 'CopyValue: (reference to)' has no successors in function '$@'. | ../../../include/memory.h:67:5:67:5 | void std::unique_ptr>::~unique_ptr() | void std::unique_ptr>::~unique_ptr() | -| ir.cpp:1688:24:1690:5 | FieldAddress: {...} | Instruction 'FieldAddress: {...}' has no successors in function '$@'. | ir.cpp:1683:6:1683:20 | void captured_lambda(int, int&, int&&) | void captured_lambda(int, int&, int&&) | -| ir.cpp:1688:24:1690:5 | FieldAddress: {...} | Instruction 'FieldAddress: {...}' has no successors in function '$@'. | ir.cpp:1683:6:1683:20 | void captured_lambda(int, int&, int&&) | void captured_lambda(int, int&, int&&) | -| ir.cpp:1689:28:1689:54 | FieldAddress: {...} | Instruction 'FieldAddress: {...}' has no successors in function '$@'. | ir.cpp:1688:46:1688:46 | void (void captured_lambda(int, int&, int&&))::(lambda [] type at line 1688, col. 25)::operator()() const | void (void captured_lambda(int, int&, int&&))::(lambda [] type at line 1688, col. 25)::operator()() const | -| ir.cpp:1689:28:1689:54 | FieldAddress: {...} | Instruction 'FieldAddress: {...}' has no successors in function '$@'. | ir.cpp:1688:46:1688:46 | void (void captured_lambda(int, int&, int&&))::(lambda [] type at line 1688, col. 25)::operator()() const | void (void captured_lambda(int, int&, int&&))::(lambda [] type at line 1688, col. 25)::operator()() const | -| ir.cpp:1702:25:1708:9 | FieldAddress: {...} | Instruction 'FieldAddress: {...}' has no successors in function '$@'. | ir.cpp:1701:10:1701:10 | void TrivialLambdaClass::m() const | void TrivialLambdaClass::m() const | -| ir.cpp:1705:29:1707:13 | FieldAddress: {...} | Instruction 'FieldAddress: {...}' has no successors in function '$@'. | ir.cpp:1702:34:1702:34 | void (void TrivialLambdaClass::m() const)::(lambda [] type at line 1702, col. 26)::operator()() const | void (void TrivialLambdaClass::m() const)::(lambda [] type at line 1702, col. 26)::operator()() const | -| ir.cpp:1716:20:1718:5 | FieldAddress: {...} | Instruction 'FieldAddress: {...}' has no successors in function '$@'. | ir.cpp:1712:6:1712:21 | void captured_lambda2(TrivialLambdaClass, TrivialLambdaClass&, TrivialLambdaClass&&) | void captured_lambda2(TrivialLambdaClass, TrivialLambdaClass&, TrivialLambdaClass&&) | -| ir.cpp:1716:20:1718:5 | FieldAddress: {...} | Instruction 'FieldAddress: {...}' has no successors in function '$@'. | ir.cpp:1712:6:1712:21 | void captured_lambda2(TrivialLambdaClass, TrivialLambdaClass&, TrivialLambdaClass&&) | void captured_lambda2(TrivialLambdaClass, TrivialLambdaClass&, TrivialLambdaClass&&) | -| ir.cpp:1716:20:1718:5 | FieldAddress: {...} | Instruction 'FieldAddress: {...}' has no successors in function '$@'. | ir.cpp:1712:6:1712:21 | void captured_lambda2(TrivialLambdaClass, TrivialLambdaClass&, TrivialLambdaClass&&) | void captured_lambda2(TrivialLambdaClass, TrivialLambdaClass&, TrivialLambdaClass&&) | -| ir.cpp:1716:20:1718:5 | FieldAddress: {...} | Instruction 'FieldAddress: {...}' has no successors in function '$@'. | ir.cpp:1712:6:1712:21 | void captured_lambda2(TrivialLambdaClass, TrivialLambdaClass&, TrivialLambdaClass&&) | void captured_lambda2(TrivialLambdaClass, TrivialLambdaClass&, TrivialLambdaClass&&) | -| ir.cpp:1716:20:1718:5 | FieldAddress: {...} | Instruction 'FieldAddress: {...}' has no successors in function '$@'. | ir.cpp:1712:6:1712:21 | void captured_lambda2(TrivialLambdaClass, TrivialLambdaClass&, TrivialLambdaClass&&) | void captured_lambda2(TrivialLambdaClass, TrivialLambdaClass&, TrivialLambdaClass&&) | -| ir.cpp:1717:24:1717:31 | FieldAddress: {...} | Instruction 'FieldAddress: {...}' has no successors in function '$@'. | ir.cpp:1716:42:1716:42 | void (void captured_lambda2(TrivialLambdaClass, TrivialLambdaClass&, TrivialLambdaClass&&))::(lambda [] type at line 1716, col. 21)::operator()() const | void (void captured_lambda2(TrivialLambdaClass, TrivialLambdaClass&, TrivialLambdaClass&&))::(lambda [] type at line 1716, col. 21)::operator()() const | ambiguousSuccessors unexplainedLoop unnecessaryPhiInstruction @@ -42,50 +18,6 @@ lostReachability backEdgeCountMismatch useNotDominatedByDefinition | ir.cpp:1486:8:1486:8 | Unary | Operand 'Unary' is not dominated by its definition in function '$@'. | ir.cpp:1486:8:1486:8 | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct() | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct() | -| ir.cpp:1683:34:1683:34 | Address | Operand 'Address' is not dominated by its definition in function '$@'. | ir.cpp:1683:6:1683:20 | void captured_lambda(int, int&, int&&) | void captured_lambda(int, int&, int&&) | -| ir.cpp:1683:43:1683:43 | Address | Operand 'Address' is not dominated by its definition in function '$@'. | ir.cpp:1683:6:1683:20 | void captured_lambda(int, int&, int&&) | void captured_lambda(int, int&, int&&) | -| ir.cpp:1688:10:1688:21 | Address | Operand 'Address' is not dominated by its definition in function '$@'. | ir.cpp:1683:6:1683:20 | void captured_lambda(int, int&, int&&) | void captured_lambda(int, int&, int&&) | -| ir.cpp:1688:24:1690:5 | Address | Operand 'Address' is not dominated by its definition in function '$@'. | ir.cpp:1683:6:1683:20 | void captured_lambda(int, int&, int&&) | void captured_lambda(int, int&, int&&) | -| ir.cpp:1688:24:1690:5 | Address | Operand 'Address' is not dominated by its definition in function '$@'. | ir.cpp:1683:6:1683:20 | void captured_lambda(int, int&, int&&) | void captured_lambda(int, int&, int&&) | -| ir.cpp:1688:24:1690:5 | Address | Operand 'Address' is not dominated by its definition in function '$@'. | ir.cpp:1683:6:1683:20 | void captured_lambda(int, int&, int&&) | void captured_lambda(int, int&, int&&) | -| ir.cpp:1688:24:1690:5 | Unary | Operand 'Unary' is not dominated by its definition in function '$@'. | ir.cpp:1683:6:1683:20 | void captured_lambda(int, int&, int&&) | void captured_lambda(int, int&, int&&) | -| ir.cpp:1688:24:1690:5 | Unary | Operand 'Unary' is not dominated by its definition in function '$@'. | ir.cpp:1683:6:1683:20 | void captured_lambda(int, int&, int&&) | void captured_lambda(int, int&, int&&) | -| ir.cpp:1688:24:1690:5 | Unary | Operand 'Unary' is not dominated by its definition in function '$@'. | ir.cpp:1683:6:1683:20 | void captured_lambda(int, int&, int&&) | void captured_lambda(int, int&, int&&) | -| ir.cpp:1688:24:1690:5 | Unary | Operand 'Unary' is not dominated by its definition in function '$@'. | ir.cpp:1683:6:1683:20 | void captured_lambda(int, int&, int&&) | void captured_lambda(int, int&, int&&) | -| ir.cpp:1688:46:1688:46 | Address | Operand 'Address' is not dominated by its definition in function '$@'. | ir.cpp:1688:46:1688:46 | void (void captured_lambda(int, int&, int&&))::(lambda [] type at line 1688, col. 25)::operator()() const | void (void captured_lambda(int, int&, int&&))::(lambda [] type at line 1688, col. 25)::operator()() const | -| ir.cpp:1689:14:1689:25 | Address | Operand 'Address' is not dominated by its definition in function '$@'. | ir.cpp:1688:46:1688:46 | void (void captured_lambda(int, int&, int&&))::(lambda [] type at line 1688, col. 25)::operator()() const | void (void captured_lambda(int, int&, int&&))::(lambda [] type at line 1688, col. 25)::operator()() const | -| ir.cpp:1689:28:1689:54 | Address | Operand 'Address' is not dominated by its definition in function '$@'. | ir.cpp:1688:46:1688:46 | void (void captured_lambda(int, int&, int&&))::(lambda [] type at line 1688, col. 25)::operator()() const | void (void captured_lambda(int, int&, int&&))::(lambda [] type at line 1688, col. 25)::operator()() const | -| ir.cpp:1689:28:1689:54 | Address | Operand 'Address' is not dominated by its definition in function '$@'. | ir.cpp:1688:46:1688:46 | void (void captured_lambda(int, int&, int&&))::(lambda [] type at line 1688, col. 25)::operator()() const | void (void captured_lambda(int, int&, int&&))::(lambda [] type at line 1688, col. 25)::operator()() const | -| ir.cpp:1689:28:1689:54 | Address | Operand 'Address' is not dominated by its definition in function '$@'. | ir.cpp:1688:46:1688:46 | void (void captured_lambda(int, int&, int&&))::(lambda [] type at line 1688, col. 25)::operator()() const | void (void captured_lambda(int, int&, int&&))::(lambda [] type at line 1688, col. 25)::operator()() const | -| ir.cpp:1689:28:1689:54 | Unary | Operand 'Unary' is not dominated by its definition in function '$@'. | ir.cpp:1688:46:1688:46 | void (void captured_lambda(int, int&, int&&))::(lambda [] type at line 1688, col. 25)::operator()() const | void (void captured_lambda(int, int&, int&&))::(lambda [] type at line 1688, col. 25)::operator()() const | -| ir.cpp:1689:28:1689:54 | Unary | Operand 'Unary' is not dominated by its definition in function '$@'. | ir.cpp:1688:46:1688:46 | void (void captured_lambda(int, int&, int&&))::(lambda [] type at line 1688, col. 25)::operator()() const | void (void captured_lambda(int, int&, int&&))::(lambda [] type at line 1688, col. 25)::operator()() const | -| ir.cpp:1689:28:1689:54 | Unary | Operand 'Unary' is not dominated by its definition in function '$@'. | ir.cpp:1688:46:1688:46 | void (void captured_lambda(int, int&, int&&))::(lambda [] type at line 1688, col. 25)::operator()() const | void (void captured_lambda(int, int&, int&&))::(lambda [] type at line 1688, col. 25)::operator()() const | -| ir.cpp:1689:28:1689:54 | Unary | Operand 'Unary' is not dominated by its definition in function '$@'. | ir.cpp:1688:46:1688:46 | void (void captured_lambda(int, int&, int&&))::(lambda [] type at line 1688, col. 25)::operator()() const | void (void captured_lambda(int, int&, int&&))::(lambda [] type at line 1688, col. 25)::operator()() const | -| ir.cpp:1701:10:1701:10 | Address | Operand 'Address' is not dominated by its definition in function '$@'. | ir.cpp:1701:10:1701:10 | void TrivialLambdaClass::m() const | void TrivialLambdaClass::m() const | -| ir.cpp:1702:14:1702:22 | Address | Operand 'Address' is not dominated by its definition in function '$@'. | ir.cpp:1701:10:1701:10 | void TrivialLambdaClass::m() const | void TrivialLambdaClass::m() const | -| ir.cpp:1702:25:1708:9 | Address | Operand 'Address' is not dominated by its definition in function '$@'. | ir.cpp:1701:10:1701:10 | void TrivialLambdaClass::m() const | void TrivialLambdaClass::m() const | -| ir.cpp:1702:25:1708:9 | Address | Operand 'Address' is not dominated by its definition in function '$@'. | ir.cpp:1701:10:1701:10 | void TrivialLambdaClass::m() const | void TrivialLambdaClass::m() const | -| ir.cpp:1702:34:1702:34 | Address | Operand 'Address' is not dominated by its definition in function '$@'. | ir.cpp:1702:34:1702:34 | void (void TrivialLambdaClass::m() const)::(lambda [] type at line 1702, col. 26)::operator()() const | void (void TrivialLambdaClass::m() const)::(lambda [] type at line 1702, col. 26)::operator()() const | -| ir.cpp:1705:18:1705:26 | Address | Operand 'Address' is not dominated by its definition in function '$@'. | ir.cpp:1702:34:1702:34 | void (void TrivialLambdaClass::m() const)::(lambda [] type at line 1702, col. 26)::operator()() const | void (void TrivialLambdaClass::m() const)::(lambda [] type at line 1702, col. 26)::operator()() const | -| ir.cpp:1705:29:1707:13 | Address | Operand 'Address' is not dominated by its definition in function '$@'. | ir.cpp:1702:34:1702:34 | void (void TrivialLambdaClass::m() const)::(lambda [] type at line 1702, col. 26)::operator()() const | void (void TrivialLambdaClass::m() const)::(lambda [] type at line 1702, col. 26)::operator()() const | -| ir.cpp:1705:29:1707:13 | Address | Operand 'Address' is not dominated by its definition in function '$@'. | ir.cpp:1702:34:1702:34 | void (void TrivialLambdaClass::m() const)::(lambda [] type at line 1702, col. 26)::operator()() const | void (void TrivialLambdaClass::m() const)::(lambda [] type at line 1702, col. 26)::operator()() const | -| ir.cpp:1712:66:1712:67 | Address | Operand 'Address' is not dominated by its definition in function '$@'. | ir.cpp:1712:6:1712:21 | void captured_lambda2(TrivialLambdaClass, TrivialLambdaClass&, TrivialLambdaClass&&) | void captured_lambda2(TrivialLambdaClass, TrivialLambdaClass&, TrivialLambdaClass&&) | -| ir.cpp:1712:91:1712:92 | Address | Operand 'Address' is not dominated by its definition in function '$@'. | ir.cpp:1712:6:1712:21 | void captured_lambda2(TrivialLambdaClass, TrivialLambdaClass&, TrivialLambdaClass&&) | void captured_lambda2(TrivialLambdaClass, TrivialLambdaClass&, TrivialLambdaClass&&) | -| ir.cpp:1716:10:1716:17 | Address | Operand 'Address' is not dominated by its definition in function '$@'. | ir.cpp:1712:6:1712:21 | void captured_lambda2(TrivialLambdaClass, TrivialLambdaClass&, TrivialLambdaClass&&) | void captured_lambda2(TrivialLambdaClass, TrivialLambdaClass&, TrivialLambdaClass&&) | -| ir.cpp:1716:20:1718:5 | Address | Operand 'Address' is not dominated by its definition in function '$@'. | ir.cpp:1712:6:1712:21 | void captured_lambda2(TrivialLambdaClass, TrivialLambdaClass&, TrivialLambdaClass&&) | void captured_lambda2(TrivialLambdaClass, TrivialLambdaClass&, TrivialLambdaClass&&) | -| ir.cpp:1716:20:1718:5 | Address | Operand 'Address' is not dominated by its definition in function '$@'. | ir.cpp:1712:6:1712:21 | void captured_lambda2(TrivialLambdaClass, TrivialLambdaClass&, TrivialLambdaClass&&) | void captured_lambda2(TrivialLambdaClass, TrivialLambdaClass&, TrivialLambdaClass&&) | -| ir.cpp:1716:20:1718:5 | Address | Operand 'Address' is not dominated by its definition in function '$@'. | ir.cpp:1712:6:1712:21 | void captured_lambda2(TrivialLambdaClass, TrivialLambdaClass&, TrivialLambdaClass&&) | void captured_lambda2(TrivialLambdaClass, TrivialLambdaClass&, TrivialLambdaClass&&) | -| ir.cpp:1716:20:1718:5 | Address | Operand 'Address' is not dominated by its definition in function '$@'. | ir.cpp:1712:6:1712:21 | void captured_lambda2(TrivialLambdaClass, TrivialLambdaClass&, TrivialLambdaClass&&) | void captured_lambda2(TrivialLambdaClass, TrivialLambdaClass&, TrivialLambdaClass&&) | -| ir.cpp:1716:20:1718:5 | Address | Operand 'Address' is not dominated by its definition in function '$@'. | ir.cpp:1712:6:1712:21 | void captured_lambda2(TrivialLambdaClass, TrivialLambdaClass&, TrivialLambdaClass&&) | void captured_lambda2(TrivialLambdaClass, TrivialLambdaClass&, TrivialLambdaClass&&) | -| ir.cpp:1716:20:1718:5 | Address | Operand 'Address' is not dominated by its definition in function '$@'. | ir.cpp:1712:6:1712:21 | void captured_lambda2(TrivialLambdaClass, TrivialLambdaClass&, TrivialLambdaClass&&) | void captured_lambda2(TrivialLambdaClass, TrivialLambdaClass&, TrivialLambdaClass&&) | -| ir.cpp:1716:20:1718:5 | Unary | Operand 'Unary' is not dominated by its definition in function '$@'. | ir.cpp:1712:6:1712:21 | void captured_lambda2(TrivialLambdaClass, TrivialLambdaClass&, TrivialLambdaClass&&) | void captured_lambda2(TrivialLambdaClass, TrivialLambdaClass&, TrivialLambdaClass&&) | -| ir.cpp:1716:20:1718:5 | Unary | Operand 'Unary' is not dominated by its definition in function '$@'. | ir.cpp:1712:6:1712:21 | void captured_lambda2(TrivialLambdaClass, TrivialLambdaClass&, TrivialLambdaClass&&) | void captured_lambda2(TrivialLambdaClass, TrivialLambdaClass&, TrivialLambdaClass&&) | -| ir.cpp:1716:20:1718:5 | Unary | Operand 'Unary' is not dominated by its definition in function '$@'. | ir.cpp:1712:6:1712:21 | void captured_lambda2(TrivialLambdaClass, TrivialLambdaClass&, TrivialLambdaClass&&) | void captured_lambda2(TrivialLambdaClass, TrivialLambdaClass&, TrivialLambdaClass&&) | -| ir.cpp:1716:20:1718:5 | Unary | Operand 'Unary' is not dominated by its definition in function '$@'. | ir.cpp:1712:6:1712:21 | void captured_lambda2(TrivialLambdaClass, TrivialLambdaClass&, TrivialLambdaClass&&) | void captured_lambda2(TrivialLambdaClass, TrivialLambdaClass&, TrivialLambdaClass&&) | -| ir.cpp:1716:42:1716:42 | Address | Operand 'Address' is not dominated by its definition in function '$@'. | ir.cpp:1716:42:1716:42 | void (void captured_lambda2(TrivialLambdaClass, TrivialLambdaClass&, TrivialLambdaClass&&))::(lambda [] type at line 1716, col. 21)::operator()() const | void (void captured_lambda2(TrivialLambdaClass, TrivialLambdaClass&, TrivialLambdaClass&&))::(lambda [] type at line 1716, col. 21)::operator()() const | -| ir.cpp:1717:14:1717:21 | Address | Operand 'Address' is not dominated by its definition in function '$@'. | ir.cpp:1716:42:1716:42 | void (void captured_lambda2(TrivialLambdaClass, TrivialLambdaClass&, TrivialLambdaClass&&))::(lambda [] type at line 1716, col. 21)::operator()() const | void (void captured_lambda2(TrivialLambdaClass, TrivialLambdaClass&, TrivialLambdaClass&&))::(lambda [] type at line 1716, col. 21)::operator()() const | -| ir.cpp:1717:24:1717:31 | Address | Operand 'Address' is not dominated by its definition in function '$@'. | ir.cpp:1716:42:1716:42 | void (void captured_lambda2(TrivialLambdaClass, TrivialLambdaClass&, TrivialLambdaClass&&))::(lambda [] type at line 1716, col. 21)::operator()() const | void (void captured_lambda2(TrivialLambdaClass, TrivialLambdaClass&, TrivialLambdaClass&&))::(lambda [] type at line 1716, col. 21)::operator()() const | -| ir.cpp:1717:24:1717:31 | Address | Operand 'Address' is not dominated by its definition in function '$@'. | ir.cpp:1716:42:1716:42 | void (void captured_lambda2(TrivialLambdaClass, TrivialLambdaClass&, TrivialLambdaClass&&))::(lambda [] type at line 1716, col. 21)::operator()() const | void (void captured_lambda2(TrivialLambdaClass, TrivialLambdaClass&, TrivialLambdaClass&&))::(lambda [] type at line 1716, col. 21)::operator()() const | | ir.cpp:1751:51:1751:51 | Address | Operand 'Address' is not dominated by its definition in function '$@'. | ir.cpp:1750:5:1750:34 | int implicit_copy_constructor_test(CopyConstructorTestNonVirtualClass const&, CopyConstructorTestVirtualClass const&) | int implicit_copy_constructor_test(CopyConstructorTestNonVirtualClass const&, CopyConstructorTestVirtualClass const&) | | ir.cpp:1752:48:1752:48 | Address | Operand 'Address' is not dominated by its definition in function '$@'. | ir.cpp:1750:5:1750:34 | int implicit_copy_constructor_test(CopyConstructorTestNonVirtualClass const&, CopyConstructorTestVirtualClass const&) | int implicit_copy_constructor_test(CopyConstructorTestNonVirtualClass const&, CopyConstructorTestVirtualClass const&) | switchInstructionWithoutDefaultEdge diff --git a/cpp/ql/test/library-tests/ir/ir/raw_ir.expected b/cpp/ql/test/library-tests/ir/ir/raw_ir.expected index 04897489a1d..12c19cbc744 100644 --- a/cpp/ql/test/library-tests/ir/ir/raw_ir.expected +++ b/cpp/ql/test/library-tests/ir/ir/raw_ir.expected @@ -65,21 +65,23 @@ bad_asts.cpp: # 19| r19_8(glval) = FieldAddress[x] : mu19_5 # 19| r19_9(glval) = VariableAddress[(unnamed parameter 0)] : # 19| r19_10(Point &) = Load[(unnamed parameter 0)] : &:r19_9, ~m? -# 19| r19_11(glval) = FieldAddress[x] : r19_10 -# 19| r19_12(int) = Load[?] : &:r19_11, ~m? -# 19| mu19_13(int) = Store[?] : &:r19_8, r19_12 -# 19| r19_14(glval) = FieldAddress[y] : mu19_5 -# 19| r19_15(glval) = VariableAddress[(unnamed parameter 0)] : -# 19| r19_16(Point &) = Load[(unnamed parameter 0)] : &:r19_15, ~m? -# 19| r19_17(glval) = FieldAddress[y] : r19_16 -# 19| r19_18(int) = Load[?] : &:r19_17, ~m? -# 19| mu19_19(int) = Store[?] : &:r19_14, r19_18 -# 19| v19_20(void) = NoOp : -# 19| v19_21(void) = ReturnIndirection[#this] : &:r19_6, ~m? +# 19| r19_11(glval) = CopyValue : r19_10 +# 19| r19_12(glval) = FieldAddress[x] : r19_11 +# 19| r19_13(int) = Load[?] : &:r19_12, ~m? +# 19| mu19_14(int) = Store[?] : &:r19_8, r19_13 +# 19| r19_15(glval) = FieldAddress[y] : mu19_5 +# 19| r19_16(glval) = VariableAddress[(unnamed parameter 0)] : +# 19| r19_17(Point &) = Load[(unnamed parameter 0)] : &:r19_16, ~m? +# 19| r19_18(glval) = CopyValue : r19_17 +# 19| r19_19(glval) = FieldAddress[y] : r19_18 +# 19| r19_20(int) = Load[?] : &:r19_19, ~m? +# 19| mu19_21(int) = Store[?] : &:r19_15, r19_20 +# 19| v19_22(void) = NoOp : +# 19| v19_23(void) = ReturnIndirection[#this] : &:r19_6, ~m? #-----| v0_5(void) = ReturnIndirection[(unnamed parameter 0)] : &:r0_3, ~m? -# 19| v19_22(void) = ReturnVoid : -# 19| v19_23(void) = AliasedUse : ~m? -# 19| v19_24(void) = ExitFunction : +# 19| v19_24(void) = ReturnVoid : +# 19| v19_25(void) = AliasedUse : ~m? +# 19| v19_26(void) = ExitFunction : # 22| void Bad::Point::Point() # 22| Block 0 @@ -8090,57 +8092,65 @@ ir.cpp: # 1486| r1486_8(glval) = FieldAddress[i] : mu1486_5 # 1486| r1486_9(glval) = VariableAddress[(unnamed parameter 0)] : # 1486| r1486_10(StructuredBindingDataMemberStruct &) = Load[(unnamed parameter 0)] : &:r1486_9, ~m? -# 1486| r1486_11(glval) = FieldAddress[i] : r1486_10 -# 1486| r1486_12(int) = Load[?] : &:r1486_11, ~m? -# 1486| mu1486_13(int) = Store[?] : &:r1486_8, r1486_12 -# 1486| r1486_14(glval) = FieldAddress[d] : mu1486_5 -# 1486| r1486_15(glval) = VariableAddress[(unnamed parameter 0)] : -# 1486| r1486_16(StructuredBindingDataMemberStruct &) = Load[(unnamed parameter 0)] : &:r1486_15, ~m? -# 1486| r1486_17(glval) = FieldAddress[d] : r1486_16 -# 1486| r1486_18(double) = Load[?] : &:r1486_17, ~m? -# 1486| mu1486_19(double) = Store[?] : &:r1486_14, r1486_18 -# 1486| r1486_20(glval) = FieldAddress[b] : mu1486_5 -# 1486| r1486_21(glval) = VariableAddress[(unnamed parameter 0)] : -# 1486| r1486_22(StructuredBindingDataMemberStruct &) = Load[(unnamed parameter 0)] : &:r1486_21, ~m? -# 1486| r1486_23(glval) = FieldAddress[b] : r1486_22 -# 1486| r1486_24(unsigned int) = Load[?] : &:r1486_23, ~m? -# 1486| mu1486_25(unsigned int) = Store[?] : &:r1486_20, r1486_24 -# 1486| r1486_26(glval) = FieldAddress[r] : mu1486_5 -# 1486| r1486_27(glval) = VariableAddress[(unnamed parameter 0)] : -# 1486| r1486_28(StructuredBindingDataMemberStruct &) = Load[(unnamed parameter 0)] : &:r1486_27, ~m? -# 1486| r1486_29(glval) = FieldAddress[r] : r1486_28 -# 1486| r1486_30(int &) = Load[?] : &:r1486_29, ~m? -# 1486| mu1486_31(int &) = Store[?] : &:r1486_26, r1486_30 -# 1486| r1486_32(glval) = FieldAddress[p] : mu1486_5 -# 1486| r1486_33(glval) = VariableAddress[(unnamed parameter 0)] : -# 1486| r1486_34(StructuredBindingDataMemberStruct &) = Load[(unnamed parameter 0)] : &:r1486_33, ~m? -# 1486| r1486_35(glval) = FieldAddress[p] : r1486_34 -# 1486| r1486_36(int *) = Load[?] : &:r1486_35, ~m? -# 1486| mu1486_37(int *) = Store[?] : &:r1486_32, r1486_36 -# 1486| r1486_38(glval) = FieldAddress[xs] : mu1486_5 -# 1486| r1486_39(glval) = VariableAddress[(unnamed parameter 0)] : -# 1486| r1486_40(StructuredBindingDataMemberStruct &) = Load[(unnamed parameter 0)] : &:r1486_39, ~m? -# 1486| r1486_41(glval) = FieldAddress[xs] : r1486_40 -# 1486| r1486_42(int[2]) = Load[?] : &:r1486_41, ~m? -# 1486| mu1486_43(int[2]) = Store[?] : &:r1486_38, r1486_42 -# 1486| r1486_44(glval) = FieldAddress[r_alt] : mu1486_5 -# 1486| r1486_45(glval) = VariableAddress[(unnamed parameter 0)] : -# 1486| r1486_46(StructuredBindingDataMemberStruct &) = Load[(unnamed parameter 0)] : &:r1486_45, ~m? -# 1486| r1486_47(glval) = FieldAddress[r_alt] : r1486_46 -# 1486| r1486_48(int &) = Load[?] : &:r1486_47, ~m? -# 1486| mu1486_49(int &) = Store[?] : &:r1486_44, r1486_48 -# 1486| r1486_50(glval) = FieldAddress[m] : mu1486_5 +# 1486| r1486_11(glval) = CopyValue : r1486_10 +# 1486| r1486_12(glval) = FieldAddress[i] : r1486_11 +# 1486| r1486_13(int) = Load[?] : &:r1486_12, ~m? +# 1486| mu1486_14(int) = Store[?] : &:r1486_8, r1486_13 +# 1486| r1486_15(glval) = FieldAddress[d] : mu1486_5 +# 1486| r1486_16(glval) = VariableAddress[(unnamed parameter 0)] : +# 1486| r1486_17(StructuredBindingDataMemberStruct &) = Load[(unnamed parameter 0)] : &:r1486_16, ~m? +# 1486| r1486_18(glval) = CopyValue : r1486_17 +# 1486| r1486_19(glval) = FieldAddress[d] : r1486_18 +# 1486| r1486_20(double) = Load[?] : &:r1486_19, ~m? +# 1486| mu1486_21(double) = Store[?] : &:r1486_15, r1486_20 +# 1486| r1486_22(glval) = FieldAddress[b] : mu1486_5 +# 1486| r1486_23(glval) = VariableAddress[(unnamed parameter 0)] : +# 1486| r1486_24(StructuredBindingDataMemberStruct &) = Load[(unnamed parameter 0)] : &:r1486_23, ~m? +# 1486| r1486_25(glval) = CopyValue : r1486_24 +# 1486| r1486_26(glval) = FieldAddress[b] : r1486_25 +# 1486| r1486_27(unsigned int) = Load[?] : &:r1486_26, ~m? +# 1486| mu1486_28(unsigned int) = Store[?] : &:r1486_22, r1486_27 +# 1486| r1486_29(glval) = FieldAddress[r] : mu1486_5 +# 1486| r1486_30(glval) = VariableAddress[(unnamed parameter 0)] : +# 1486| r1486_31(StructuredBindingDataMemberStruct &) = Load[(unnamed parameter 0)] : &:r1486_30, ~m? +# 1486| r1486_32(glval) = CopyValue : r1486_31 +# 1486| r1486_33(glval) = FieldAddress[r] : r1486_32 +# 1486| r1486_34(int &) = Load[?] : &:r1486_33, ~m? +# 1486| mu1486_35(int &) = Store[?] : &:r1486_29, r1486_34 +# 1486| r1486_36(glval) = FieldAddress[p] : mu1486_5 +# 1486| r1486_37(glval) = VariableAddress[(unnamed parameter 0)] : +# 1486| r1486_38(StructuredBindingDataMemberStruct &) = Load[(unnamed parameter 0)] : &:r1486_37, ~m? +# 1486| r1486_39(glval) = CopyValue : r1486_38 +# 1486| r1486_40(glval) = FieldAddress[p] : r1486_39 +# 1486| r1486_41(int *) = Load[?] : &:r1486_40, ~m? +# 1486| mu1486_42(int *) = Store[?] : &:r1486_36, r1486_41 +# 1486| r1486_43(glval) = FieldAddress[xs] : mu1486_5 +# 1486| r1486_44(glval) = VariableAddress[(unnamed parameter 0)] : +# 1486| r1486_45(StructuredBindingDataMemberStruct &) = Load[(unnamed parameter 0)] : &:r1486_44, ~m? +# 1486| r1486_46(glval) = CopyValue : r1486_45 +# 1486| r1486_47(glval) = FieldAddress[xs] : r1486_46 +# 1486| r1486_48(int[2]) = Load[?] : &:r1486_47, ~m? +# 1486| mu1486_49(int[2]) = Store[?] : &:r1486_43, r1486_48 +# 1486| r1486_50(glval) = FieldAddress[r_alt] : mu1486_5 # 1486| r1486_51(glval) = VariableAddress[(unnamed parameter 0)] : # 1486| r1486_52(StructuredBindingDataMemberStruct &) = Load[(unnamed parameter 0)] : &:r1486_51, ~m? -# 1486| r1486_53(glval) = FieldAddress[m] : r1486_52 -# 1486| r1486_54(StructuredBindingDataMemberMemberStruct) = Load[?] : &:r1486_53, ~m? -# 1486| mu1486_55(StructuredBindingDataMemberMemberStruct) = Store[?] : &:r1486_50, r1486_54 -# 1486| v1486_56(void) = NoOp : -# 1486| v1486_57(void) = ReturnIndirection[#this] : &:r1486_6, ~m? +# 1486| r1486_53(glval) = CopyValue : r1486_52 +# 1486| r1486_54(glval) = FieldAddress[r_alt] : r1486_53 +# 1486| r1486_55(int &) = Load[?] : &:r1486_54, ~m? +# 1486| mu1486_56(int &) = Store[?] : &:r1486_50, r1486_55 +# 1486| r1486_57(glval) = FieldAddress[m] : mu1486_5 +# 1486| r1486_58(glval) = VariableAddress[(unnamed parameter 0)] : +# 1486| r1486_59(StructuredBindingDataMemberStruct &) = Load[(unnamed parameter 0)] : &:r1486_58, ~m? +# 1486| r1486_60(glval) = CopyValue : r1486_59 +# 1486| r1486_61(glval) = FieldAddress[m] : r1486_60 +# 1486| r1486_62(StructuredBindingDataMemberMemberStruct) = Load[?] : &:r1486_61, ~m? +# 1486| mu1486_63(StructuredBindingDataMemberMemberStruct) = Store[?] : &:r1486_57, r1486_62 +# 1486| v1486_64(void) = NoOp : +# 1486| v1486_65(void) = ReturnIndirection[#this] : &:r1486_6, ~m? #-----| v0_5(void) = ReturnIndirection[(unnamed parameter 0)] : &:r0_3, ~m? -# 1486| v1486_58(void) = ReturnVoid : -# 1486| v1486_59(void) = AliasedUse : ~m? -# 1486| v1486_60(void) = ExitFunction : +# 1486| v1486_66(void) = ReturnVoid : +# 1486| v1486_67(void) = AliasedUse : ~m? +# 1486| v1486_68(void) = ExitFunction : # 1499| void data_member_structured_binding() # 1499| Block 0 @@ -8338,27 +8348,30 @@ ir.cpp: # 1539| r1539_8(glval) = FieldAddress[i] : mu1539_5 # 1539| r1539_9(glval) = VariableAddress[(unnamed parameter 0)] : # 1539| r1539_10(StructuredBindingTupleRefGet &) = Load[(unnamed parameter 0)] : &:r1539_9, ~m? -# 1539| r1539_11(glval) = FieldAddress[i] : r1539_10 -# 1539| r1539_12(int) = Load[?] : &:r1539_11, ~m? -# 1539| mu1539_13(int) = Store[?] : &:r1539_8, r1539_12 -# 1539| r1539_14(glval) = FieldAddress[d] : mu1539_5 -# 1539| r1539_15(glval) = VariableAddress[(unnamed parameter 0)] : -# 1539| r1539_16(StructuredBindingTupleRefGet &) = Load[(unnamed parameter 0)] : &:r1539_15, ~m? -# 1539| r1539_17(glval) = FieldAddress[d] : r1539_16 -# 1539| r1539_18(double) = Load[?] : &:r1539_17, ~m? -# 1539| mu1539_19(double) = Store[?] : &:r1539_14, r1539_18 -# 1539| r1539_20(glval) = FieldAddress[r] : mu1539_5 -# 1539| r1539_21(glval) = VariableAddress[(unnamed parameter 0)] : -# 1539| r1539_22(StructuredBindingTupleRefGet &) = Load[(unnamed parameter 0)] : &:r1539_21, ~m? -# 1539| r1539_23(glval) = FieldAddress[r] : r1539_22 -# 1539| r1539_24(int &) = Load[?] : &:r1539_23, ~m? -# 1539| mu1539_25(int &) = Store[?] : &:r1539_20, r1539_24 -# 1539| v1539_26(void) = NoOp : -# 1539| v1539_27(void) = ReturnIndirection[#this] : &:r1539_6, ~m? +# 1539| r1539_11(glval) = CopyValue : r1539_10 +# 1539| r1539_12(glval) = FieldAddress[i] : r1539_11 +# 1539| r1539_13(int) = Load[?] : &:r1539_12, ~m? +# 1539| mu1539_14(int) = Store[?] : &:r1539_8, r1539_13 +# 1539| r1539_15(glval) = FieldAddress[d] : mu1539_5 +# 1539| r1539_16(glval) = VariableAddress[(unnamed parameter 0)] : +# 1539| r1539_17(StructuredBindingTupleRefGet &) = Load[(unnamed parameter 0)] : &:r1539_16, ~m? +# 1539| r1539_18(glval) = CopyValue : r1539_17 +# 1539| r1539_19(glval) = FieldAddress[d] : r1539_18 +# 1539| r1539_20(double) = Load[?] : &:r1539_19, ~m? +# 1539| mu1539_21(double) = Store[?] : &:r1539_15, r1539_20 +# 1539| r1539_22(glval) = FieldAddress[r] : mu1539_5 +# 1539| r1539_23(glval) = VariableAddress[(unnamed parameter 0)] : +# 1539| r1539_24(StructuredBindingTupleRefGet &) = Load[(unnamed parameter 0)] : &:r1539_23, ~m? +# 1539| r1539_25(glval) = CopyValue : r1539_24 +# 1539| r1539_26(glval) = FieldAddress[r] : r1539_25 +# 1539| r1539_27(int &) = Load[?] : &:r1539_26, ~m? +# 1539| mu1539_28(int &) = Store[?] : &:r1539_22, r1539_27 +# 1539| v1539_29(void) = NoOp : +# 1539| v1539_30(void) = ReturnIndirection[#this] : &:r1539_6, ~m? #-----| v0_5(void) = ReturnIndirection[(unnamed parameter 0)] : &:r0_3, ~m? -# 1539| v1539_28(void) = ReturnVoid : -# 1539| v1539_29(void) = AliasedUse : ~m? -# 1539| v1539_30(void) = ExitFunction : +# 1539| v1539_31(void) = ReturnVoid : +# 1539| v1539_32(void) = AliasedUse : ~m? +# 1539| v1539_33(void) = ExitFunction : # 1567| std::tuple_element::type& StructuredBindingTupleRefGet::get() # 1567| Block 0 @@ -8901,81 +8914,86 @@ ir.cpp: # 1688| r1688_2(glval) = VariableAddress[#temp1688:24] : # 1688| mu1688_3(decltype([...](...){...})) = Uninitialized[#temp1688:24] : &:r1688_2 # 1688| r1688_4(glval) = FieldAddress[obj1] : r1688_2 - -# 1688| Block 1 -# 1688| mu1688_5(CapturedLambdaMyObj) = Store[?] : &:r1688_4 -# 1688| r1688_6(glval) = FieldAddress[obj2] : r1688_2 - -# 1688| Block 2 -# 1688| mu1688_7(CapturedLambdaMyObj) = Store[?] : &:r1688_6 -# 1688| r1688_8(glval) = FieldAddress[x] : r1688_2 -# 1688| r1688_9(glval) = VariableAddress[x] : -# 1688| r1688_10(int) = Load[x] : &:r1688_9, ~m? -# 1688| mu1688_11(int) = Store[?] : &:r1688_8, r1688_10 -# 1688| r1688_12(glval) = FieldAddress[y] : r1688_2 -# 1688| r1688_13(glval) = VariableAddress[y] : -# 1688| r1688_14(int &) = Load[y] : &:r1688_13, ~m? -# 1690| r1690_1(int) = Load[?] : &:r1688_14, ~m? -# 1690| mu1690_2(int) = Store[?] : &:r1688_12, r1690_1 -# 1688| r1688_15(glval) = FieldAddress[z] : r1688_2 -# 1688| r1688_16(glval) = VariableAddress[z] : -# 1688| r1688_17(int &&) = Load[z] : &:r1688_16, ~m? -# 1690| r1690_3(int) = Load[?] : &:r1688_17, ~m? -# 1690| mu1690_4(int) = Store[?] : &:r1688_15, r1690_3 -# 1688| r1688_18(decltype([...](...){...})) = Load[#temp1688:24] : &:r1688_2, ~m? -# 1688| mu1688_19(decltype([...](...){...})) = Store[lambda_outer] : &:r1688_1, r1688_18 -# 1691| v1691_1(void) = NoOp : -# 1683| v1683_14(void) = ReturnIndirection[y] : &:r1683_8, ~m? -# 1683| v1683_15(void) = ReturnIndirection[z] : &:r1683_12, ~m? -# 1683| v1683_16(void) = ReturnVoid : -# 1683| v1683_17(void) = AliasedUse : ~m? -# 1683| v1683_18(void) = ExitFunction : +# 1688| r1688_5(glval) = VariableAddress[obj1] : +# 1688| r1688_6(CapturedLambdaMyObj &) = Load[obj1] : &:r1688_5, ~m? +#-----| r0_1(CapturedLambdaMyObj) = Load[?] : &:r1688_6, ~m? +#-----| mu0_2(CapturedLambdaMyObj) = Store[?] : &:r1688_4, r0_1 +# 1688| r1688_7(glval) = FieldAddress[obj2] : r1688_2 +# 1688| r1688_8(glval) = VariableAddress[obj2] : +# 1688| r1688_9(CapturedLambdaMyObj) = Load[obj2] : &:r1688_8, ~m? +# 1688| mu1688_10(CapturedLambdaMyObj) = Store[?] : &:r1688_7, r1688_9 +# 1688| r1688_11(glval) = FieldAddress[x] : r1688_2 +# 1688| r1688_12(glval) = VariableAddress[x] : +# 1688| r1688_13(int) = Load[x] : &:r1688_12, ~m? +# 1688| mu1688_14(int) = Store[?] : &:r1688_11, r1688_13 +# 1688| r1688_15(glval) = FieldAddress[y] : r1688_2 +# 1688| r1688_16(glval) = VariableAddress[y] : +# 1688| r1688_17(int &) = Load[y] : &:r1688_16, ~m? +# 1690| r1690_1(int) = Load[?] : &:r1688_17, ~m? +# 1690| mu1690_2(int) = Store[?] : &:r1688_15, r1690_1 +# 1688| r1688_18(glval) = FieldAddress[z] : r1688_2 +# 1688| r1688_19(glval) = VariableAddress[z] : +# 1688| r1688_20(int &&) = Load[z] : &:r1688_19, ~m? +# 1690| r1690_3(int) = Load[?] : &:r1688_20, ~m? +# 1690| mu1690_4(int) = Store[?] : &:r1688_18, r1690_3 +# 1688| r1688_21(decltype([...](...){...})) = Load[#temp1688:24] : &:r1688_2, ~m? +# 1688| mu1688_22(decltype([...](...){...})) = Store[lambda_outer] : &:r1688_1, r1688_21 +# 1691| v1691_1(void) = NoOp : +# 1683| v1683_14(void) = ReturnIndirection[y] : &:r1683_8, ~m? +# 1683| v1683_15(void) = ReturnIndirection[z] : &:r1683_12, ~m? +# 1683| v1683_16(void) = ReturnVoid : +# 1683| v1683_17(void) = AliasedUse : ~m? +# 1683| v1683_18(void) = ExitFunction : # 1688| void (void captured_lambda(int, int&, int&&))::(lambda [] type at line 1688, col. 25)::operator()() const # 1688| Block 0 -# 1688| v1688_1(void) = EnterFunction : -# 1688| mu1688_2(unknown) = AliasedDefinition : -# 1688| mu1688_3(unknown) = InitializeNonLocal : -# 1688| r1688_4(glval) = VariableAddress[#this] : -# 1688| mu1688_5(glval) = InitializeParameter[#this] : &:r1688_4 -# 1688| r1688_6(glval) = Load[#this] : &:r1688_4, ~m? -# 1688| mu1688_7(decltype([...](...){...})) = InitializeIndirection[#this] : &:r1688_6 -# 1689| r1689_1(glval) = VariableAddress[lambda_inner] : -# 1689| r1689_2(glval) = VariableAddress[#temp1689:28] : -# 1689| mu1689_3(decltype([...](...){...})) = Uninitialized[#temp1689:28] : &:r1689_2 -# 1689| r1689_4(glval) = FieldAddress[obj1] : r1689_2 - -# 1689| Block 1 -# 1689| mu1689_5(CapturedLambdaMyObj) = Store[?] : &:r1689_4 -# 1689| r1689_6(glval) = FieldAddress[obj2] : r1689_2 - -# 1689| Block 2 -# 1689| mu1689_7(CapturedLambdaMyObj) = Store[?] : &:r1689_6 -# 1689| r1689_8(glval) = FieldAddress[x] : r1689_2 -# 1689| r1689_9(glval) = VariableAddress[#this] : -# 1689| r1689_10(lambda [] type at line 1688, col. 25 *) = Load[#this] : &:r1689_9, ~m? -# 1689| r1689_11(glval) = FieldAddress[x] : r1689_10 -# 1689| r1689_12(int) = Load[?] : &:r1689_11, ~m? -# 1689| mu1689_13(int) = Store[?] : &:r1689_8, r1689_12 -# 1689| r1689_14(glval) = FieldAddress[y] : r1689_2 -# 1689| r1689_15(glval) = VariableAddress[#this] : -# 1689| r1689_16(lambda [] type at line 1688, col. 25 *) = Load[#this] : &:r1689_15, ~m? -# 1689| r1689_17(glval) = FieldAddress[y] : r1689_16 -# 1689| r1689_18(int) = Load[?] : &:r1689_17, ~m? -# 1689| mu1689_19(int) = Store[?] : &:r1689_14, r1689_18 -# 1689| r1689_20(glval) = FieldAddress[z] : r1689_2 -# 1689| r1689_21(glval) = VariableAddress[#this] : -# 1689| r1689_22(lambda [] type at line 1688, col. 25 *) = Load[#this] : &:r1689_21, ~m? -# 1689| r1689_23(glval) = FieldAddress[z] : r1689_22 -# 1689| r1689_24(int) = Load[?] : &:r1689_23, ~m? -# 1689| mu1689_25(int) = Store[?] : &:r1689_20, r1689_24 -# 1689| r1689_26(decltype([...](...){...})) = Load[#temp1689:28] : &:r1689_2, ~m? -# 1689| mu1689_27(decltype([...](...){...})) = Store[lambda_inner] : &:r1689_1, r1689_26 -# 1690| v1690_1(void) = NoOp : -# 1688| v1688_8(void) = ReturnIndirection[#this] : &:r1688_6, ~m? -# 1688| v1688_9(void) = ReturnVoid : -# 1688| v1688_10(void) = AliasedUse : ~m? -# 1688| v1688_11(void) = ExitFunction : +# 1688| v1688_1(void) = EnterFunction : +# 1688| mu1688_2(unknown) = AliasedDefinition : +# 1688| mu1688_3(unknown) = InitializeNonLocal : +# 1688| r1688_4(glval) = VariableAddress[#this] : +# 1688| mu1688_5(glval) = InitializeParameter[#this] : &:r1688_4 +# 1688| r1688_6(glval) = Load[#this] : &:r1688_4, ~m? +# 1688| mu1688_7(decltype([...](...){...})) = InitializeIndirection[#this] : &:r1688_6 +# 1689| r1689_1(glval) = VariableAddress[lambda_inner] : +# 1689| r1689_2(glval) = VariableAddress[#temp1689:28] : +# 1689| mu1689_3(decltype([...](...){...})) = Uninitialized[#temp1689:28] : &:r1689_2 +# 1689| r1689_4(glval) = FieldAddress[obj1] : r1689_2 +# 1689| r1689_5(glval) = VariableAddress[#this] : +# 1689| r1689_6(lambda [] type at line 1689, col. 29 *) = Load[#this] : &:r1689_5, ~m? +# 1689| r1689_7(glval) = FieldAddress[obj1] : r1689_6 +# 1689| r1689_8(CapturedLambdaMyObj) = Load[?] : &:r1689_7, ~m? +# 1689| mu1689_9(CapturedLambdaMyObj) = Store[?] : &:r1689_4, r1689_8 +# 1689| r1689_10(glval) = FieldAddress[obj2] : r1689_2 +# 1689| r1689_11(glval) = VariableAddress[#this] : +# 1689| r1689_12(lambda [] type at line 1689, col. 29 *) = Load[#this] : &:r1689_11, ~m? +# 1689| r1689_13(glval) = FieldAddress[obj2] : r1689_12 +# 1689| r1689_14(CapturedLambdaMyObj) = Load[?] : &:r1689_13, ~m? +# 1689| mu1689_15(CapturedLambdaMyObj) = Store[?] : &:r1689_10, r1689_14 +# 1689| r1689_16(glval) = FieldAddress[x] : r1689_2 +# 1689| r1689_17(glval) = VariableAddress[#this] : +# 1689| r1689_18(lambda [] type at line 1688, col. 25 *) = Load[#this] : &:r1689_17, ~m? +# 1689| r1689_19(glval) = FieldAddress[x] : r1689_18 +# 1689| r1689_20(int) = Load[?] : &:r1689_19, ~m? +# 1689| mu1689_21(int) = Store[?] : &:r1689_16, r1689_20 +# 1689| r1689_22(glval) = FieldAddress[y] : r1689_2 +# 1689| r1689_23(glval) = VariableAddress[#this] : +# 1689| r1689_24(lambda [] type at line 1688, col. 25 *) = Load[#this] : &:r1689_23, ~m? +# 1689| r1689_25(glval) = FieldAddress[y] : r1689_24 +# 1689| r1689_26(int) = Load[?] : &:r1689_25, ~m? +# 1689| mu1689_27(int) = Store[?] : &:r1689_22, r1689_26 +# 1689| r1689_28(glval) = FieldAddress[z] : r1689_2 +# 1689| r1689_29(glval) = VariableAddress[#this] : +# 1689| r1689_30(lambda [] type at line 1688, col. 25 *) = Load[#this] : &:r1689_29, ~m? +# 1689| r1689_31(glval) = FieldAddress[z] : r1689_30 +# 1689| r1689_32(int) = Load[?] : &:r1689_31, ~m? +# 1689| mu1689_33(int) = Store[?] : &:r1689_28, r1689_32 +# 1689| r1689_34(decltype([...](...){...})) = Load[#temp1689:28] : &:r1689_2, ~m? +# 1689| mu1689_35(decltype([...](...){...})) = Store[lambda_inner] : &:r1689_1, r1689_34 +# 1690| v1690_1(void) = NoOp : +# 1688| v1688_8(void) = ReturnIndirection[#this] : &:r1688_6, ~m? +# 1688| v1688_9(void) = ReturnVoid : +# 1688| v1688_10(void) = AliasedUse : ~m? +# 1688| v1688_11(void) = ExitFunction : # 1689| void (void (void captured_lambda(int, int&, int&&))::(lambda [] type at line 1688, col. 25)::operator()() const)::(lambda [] type at line 1689, col. 29)::operator()() const # 1689| Block 0 @@ -9025,16 +9043,17 @@ ir.cpp: # 1702| r1702_2(glval) = VariableAddress[#temp1702:25] : # 1702| mu1702_3(decltype([...](...){...})) = Uninitialized[#temp1702:25] : &:r1702_2 # 1702| r1702_4(glval) = FieldAddress[(captured this)] : r1702_2 - -# 1702| Block 1 -# 1702| mu1702_5(TrivialLambdaClass) = Store[?] : &:r1702_4 -# 1702| r1702_6(decltype([...](...){...})) = Load[#temp1702:25] : &:r1702_2, ~m? -# 1702| mu1702_7(decltype([...](...){...})) = Store[l_m_outer] : &:r1702_1, r1702_6 -# 1709| v1709_1(void) = NoOp : -# 1701| v1701_8(void) = ReturnIndirection[#this] : &:r1701_6, ~m? -# 1701| v1701_9(void) = ReturnVoid : -# 1701| v1701_10(void) = AliasedUse : ~m? -# 1701| v1701_11(void) = ExitFunction : +# 1702| r1702_5(glval) = VariableAddress[#this] : +# 1702| r1702_6(TrivialLambdaClass *) = Load[#this] : &:r1702_5, ~m? +# 1702| r1702_7(TrivialLambdaClass) = Load[?] : &:r1702_6, ~m? +# 1702| mu1702_8(TrivialLambdaClass) = Store[?] : &:r1702_4, r1702_7 +# 1702| r1702_9(decltype([...](...){...})) = Load[#temp1702:25] : &:r1702_2, ~m? +# 1702| mu1702_10(decltype([...](...){...})) = Store[l_m_outer] : &:r1702_1, r1702_9 +# 1709| v1709_1(void) = NoOp : +# 1701| v1701_8(void) = ReturnIndirection[#this] : &:r1701_6, ~m? +# 1701| v1701_9(void) = ReturnVoid : +# 1701| v1701_10(void) = AliasedUse : ~m? +# 1701| v1701_11(void) = ExitFunction : # 1702| void (void TrivialLambdaClass::m() const)::(lambda [] type at line 1702, col. 26)::operator()() const # 1702| Block 0 @@ -9057,16 +9076,18 @@ ir.cpp: # 1705| r1705_2(glval) = VariableAddress[#temp1705:29] : # 1705| mu1705_3(decltype([...](...){...})) = Uninitialized[#temp1705:29] : &:r1705_2 # 1705| r1705_4(glval) = FieldAddress[(captured this)] : r1705_2 - -# 1705| Block 1 -# 1705| mu1705_5(TrivialLambdaClass) = Store[?] : &:r1705_4 -# 1705| r1705_6(decltype([...](...){...})) = Load[#temp1705:29] : &:r1705_2, ~m? -# 1705| mu1705_7(decltype([...](...){...})) = Store[l_m_inner] : &:r1705_1, r1705_6 -# 1708| v1708_1(void) = NoOp : -# 1702| v1702_8(void) = ReturnIndirection[#this] : &:r1702_6, ~m? -# 1702| v1702_9(void) = ReturnVoid : -# 1702| v1702_10(void) = AliasedUse : ~m? -# 1702| v1702_11(void) = ExitFunction : +# 1705| r1705_5(glval) = VariableAddress[#this] : +# 1705| r1705_6(lambda [] type at line 1705, col. 30 *) = Load[#this] : &:r1705_5, ~m? +# 1705| r1705_7(glval) = FieldAddress[(captured this)] : r1705_6 +# 1705| r1705_8(TrivialLambdaClass) = Load[?] : &:r1705_7, ~m? +# 1705| mu1705_9(TrivialLambdaClass) = Store[?] : &:r1705_4, r1705_8 +# 1705| r1705_10(decltype([...](...){...})) = Load[#temp1705:29] : &:r1705_2, ~m? +# 1705| mu1705_11(decltype([...](...){...})) = Store[l_m_inner] : &:r1705_1, r1705_10 +# 1708| v1708_1(void) = NoOp : +# 1702| v1702_8(void) = ReturnIndirection[#this] : &:r1702_6, ~m? +# 1702| v1702_9(void) = ReturnVoid : +# 1702| v1702_10(void) = AliasedUse : ~m? +# 1702| v1702_11(void) = ExitFunction : # 1705| void (void (void TrivialLambdaClass::m() const)::(lambda [] type at line 1702, col. 26)::operator()() const)::(lambda [] type at line 1705, col. 30)::operator()() const # 1705| Block 0 @@ -9122,57 +9143,62 @@ ir.cpp: # 1716| r1716_2(glval) = VariableAddress[#temp1716:20] : # 1716| mu1716_3(decltype([...](...){...})) = Uninitialized[#temp1716:20] : &:r1716_2 # 1716| r1716_4(glval) = FieldAddress[p1] : r1716_2 - -# 1716| Block 1 -# 1716| mu1716_5(TrivialLambdaClass) = Store[?] : &:r1716_4 -# 1716| r1716_6(glval) = FieldAddress[p2] : r1716_2 - -# 1716| Block 2 -# 1716| mu1716_7(TrivialLambdaClass) = Store[?] : &:r1716_6 -# 1716| r1716_8(glval) = FieldAddress[p3] : r1716_2 - -# 1716| Block 3 -# 1716| mu1716_9(TrivialLambdaClass) = Store[?] : &:r1716_8 -# 1716| r1716_10(glval) = FieldAddress[l1] : r1716_2 - -# 1716| Block 4 -# 1716| mu1716_11(TrivialLambdaClass) = Store[?] : &:r1716_10 -# 1716| r1716_12(glval) = FieldAddress[l2] : r1716_2 - -# 1716| Block 5 -# 1716| mu1716_13(TrivialLambdaClass) = Store[?] : &:r1716_12 -# 1716| r1716_14(decltype([...](...){...})) = Load[#temp1716:20] : &:r1716_2, ~m? -# 1716| mu1716_15(decltype([...](...){...})) = Store[l_outer1] : &:r1716_1, r1716_14 -# 1719| v1719_1(void) = NoOp : -# 1712| v1712_14(void) = ReturnIndirection[p2] : &:r1712_8, ~m? -# 1712| v1712_15(void) = ReturnIndirection[p3] : &:r1712_12, ~m? -# 1712| v1712_16(void) = ReturnVoid : -# 1712| v1712_17(void) = AliasedUse : ~m? -# 1712| v1712_18(void) = ExitFunction : +# 1716| r1716_5(glval) = VariableAddress[p1] : +# 1716| r1716_6(TrivialLambdaClass) = Load[p1] : &:r1716_5, ~m? +# 1716| mu1716_7(TrivialLambdaClass) = Store[?] : &:r1716_4, r1716_6 +# 1716| r1716_8(glval) = FieldAddress[p2] : r1716_2 +# 1716| r1716_9(glval) = VariableAddress[p2] : +# 1716| r1716_10(TrivialLambdaClass &) = Load[p2] : &:r1716_9, ~m? +#-----| r0_1(TrivialLambdaClass) = Load[?] : &:r1716_10, ~m? +#-----| mu0_2(TrivialLambdaClass) = Store[?] : &:r1716_8, r0_1 +# 1716| r1716_11(glval) = FieldAddress[p3] : r1716_2 +# 1716| r1716_12(glval) = VariableAddress[p3] : +# 1716| r1716_13(TrivialLambdaClass &&) = Load[p3] : &:r1716_12, ~m? +#-----| r0_3(TrivialLambdaClass) = Load[?] : &:r1716_13, ~m? +#-----| mu0_4(TrivialLambdaClass) = Store[?] : &:r1716_11, r0_3 +# 1716| r1716_14(glval) = FieldAddress[l1] : r1716_2 +# 1716| r1716_15(glval) = VariableAddress[l1] : +# 1716| r1716_16(TrivialLambdaClass) = Load[l1] : &:r1716_15, ~m? +# 1716| mu1716_17(TrivialLambdaClass) = Store[?] : &:r1716_14, r1716_16 +# 1716| r1716_18(glval) = FieldAddress[l2] : r1716_2 +# 1716| r1716_19(glval) = VariableAddress[l2] : +# 1716| r1716_20(TrivialLambdaClass &) = Load[l2] : &:r1716_19, ~m? +#-----| r0_5(TrivialLambdaClass) = Load[?] : &:r1716_20, ~m? +#-----| mu0_6(TrivialLambdaClass) = Store[?] : &:r1716_18, r0_5 +# 1716| r1716_21(decltype([...](...){...})) = Load[#temp1716:20] : &:r1716_2, ~m? +# 1716| mu1716_22(decltype([...](...){...})) = Store[l_outer1] : &:r1716_1, r1716_21 +# 1719| v1719_1(void) = NoOp : +# 1712| v1712_14(void) = ReturnIndirection[p2] : &:r1712_8, ~m? +# 1712| v1712_15(void) = ReturnIndirection[p3] : &:r1712_12, ~m? +# 1712| v1712_16(void) = ReturnVoid : +# 1712| v1712_17(void) = AliasedUse : ~m? +# 1712| v1712_18(void) = ExitFunction : # 1716| void (void captured_lambda2(TrivialLambdaClass, TrivialLambdaClass&, TrivialLambdaClass&&))::(lambda [] type at line 1716, col. 21)::operator()() const # 1716| Block 0 -# 1716| v1716_1(void) = EnterFunction : -# 1716| mu1716_2(unknown) = AliasedDefinition : -# 1716| mu1716_3(unknown) = InitializeNonLocal : -# 1716| r1716_4(glval) = VariableAddress[#this] : -# 1716| mu1716_5(glval) = InitializeParameter[#this] : &:r1716_4 -# 1716| r1716_6(glval) = Load[#this] : &:r1716_4, ~m? -# 1716| mu1716_7(decltype([...](...){...})) = InitializeIndirection[#this] : &:r1716_6 -# 1717| r1717_1(glval) = VariableAddress[l_inner1] : -# 1717| r1717_2(glval) = VariableAddress[#temp1717:24] : -# 1717| mu1717_3(decltype([...](...){...})) = Uninitialized[#temp1717:24] : &:r1717_2 -# 1717| r1717_4(glval) = FieldAddress[p1] : r1717_2 - -# 1717| Block 1 -# 1717| mu1717_5(TrivialLambdaClass) = Store[?] : &:r1717_4 -# 1717| r1717_6(decltype([...](...){...})) = Load[#temp1717:24] : &:r1717_2, ~m? -# 1717| mu1717_7(decltype([...](...){...})) = Store[l_inner1] : &:r1717_1, r1717_6 -# 1718| v1718_1(void) = NoOp : -# 1716| v1716_8(void) = ReturnIndirection[#this] : &:r1716_6, ~m? -# 1716| v1716_9(void) = ReturnVoid : -# 1716| v1716_10(void) = AliasedUse : ~m? -# 1716| v1716_11(void) = ExitFunction : +# 1716| v1716_1(void) = EnterFunction : +# 1716| mu1716_2(unknown) = AliasedDefinition : +# 1716| mu1716_3(unknown) = InitializeNonLocal : +# 1716| r1716_4(glval) = VariableAddress[#this] : +# 1716| mu1716_5(glval) = InitializeParameter[#this] : &:r1716_4 +# 1716| r1716_6(glval) = Load[#this] : &:r1716_4, ~m? +# 1716| mu1716_7(decltype([...](...){...})) = InitializeIndirection[#this] : &:r1716_6 +# 1717| r1717_1(glval) = VariableAddress[l_inner1] : +# 1717| r1717_2(glval) = VariableAddress[#temp1717:24] : +# 1717| mu1717_3(decltype([...](...){...})) = Uninitialized[#temp1717:24] : &:r1717_2 +# 1717| r1717_4(glval) = FieldAddress[p1] : r1717_2 +# 1717| r1717_5(glval) = VariableAddress[#this] : +# 1717| r1717_6(lambda [] type at line 1717, col. 25 *) = Load[#this] : &:r1717_5, ~m? +# 1717| r1717_7(glval) = FieldAddress[p1] : r1717_6 +# 1717| r1717_8(TrivialLambdaClass) = Load[?] : &:r1717_7, ~m? +# 1717| mu1717_9(TrivialLambdaClass) = Store[?] : &:r1717_4, r1717_8 +# 1717| r1717_10(decltype([...](...){...})) = Load[#temp1717:24] : &:r1717_2, ~m? +# 1717| mu1717_11(decltype([...](...){...})) = Store[l_inner1] : &:r1717_1, r1717_10 +# 1718| v1718_1(void) = NoOp : +# 1716| v1716_8(void) = ReturnIndirection[#this] : &:r1716_6, ~m? +# 1716| v1716_9(void) = ReturnVoid : +# 1716| v1716_10(void) = AliasedUse : ~m? +# 1716| v1716_11(void) = ExitFunction : # 1717| void (void (void captured_lambda2(TrivialLambdaClass, TrivialLambdaClass&, TrivialLambdaClass&&))::(lambda [] type at line 1716, col. 21)::operator()() const)::(lambda [] type at line 1717, col. 25)::operator()() const # 1717| Block 0 @@ -9250,28 +9276,34 @@ ir.cpp: # 1736| void CopyConstructorTestNonVirtualClass::CopyConstructorTestNonVirtualClass(CopyConstructorTestNonVirtualClass const&) # 1736| Block 0 -# 1736| v1736_1(void) = EnterFunction : -# 1736| mu1736_2(unknown) = AliasedDefinition : -# 1736| mu1736_3(unknown) = InitializeNonLocal : -# 1736| r1736_4(glval) = VariableAddress[#this] : -# 1736| mu1736_5(glval) = InitializeParameter[#this] : &:r1736_4 -# 1736| r1736_6(glval) = Load[#this] : &:r1736_4, ~m? -# 1736| mu1736_7(CopyConstructorTestNonVirtualClass) = InitializeIndirection[#this] : &:r1736_6 -#-----| r0_1(glval) = VariableAddress[(unnamed parameter 0)] : -#-----| mu0_2(CopyConstructorTestNonVirtualClass &) = InitializeParameter[(unnamed parameter 0)] : &:r0_1 -#-----| r0_3(CopyConstructorTestNonVirtualClass &) = Load[(unnamed parameter 0)] : &:r0_1, ~m? -#-----| mu0_4(unknown) = InitializeIndirection[(unnamed parameter 0)] : &:r0_3 -# 1736| r1736_8(glval) = ConvertToNonVirtualBase[CopyConstructorTestNonVirtualClass : CopyConstructorWithImplicitArgumentClass] : mu1736_5 -# 1736| r1736_9(glval) = FunctionAddress[CopyConstructorWithImplicitArgumentClass] : -# 1736| v1736_10(void) = Call[CopyConstructorWithImplicitArgumentClass] : func:r1736_9, this:r1736_8 -# 1736| mu1736_11(unknown) = ^CallSideEffect : ~m? -# 1736| mu1736_12(CopyConstructorWithImplicitArgumentClass) = ^IndirectMayWriteSideEffect[-1] : &:r1736_8 -# 1736| v1736_13(void) = NoOp : -# 1736| v1736_14(void) = ReturnIndirection[#this] : &:r1736_6, ~m? -#-----| v0_5(void) = ReturnIndirection[(unnamed parameter 0)] : &:r0_3, ~m? -# 1736| v1736_15(void) = ReturnVoid : -# 1736| v1736_16(void) = AliasedUse : ~m? -# 1736| v1736_17(void) = ExitFunction : +# 1736| v1736_1(void) = EnterFunction : +# 1736| mu1736_2(unknown) = AliasedDefinition : +# 1736| mu1736_3(unknown) = InitializeNonLocal : +# 1736| r1736_4(glval) = VariableAddress[#this] : +# 1736| mu1736_5(glval) = InitializeParameter[#this] : &:r1736_4 +# 1736| r1736_6(glval) = Load[#this] : &:r1736_4, ~m? +# 1736| mu1736_7(CopyConstructorTestNonVirtualClass) = InitializeIndirection[#this] : &:r1736_6 +#-----| r0_1(glval) = VariableAddress[(unnamed parameter 0)] : +#-----| mu0_2(CopyConstructorTestNonVirtualClass &) = InitializeParameter[(unnamed parameter 0)] : &:r0_1 +#-----| r0_3(CopyConstructorTestNonVirtualClass &) = Load[(unnamed parameter 0)] : &:r0_1, ~m? +#-----| mu0_4(unknown) = InitializeIndirection[(unnamed parameter 0)] : &:r0_3 +# 1736| r1736_8(glval) = ConvertToNonVirtualBase[CopyConstructorTestNonVirtualClass : CopyConstructorWithImplicitArgumentClass] : mu1736_5 +# 1736| r1736_9(glval) = FunctionAddress[CopyConstructorWithImplicitArgumentClass] : +# 1736| r1736_10(glval) = VariableAddress[(unnamed parameter 0)] : +# 1736| r1736_11(CopyConstructorTestNonVirtualClass &) = Load[(unnamed parameter 0)] : &:r1736_10, ~m? +# 1736| r1736_12(glval) = CopyValue : r1736_11 +# 1736| r1736_13(glval) = ConvertToNonVirtualBase[CopyConstructorTestNonVirtualClass : CopyConstructorWithImplicitArgumentClass] : r1736_12 +# 1736| r1736_14(CopyConstructorWithImplicitArgumentClass &) = CopyValue : r1736_13 +# 1736| v1736_15(void) = Call[CopyConstructorWithImplicitArgumentClass] : func:r1736_9, this:r1736_8, 0:r1736_14 +# 1736| mu1736_16(unknown) = ^CallSideEffect : ~m? +# 1736| v1736_17(void) = ^BufferReadSideEffect[0] : &:r1736_14, ~m? +# 1736| mu1736_18(CopyConstructorWithImplicitArgumentClass) = ^IndirectMayWriteSideEffect[-1] : &:r1736_8 +# 1736| v1736_19(void) = NoOp : +# 1736| v1736_20(void) = ReturnIndirection[#this] : &:r1736_6, ~m? +#-----| v0_5(void) = ReturnIndirection[(unnamed parameter 0)] : &:r0_3, ~m? +# 1736| v1736_21(void) = ReturnVoid : +# 1736| v1736_22(void) = AliasedUse : ~m? +# 1736| v1736_23(void) = ExitFunction : # 1740| void CopyConstructorTestNonVirtualClass::CopyConstructorTestNonVirtualClass() # 1740| Block 0 @@ -9300,28 +9332,34 @@ ir.cpp: # 1743| void CopyConstructorTestVirtualClass::CopyConstructorTestVirtualClass(CopyConstructorTestVirtualClass const&) # 1743| Block 0 -# 1743| v1743_1(void) = EnterFunction : -# 1743| mu1743_2(unknown) = AliasedDefinition : -# 1743| mu1743_3(unknown) = InitializeNonLocal : -# 1743| r1743_4(glval) = VariableAddress[#this] : -# 1743| mu1743_5(glval) = InitializeParameter[#this] : &:r1743_4 -# 1743| r1743_6(glval) = Load[#this] : &:r1743_4, ~m? -# 1743| mu1743_7(CopyConstructorTestVirtualClass) = InitializeIndirection[#this] : &:r1743_6 -#-----| r0_1(glval) = VariableAddress[(unnamed parameter 0)] : -#-----| mu0_2(CopyConstructorTestVirtualClass &) = InitializeParameter[(unnamed parameter 0)] : &:r0_1 -#-----| r0_3(CopyConstructorTestVirtualClass &) = Load[(unnamed parameter 0)] : &:r0_1, ~m? -#-----| mu0_4(unknown) = InitializeIndirection[(unnamed parameter 0)] : &:r0_3 -# 1743| r1743_8(glval) = ConvertToNonVirtualBase[CopyConstructorTestVirtualClass : CopyConstructorWithImplicitArgumentClass] : mu1743_5 -# 1743| r1743_9(glval) = FunctionAddress[CopyConstructorWithImplicitArgumentClass] : -# 1743| v1743_10(void) = Call[CopyConstructorWithImplicitArgumentClass] : func:r1743_9, this:r1743_8 -# 1743| mu1743_11(unknown) = ^CallSideEffect : ~m? -# 1743| mu1743_12(CopyConstructorWithImplicitArgumentClass) = ^IndirectMayWriteSideEffect[-1] : &:r1743_8 -# 1743| v1743_13(void) = NoOp : -# 1743| v1743_14(void) = ReturnIndirection[#this] : &:r1743_6, ~m? -#-----| v0_5(void) = ReturnIndirection[(unnamed parameter 0)] : &:r0_3, ~m? -# 1743| v1743_15(void) = ReturnVoid : -# 1743| v1743_16(void) = AliasedUse : ~m? -# 1743| v1743_17(void) = ExitFunction : +# 1743| v1743_1(void) = EnterFunction : +# 1743| mu1743_2(unknown) = AliasedDefinition : +# 1743| mu1743_3(unknown) = InitializeNonLocal : +# 1743| r1743_4(glval) = VariableAddress[#this] : +# 1743| mu1743_5(glval) = InitializeParameter[#this] : &:r1743_4 +# 1743| r1743_6(glval) = Load[#this] : &:r1743_4, ~m? +# 1743| mu1743_7(CopyConstructorTestVirtualClass) = InitializeIndirection[#this] : &:r1743_6 +#-----| r0_1(glval) = VariableAddress[(unnamed parameter 0)] : +#-----| mu0_2(CopyConstructorTestVirtualClass &) = InitializeParameter[(unnamed parameter 0)] : &:r0_1 +#-----| r0_3(CopyConstructorTestVirtualClass &) = Load[(unnamed parameter 0)] : &:r0_1, ~m? +#-----| mu0_4(unknown) = InitializeIndirection[(unnamed parameter 0)] : &:r0_3 +# 1743| r1743_8(glval) = ConvertToNonVirtualBase[CopyConstructorTestVirtualClass : CopyConstructorWithImplicitArgumentClass] : mu1743_5 +# 1743| r1743_9(glval) = FunctionAddress[CopyConstructorWithImplicitArgumentClass] : +# 1743| r1743_10(glval) = VariableAddress[(unnamed parameter 0)] : +# 1743| r1743_11(CopyConstructorTestVirtualClass &) = Load[(unnamed parameter 0)] : &:r1743_10, ~m? +# 1743| r1743_12(glval) = CopyValue : r1743_11 +# 1743| r1743_13(glval) = ConvertToVirtualBase[CopyConstructorTestVirtualClass : CopyConstructorWithImplicitArgumentClass] : r1743_12 +# 1743| r1743_14(CopyConstructorWithImplicitArgumentClass &) = CopyValue : r1743_13 +# 1743| v1743_15(void) = Call[CopyConstructorWithImplicitArgumentClass] : func:r1743_9, this:r1743_8, 0:r1743_14 +# 1743| mu1743_16(unknown) = ^CallSideEffect : ~m? +# 1743| v1743_17(void) = ^BufferReadSideEffect[0] : &:r1743_14, ~m? +# 1743| mu1743_18(CopyConstructorWithImplicitArgumentClass) = ^IndirectMayWriteSideEffect[-1] : &:r1743_8 +# 1743| v1743_19(void) = NoOp : +# 1743| v1743_20(void) = ReturnIndirection[#this] : &:r1743_6, ~m? +#-----| v0_5(void) = ReturnIndirection[(unnamed parameter 0)] : &:r0_3, ~m? +# 1743| v1743_21(void) = ReturnVoid : +# 1743| v1743_22(void) = AliasedUse : ~m? +# 1743| v1743_23(void) = ExitFunction : # 1747| void CopyConstructorTestVirtualClass::CopyConstructorTestVirtualClass() # 1747| Block 0 diff --git a/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency.expected b/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency.expected index 5cccae1da93..31e5b01229c 100644 --- a/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency.expected +++ b/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency.expected @@ -6,12 +6,6 @@ missingOperandType duplicateChiOperand sideEffectWithoutPrimary instructionWithoutSuccessor -| ir.cpp:1688:24:1690:5 | FieldAddress: {...} | Instruction 'FieldAddress: {...}' has no successors in function '$@'. | ir.cpp:1683:6:1683:20 | void captured_lambda(int, int&, int&&) | void captured_lambda(int, int&, int&&) | -| ir.cpp:1689:28:1689:54 | FieldAddress: {...} | Instruction 'FieldAddress: {...}' has no successors in function '$@'. | ir.cpp:1688:46:1688:46 | void (void captured_lambda(int, int&, int&&))::(lambda [] type at line 1688, col. 25)::operator()() const | void (void captured_lambda(int, int&, int&&))::(lambda [] type at line 1688, col. 25)::operator()() const | -| ir.cpp:1702:25:1708:9 | FieldAddress: {...} | Instruction 'FieldAddress: {...}' has no successors in function '$@'. | ir.cpp:1701:10:1701:10 | void TrivialLambdaClass::m() const | void TrivialLambdaClass::m() const | -| ir.cpp:1705:29:1707:13 | FieldAddress: {...} | Instruction 'FieldAddress: {...}' has no successors in function '$@'. | ir.cpp:1702:34:1702:34 | void (void TrivialLambdaClass::m() const)::(lambda [] type at line 1702, col. 26)::operator()() const | void (void TrivialLambdaClass::m() const)::(lambda [] type at line 1702, col. 26)::operator()() const | -| ir.cpp:1716:20:1718:5 | FieldAddress: {...} | Instruction 'FieldAddress: {...}' has no successors in function '$@'. | ir.cpp:1712:6:1712:21 | void captured_lambda2(TrivialLambdaClass, TrivialLambdaClass&, TrivialLambdaClass&&) | void captured_lambda2(TrivialLambdaClass, TrivialLambdaClass&, TrivialLambdaClass&&) | -| ir.cpp:1717:24:1717:31 | FieldAddress: {...} | Instruction 'FieldAddress: {...}' has no successors in function '$@'. | ir.cpp:1716:42:1716:42 | void (void captured_lambda2(TrivialLambdaClass, TrivialLambdaClass&, TrivialLambdaClass&&))::(lambda [] type at line 1716, col. 21)::operator()() const | void (void captured_lambda2(TrivialLambdaClass, TrivialLambdaClass&, TrivialLambdaClass&&))::(lambda [] type at line 1716, col. 21)::operator()() const | ambiguousSuccessors unexplainedLoop unnecessaryPhiInstruction diff --git a/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency_unsound.expected b/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency_unsound.expected index 5cccae1da93..31e5b01229c 100644 --- a/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency_unsound.expected +++ b/cpp/ql/test/library-tests/ir/ir/unaliased_ssa_consistency_unsound.expected @@ -6,12 +6,6 @@ missingOperandType duplicateChiOperand sideEffectWithoutPrimary instructionWithoutSuccessor -| ir.cpp:1688:24:1690:5 | FieldAddress: {...} | Instruction 'FieldAddress: {...}' has no successors in function '$@'. | ir.cpp:1683:6:1683:20 | void captured_lambda(int, int&, int&&) | void captured_lambda(int, int&, int&&) | -| ir.cpp:1689:28:1689:54 | FieldAddress: {...} | Instruction 'FieldAddress: {...}' has no successors in function '$@'. | ir.cpp:1688:46:1688:46 | void (void captured_lambda(int, int&, int&&))::(lambda [] type at line 1688, col. 25)::operator()() const | void (void captured_lambda(int, int&, int&&))::(lambda [] type at line 1688, col. 25)::operator()() const | -| ir.cpp:1702:25:1708:9 | FieldAddress: {...} | Instruction 'FieldAddress: {...}' has no successors in function '$@'. | ir.cpp:1701:10:1701:10 | void TrivialLambdaClass::m() const | void TrivialLambdaClass::m() const | -| ir.cpp:1705:29:1707:13 | FieldAddress: {...} | Instruction 'FieldAddress: {...}' has no successors in function '$@'. | ir.cpp:1702:34:1702:34 | void (void TrivialLambdaClass::m() const)::(lambda [] type at line 1702, col. 26)::operator()() const | void (void TrivialLambdaClass::m() const)::(lambda [] type at line 1702, col. 26)::operator()() const | -| ir.cpp:1716:20:1718:5 | FieldAddress: {...} | Instruction 'FieldAddress: {...}' has no successors in function '$@'. | ir.cpp:1712:6:1712:21 | void captured_lambda2(TrivialLambdaClass, TrivialLambdaClass&, TrivialLambdaClass&&) | void captured_lambda2(TrivialLambdaClass, TrivialLambdaClass&, TrivialLambdaClass&&) | -| ir.cpp:1717:24:1717:31 | FieldAddress: {...} | Instruction 'FieldAddress: {...}' has no successors in function '$@'. | ir.cpp:1716:42:1716:42 | void (void captured_lambda2(TrivialLambdaClass, TrivialLambdaClass&, TrivialLambdaClass&&))::(lambda [] type at line 1716, col. 21)::operator()() const | void (void captured_lambda2(TrivialLambdaClass, TrivialLambdaClass&, TrivialLambdaClass&&))::(lambda [] type at line 1716, col. 21)::operator()() const | ambiguousSuccessors unexplainedLoop unnecessaryPhiInstruction diff --git a/cpp/ql/test/library-tests/syntax-zoo/aliased_ssa_consistency.expected b/cpp/ql/test/library-tests/syntax-zoo/aliased_ssa_consistency.expected index fcfef712b56..db803126364 100644 --- a/cpp/ql/test/library-tests/syntax-zoo/aliased_ssa_consistency.expected +++ b/cpp/ql/test/library-tests/syntax-zoo/aliased_ssa_consistency.expected @@ -4,6 +4,8 @@ unexpectedOperand duplicateOperand missingPhiOperand missingOperandType +| cpp11.cpp:36:18:36:18 | ChiTotal | Operand 'ChiTotal' of instruction 'Chi' is missing a type in function '$@'. | cpp11.cpp:36:5:36:14 | int global_int | int global_int | +| misc.c:210:24:210:28 | ChiTotal | Operand 'ChiTotal' of instruction 'Chi' is missing a type in function '$@'. | misc.c:210:5:210:20 | int global_with_init | int global_with_init | duplicateChiOperand sideEffectWithoutPrimary instructionWithoutSuccessor @@ -91,6 +93,8 @@ useNotDominatedByDefinition switchInstructionWithoutDefaultEdge notMarkedAsConflated wronglyMarkedAsConflated +| cpp11.cpp:36:18:36:18 | Chi: 5 | Instruction 'Chi: 5' should not be marked as having a conflated result in function '$@'. | cpp11.cpp:36:5:36:14 | int global_int | int global_int | +| misc.c:210:24:210:28 | Chi: ... + ... | Instruction 'Chi: ... + ...' should not be marked as having a conflated result in function '$@'. | misc.c:210:5:210:20 | int global_with_init | int global_with_init | invalidOverlap nonUniqueEnclosingIRFunction fieldAddressOnNonPointer diff --git a/cpp/ql/test/library-tests/syntax-zoo/dataflow-ir-consistency.expected b/cpp/ql/test/library-tests/syntax-zoo/dataflow-ir-consistency.expected index e37a676565c..53bdffc3be3 100644 --- a/cpp/ql/test/library-tests/syntax-zoo/dataflow-ir-consistency.expected +++ b/cpp/ql/test/library-tests/syntax-zoo/dataflow-ir-consistency.expected @@ -1,4 +1,45 @@ uniqueEnclosingCallable +| cpp11.cpp:35:11:35:22 | Address | Node should have one enclosing callable but has 0. | +| cpp11.cpp:35:11:35:22 | AliasedDefinition | Node should have one enclosing callable but has 0. | +| cpp11.cpp:35:11:35:22 | VariableAddress | Node should have one enclosing callable but has 0. | +| cpp11.cpp:35:11:35:22 | VariableAddress [post update] | Node should have one enclosing callable but has 0. | +| cpp11.cpp:35:26:35:26 | 5 | Node should have one enclosing callable but has 0. | +| cpp11.cpp:35:26:35:26 | ChiPartial | Node should have one enclosing callable but has 0. | +| cpp11.cpp:35:26:35:26 | ChiTotal | Node should have one enclosing callable but has 0. | +| cpp11.cpp:35:26:35:26 | Store | Node should have one enclosing callable but has 0. | +| cpp11.cpp:35:26:35:26 | StoreValue | Node should have one enclosing callable but has 0. | +| cpp11.cpp:36:5:36:14 | Address | Node should have one enclosing callable but has 0. | +| cpp11.cpp:36:5:36:14 | VariableAddress | Node should have one enclosing callable but has 0. | +| cpp11.cpp:36:5:36:14 | VariableAddress [post update] | Node should have one enclosing callable but has 0. | +| cpp11.cpp:36:18:36:18 | 5 | Node should have one enclosing callable but has 0. | +| cpp11.cpp:36:18:36:18 | ChiPartial | Node should have one enclosing callable but has 0. | +| cpp11.cpp:36:18:36:18 | Store | Node should have one enclosing callable but has 0. | +| cpp11.cpp:36:18:36:18 | StoreValue | Node should have one enclosing callable but has 0. | +| misc.c:10:5:10:13 | Address | Node should have one enclosing callable but has 0. | +| misc.c:10:5:10:13 | AliasedDefinition | Node should have one enclosing callable but has 0. | +| misc.c:10:5:10:13 | VariableAddress | Node should have one enclosing callable but has 0. | +| misc.c:10:5:10:13 | VariableAddress [post update] | Node should have one enclosing callable but has 0. | +| misc.c:10:17:10:17 | 1 | Node should have one enclosing callable but has 0. | +| misc.c:10:17:10:17 | ChiPartial | Node should have one enclosing callable but has 0. | +| misc.c:10:17:10:17 | ChiTotal | Node should have one enclosing callable but has 0. | +| misc.c:10:17:10:17 | Store | Node should have one enclosing callable but has 0. | +| misc.c:10:17:10:17 | StoreValue | Node should have one enclosing callable but has 0. | +| misc.c:11:5:11:13 | Address | Node should have one enclosing callable but has 0. | +| misc.c:11:5:11:13 | AliasedDefinition | Node should have one enclosing callable but has 0. | +| misc.c:11:5:11:13 | VariableAddress | Node should have one enclosing callable but has 0. | +| misc.c:11:5:11:13 | VariableAddress [post update] | Node should have one enclosing callable but has 0. | +| misc.c:11:17:11:21 | ... + ... | Node should have one enclosing callable but has 0. | +| misc.c:11:17:11:21 | ChiPartial | Node should have one enclosing callable but has 0. | +| misc.c:11:17:11:21 | ChiTotal | Node should have one enclosing callable but has 0. | +| misc.c:11:17:11:21 | Store | Node should have one enclosing callable but has 0. | +| misc.c:11:17:11:21 | StoreValue | Node should have one enclosing callable but has 0. | +| misc.c:210:5:210:20 | Address | Node should have one enclosing callable but has 0. | +| misc.c:210:5:210:20 | VariableAddress | Node should have one enclosing callable but has 0. | +| misc.c:210:5:210:20 | VariableAddress [post update] | Node should have one enclosing callable but has 0. | +| misc.c:210:24:210:28 | ... + ... | Node should have one enclosing callable but has 0. | +| misc.c:210:24:210:28 | ChiPartial | Node should have one enclosing callable but has 0. | +| misc.c:210:24:210:28 | Store | Node should have one enclosing callable but has 0. | +| misc.c:210:24:210:28 | StoreValue | Node should have one enclosing callable but has 0. | uniqueType uniqueNodeLocation | aggregateinitializer.c:1:6:1:6 | AliasedDefinition | Node should have one location but has 20. | @@ -1622,6 +1663,8 @@ postWithInFlow | cpp11.cpp:28:21:28:34 | temporary object [post update] | PostUpdateNode should not be the target of local flow. | | cpp11.cpp:29:7:29:16 | VariableAddress [post update] | PostUpdateNode should not be the target of local flow. | | cpp11.cpp:31:5:31:13 | VariableAddress [post update] | PostUpdateNode should not be the target of local flow. | +| cpp11.cpp:35:11:35:22 | VariableAddress [post update] | PostUpdateNode should not be the target of local flow. | +| cpp11.cpp:36:5:36:14 | VariableAddress [post update] | PostUpdateNode should not be the target of local flow. | | cpp11.cpp:56:14:56:15 | VariableAddress [post update] | PostUpdateNode should not be the target of local flow. | | cpp11.cpp:56:14:56:15 | VariableAddress [post update] | PostUpdateNode should not be the target of local flow. | | cpp11.cpp:60:15:60:16 | VariableAddress [post update] | PostUpdateNode should not be the target of local flow. | @@ -2230,6 +2273,8 @@ postWithInFlow | ltrbinopexpr.c:37:5:37:5 | VariableAddress [post update] | PostUpdateNode should not be the target of local flow. | | ltrbinopexpr.c:39:5:39:5 | VariableAddress [post update] | PostUpdateNode should not be the target of local flow. | | ltrbinopexpr.c:40:5:40:5 | VariableAddress [post update] | PostUpdateNode should not be the target of local flow. | +| misc.c:10:5:10:13 | VariableAddress [post update] | PostUpdateNode should not be the target of local flow. | +| misc.c:11:5:11:13 | VariableAddress [post update] | PostUpdateNode should not be the target of local flow. | | misc.c:18:5:18:5 | i [post update] | PostUpdateNode should not be the target of local flow. | | misc.c:19:5:19:5 | i [post update] | PostUpdateNode should not be the target of local flow. | | misc.c:20:7:20:7 | VariableAddress [post update] | PostUpdateNode should not be the target of local flow. | @@ -2289,6 +2334,7 @@ postWithInFlow | misc.c:200:24:200:27 | args [post update] | PostUpdateNode should not be the target of local flow. | | misc.c:200:24:200:27 | array to pointer conversion [post update] | PostUpdateNode should not be the target of local flow. | | misc.c:208:1:208:3 | VariableAddress [post update] | PostUpdateNode should not be the target of local flow. | +| misc.c:210:5:210:20 | VariableAddress [post update] | PostUpdateNode should not be the target of local flow. | | misc.c:216:3:216:26 | VariableAddress [post update] | PostUpdateNode should not be the target of local flow. | | misc.c:220:3:220:5 | * ... [post update] | PostUpdateNode should not be the target of local flow. | | misc.c:220:4:220:5 | VariableAddress [post update] | PostUpdateNode should not be the target of local flow. | diff --git a/cpp/ql/test/library-tests/valuenumbering/GlobalValueNumbering/diff_ir_expr.expected b/cpp/ql/test/library-tests/valuenumbering/GlobalValueNumbering/diff_ir_expr.expected index 7322e9723ec..b838a13d5af 100644 --- a/cpp/ql/test/library-tests/valuenumbering/GlobalValueNumbering/diff_ir_expr.expected +++ b/cpp/ql/test/library-tests/valuenumbering/GlobalValueNumbering/diff_ir_expr.expected @@ -1,18 +1,15 @@ | test.cpp:5:3:5:13 | ... = ... | test.cpp:5:3:5:13 | ... = ... | AST only | | test.cpp:6:3:6:13 | ... = ... | test.cpp:6:3:6:13 | ... = ... | AST only | | test.cpp:7:3:7:7 | ... = ... | test.cpp:7:3:7:7 | ... = ... | AST only | -| test.cpp:10:16:10:16 | 1 | test.cpp:10:16:10:16 | 1 | AST only | | test.cpp:16:3:16:24 | ... = ... | test.cpp:16:3:16:24 | ... = ... | AST only | | test.cpp:17:3:17:24 | ... = ... | test.cpp:17:3:17:24 | ... = ... | AST only | | test.cpp:18:3:18:7 | ... = ... | test.cpp:18:3:18:7 | ... = ... | AST only | -| test.cpp:21:16:21:16 | 2 | test.cpp:21:16:21:16 | 2 | AST only | | test.cpp:29:3:29:3 | x | test.cpp:31:3:31:3 | x | IR only | | test.cpp:29:3:29:24 | ... = ... | test.cpp:29:3:29:24 | ... = ... | AST only | | test.cpp:30:3:30:17 | call to change_global02 | test.cpp:30:3:30:17 | call to change_global02 | AST only | | test.cpp:31:3:31:3 | x | test.cpp:29:3:29:3 | x | IR only | | test.cpp:31:3:31:24 | ... = ... | test.cpp:31:3:31:24 | ... = ... | AST only | | test.cpp:32:3:32:7 | ... = ... | test.cpp:32:3:32:7 | ... = ... | AST only | -| test.cpp:35:16:35:16 | 3 | test.cpp:35:16:35:16 | 3 | AST only | | test.cpp:43:3:43:3 | x | test.cpp:45:3:45:3 | x | IR only | | test.cpp:43:3:43:24 | ... = ... | test.cpp:43:3:43:24 | ... = ... | AST only | | test.cpp:43:7:43:24 | ... + ... | test.cpp:45:7:45:24 | ... + ... | IR only | diff --git a/cpp/ql/test/library-tests/valuenumbering/GlobalValueNumbering/ir_gvn.expected b/cpp/ql/test/library-tests/valuenumbering/GlobalValueNumbering/ir_gvn.expected index 24dc1c1ab44..94941f4a70b 100644 --- a/cpp/ql/test/library-tests/valuenumbering/GlobalValueNumbering/ir_gvn.expected +++ b/cpp/ql/test/library-tests/valuenumbering/GlobalValueNumbering/ir_gvn.expected @@ -69,6 +69,23 @@ test.cpp: # 1| v1_10(void) = AliasedUse : m1_3 # 1| v1_11(void) = ExitFunction : +# 10| int global01 +# 10| Block 0 +# 10| v10_1(void) = EnterFunction : +# 10| m10_2(unknown) = AliasedDefinition : +# 10| valnum = unique +# 10| r10_3(glval) = VariableAddress[global01] : +# 10| valnum = unique +# 10| r10_4(int) = Constant[1] : +# 10| valnum = m10_5, r10_4 +# 10| m10_5(int) = Store[global01] : &:r10_3, r10_4 +# 10| valnum = m10_5, r10_4 +# 10| m10_6(unknown) = Chi : total:~m?, partial:m10_5 +# 10| valnum = unique +# 10| v10_7(void) = ReturnVoid : +# 10| v10_8(void) = AliasedUse : ~m10_2 +# 10| v10_9(void) = ExitFunction : + # 12| void test01(int, int) # 12| Block 0 # 12| v12_1(void) = EnterFunction : @@ -151,6 +168,23 @@ test.cpp: # 12| v12_10(void) = AliasedUse : m12_3 # 12| v12_11(void) = ExitFunction : +# 21| int global02 +# 21| Block 0 +# 21| v21_1(void) = EnterFunction : +# 21| m21_2(unknown) = AliasedDefinition : +# 21| valnum = unique +# 21| r21_3(glval) = VariableAddress[global02] : +# 21| valnum = unique +# 21| r21_4(int) = Constant[2] : +# 21| valnum = m21_5, r21_4 +# 21| m21_5(int) = Store[global02] : &:r21_3, r21_4 +# 21| valnum = m21_5, r21_4 +# 21| m21_6(unknown) = Chi : total:~m?, partial:m21_5 +# 21| valnum = unique +# 21| v21_7(void) = ReturnVoid : +# 21| v21_8(void) = AliasedUse : ~m21_2 +# 21| v21_9(void) = ExitFunction : + # 25| void test02(int, int) # 25| Block 0 # 25| v25_1(void) = EnterFunction : @@ -240,6 +274,23 @@ test.cpp: # 25| v25_10(void) = AliasedUse : ~m30_4 # 25| v25_11(void) = ExitFunction : +# 35| int global03 +# 35| Block 0 +# 35| v35_1(void) = EnterFunction : +# 35| m35_2(unknown) = AliasedDefinition : +# 35| valnum = unique +# 35| r35_3(glval) = VariableAddress[global03] : +# 35| valnum = unique +# 35| r35_4(int) = Constant[3] : +# 35| valnum = m35_5, r35_4 +# 35| m35_5(int) = Store[global03] : &:r35_3, r35_4 +# 35| valnum = m35_5, r35_4 +# 35| m35_6(unknown) = Chi : total:~m?, partial:m35_5 +# 35| valnum = unique +# 35| v35_7(void) = ReturnVoid : +# 35| v35_8(void) = AliasedUse : ~m35_2 +# 35| v35_9(void) = ExitFunction : + # 39| void test03(int, int, int*) # 39| Block 0 # 39| v39_1(void) = EnterFunction : @@ -890,6 +941,10 @@ test.cpp: # 124| v124_13(void) = AliasedUse : m124_3 # 124| v124_14(void) = ExitFunction : +# 132| A* global_a + +# 133| int global_n + # 135| void test_read_global_same() # 135| Block 0 # 135| v135_1(void) = EnterFunction : From d0fc348ad9aef28a1f55ebf1bf16d472c73b1646 Mon Sep 17 00:00:00 2001 From: Robert Marsh Date: Mon, 25 Apr 2022 14:17:49 -0400 Subject: [PATCH 19/19] C++: autoformat --- .../cpp/ir/implementation/raw/internal/TranslatedExpr.qll | 4 +--- .../ir/implementation/raw/internal/TranslatedGlobalVar.qll | 3 ++- cpp/ql/test/library-tests/ir/ir/raw_ir.ql | 4 +--- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedExpr.qll b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedExpr.qll index 249312fd556..affae501f72 100644 --- a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedExpr.qll +++ b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedExpr.qll @@ -80,9 +80,7 @@ abstract class TranslatedExpr extends TranslatedElement { /** DEPRECATED: Alias for getAst */ deprecated override Locatable getAST() { result = this.getAst() } - final override Declaration getFunction() { - result = expr.getEnclosingDeclaration() - } + final override Declaration getFunction() { result = expr.getEnclosingDeclaration() } /** * Gets the expression from which this `TranslatedExpr` is generated. diff --git a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedGlobalVar.qll b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedGlobalVar.qll index 3ff29c0ea91..abc175b7040 100644 --- a/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedGlobalVar.qll +++ b/cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedGlobalVar.qll @@ -24,7 +24,8 @@ class TranslatedGlobalOrNamespaceVarInit extends TranslatedRootElement, override Instruction getFirstInstruction() { result = this.getInstruction(EnterFunctionTag()) } override TranslatedElement getChild(int n) { - n = 1 and result = getTranslatedInitialization(var.getInitializer().getExpr().getFullyConverted()) + n = 1 and + result = getTranslatedInitialization(var.getInitializer().getExpr().getFullyConverted()) } override predicate hasInstruction(Opcode op, InstructionTag tag, CppType type) { diff --git a/cpp/ql/test/library-tests/ir/ir/raw_ir.ql b/cpp/ql/test/library-tests/ir/ir/raw_ir.ql index 55493a7e136..ae37a4a932b 100644 --- a/cpp/ql/test/library-tests/ir/ir/raw_ir.ql +++ b/cpp/ql/test/library-tests/ir/ir/raw_ir.ql @@ -7,7 +7,5 @@ private import semmle.code.cpp.ir.implementation.raw.PrintIR private import PrintConfig private class PrintConfig extends PrintIRConfiguration { - override predicate shouldPrintFunction(Declaration decl) { - shouldDumpFunction(decl) - } + override predicate shouldPrintFunction(Declaration decl) { shouldDumpFunction(decl) } }