From 9da324351e15334666e3762e3907fa83f0cda7e0 Mon Sep 17 00:00:00 2001 From: Jeroen Ketema Date: Sat, 11 Jan 2025 12:21:45 +0100 Subject: [PATCH] i --- .../aliased_ssa/internal/AliasedSSA.qll | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/cpp/ql/lib/semmle/code/cpp/ir/implementation/aliased_ssa/internal/AliasedSSA.qll b/cpp/ql/lib/semmle/code/cpp/ir/implementation/aliased_ssa/internal/AliasedSSA.qll index ffb04c88379d..acb17006fefb 100644 --- a/cpp/ql/lib/semmle/code/cpp/ir/implementation/aliased_ssa/internal/AliasedSSA.qll +++ b/cpp/ql/lib/semmle/code/cpp/ir/implementation/aliased_ssa/internal/AliasedSSA.qll @@ -899,6 +899,24 @@ class MemoryLocation extends FinalMemoryLocation { MemoryLocation() { not useOverlapWithBusyDef(this) } } +bindingset[fun] +pragma[inline_late] +private MemoryLocation getUnknownMemoryLocation(IRFunction fun, boolean isMayAccess) { + result = TUnknownMemoryLocation(fun, isMayAccess) +} + +bindingset[fun] +pragma[inline_late] +private MemoryLocation getAllAliasedMemory(IRFunction fun, boolean isMayAccess) { + result = TAllAliasedMemory(fun, isMayAccess) +} + +bindingset[fun] +pragma[inline_late] +private MemoryLocation getAllNonLocalMemory(IRFunction fun, boolean isMayAccess) { + result = TAllNonLocalMemory(fun, isMayAccess) +} + MemoryLocation getResultMemoryLocation(Instruction instr) { not canReuseSsaForOldResult(instr) and exists(MemoryAccessKind kind, boolean isMayAccess | @@ -926,7 +944,7 @@ MemoryLocation getResultMemoryLocation(Instruction instr) { // And otherwise we assign it a memory location that groups all the relevant memory locations into one. result = getGroupedMemoryLocation(var, unbindBool(isMayAccess), false) ) - else result = jazz(instr.getEnclosingIRFunction(), isMayAccess) + else result = getUnknownMemoryLocation(instr.getEnclosingIRFunction(), isMayAccess) ) or kind instanceof EntireAllocationMemoryAccess and @@ -935,32 +953,14 @@ MemoryLocation getResultMemoryLocation(Instruction instr) { unbindBool(isMayAccess)) or kind instanceof EscapedMemoryAccess and - result = bar(instr.getEnclosingIRFunction(), isMayAccess) + result = getAllAliasedMemory(instr.getEnclosingIRFunction(), isMayAccess) or kind instanceof NonLocalMemoryAccess and - result = foo(instr.getEnclosingIRFunction(), isMayAccess) + result = getAllNonLocalMemory(instr.getEnclosingIRFunction(), isMayAccess) ) ) } -bindingset[f] -pragma[inline_late] -private MemoryLocation foo(IRFunction f, boolean isMayAccess) { - result = TAllNonLocalMemory(f, isMayAccess) -} - -bindingset[f] -pragma[inline_late] -private MemoryLocation bar(IRFunction f, boolean isMayAccess) { - result = TAllAliasedMemory(f, isMayAccess) -} - -bindingset[f] -pragma[inline_late] -private MemoryLocation jazz(IRFunction f, boolean isMayAccess) { - result = TUnknownMemoryLocation(f, isMayAccess) -} - private MemoryLocation0 getOperandMemoryLocation0(MemoryOperand operand, boolean isMayAccess) { not canReuseSsaForOldResult(operand.getAnyDef()) and exists(MemoryAccessKind kind |