Skip to content

C: deprecate/delete some unused code #10573

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cpp/ql/lib/semmle/code/cpp/commons/Strcat.qll
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import cpp
* A function that concatenates the string from its second argument
* to the string from its first argument, for example `strcat`.
*/
class StrcatFunction extends Function {
deprecated class StrcatFunction extends Function {
StrcatFunction() {
getName() =
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,9 +267,6 @@ Instruction getSourceAddressFromNode(Node node) {
result = getSourceAddress(node.asOperand().(SideEffectOperand).getUse())
}

/** Gets the source value of `instr` if it's an instruction that behaves like a `LoadInstruction`. */
Instruction getSourceValue(Instruction instr) { result = getSourceValueOperand(instr).getDef() }

/**
* Gets the operand that represents the source value of `instr` if it's an instruction
* that behaves like a `LoadInstruction`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,16 +143,6 @@ private module Cached {
)
}

cached
Instruction getRegisterOperandDefinition(Instruction instruction, RegisterOperandTag tag) {
exists(OldInstruction oldInstruction, OldIR::RegisterOperand oldOperand |
oldInstruction = getOldInstruction(instruction) and
oldOperand = oldInstruction.getAnOperand() and
tag = oldOperand.getOperandTag() and
result = getNewInstruction(oldOperand.getAnyDef())
)
}

pragma[noopt]
private predicate hasMemoryOperandDefinition(
OldInstruction oldInstruction, OldIR::NonPhiMemoryOperand oldOperand, Overlap overlap,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,12 +256,6 @@ CppType getInstructionOperandType(Instruction instruction, TypedOperandTag tag)
.getInstructionMemoryOperandType(getInstructionTag(instruction), tag)
}

Instruction getPhiOperandDefinition(
PhiInstruction instruction, IRBlock predecessorBlock, Overlap overlap
) {
none()
}

Instruction getPhiInstructionBlockStart(PhiInstruction instr) { none() }

Instruction getInstructionSuccessor(Instruction instruction, EdgeKind kind) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,16 +143,6 @@ private module Cached {
)
}

cached
Instruction getRegisterOperandDefinition(Instruction instruction, RegisterOperandTag tag) {
exists(OldInstruction oldInstruction, OldIR::RegisterOperand oldOperand |
oldInstruction = getOldInstruction(instruction) and
oldOperand = oldInstruction.getAnOperand() and
tag = oldOperand.getOperandTag() and
result = getNewInstruction(oldOperand.getAnyDef())
)
}

pragma[noopt]
private predicate hasMemoryOperandDefinition(
OldInstruction oldInstruction, OldIR::NonPhiMemoryOperand oldOperand, Overlap overlap,
Expand Down
12 changes: 0 additions & 12 deletions cpp/ql/src/Best Practices/Magic Constants/MagicConstants.qll
Original file line number Diff line number Diff line change
Expand Up @@ -72,18 +72,6 @@ predicate floatTrivial(Literal lit) {

predicate charLiteral(Literal lit) { lit instanceof CharLiteral }

Type literalType(Literal literal) { result = literal.getType() }

predicate stringType(DerivedType t) {
t.getBaseType() instanceof CharType
or
exists(SpecifiedType constCharType |
t.getBaseType() = constCharType and
constCharType.isConst() and
constCharType.getBaseType() instanceof CharType
)
}

predicate numberType(Type t) { t instanceof FloatingPointType or t instanceof IntegralType }

predicate stringLiteral(Literal literal) { literal instanceof StringLiteral }
Expand Down
6 changes: 0 additions & 6 deletions cpp/ql/src/Security/CWE/CWE-457/UninitializedVariables.qll
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,6 @@ private predicate reaches(ControlFlowNode a, ControlFlowNode b) = fastTC(success

private predicate successor(ControlFlowNode a, ControlFlowNode b) { b = a.getASuccessor() }

class WhitelistedCallsConfig extends string {
WhitelistedCallsConfig() { this = "config" }

abstract predicate isWhitelisted(Call c);
}

abstract class WhitelistedCall extends Call {
override Function getTarget() { none() }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,16 +143,6 @@ private module Cached {
)
}

cached
Instruction getRegisterOperandDefinition(Instruction instruction, RegisterOperandTag tag) {
exists(OldInstruction oldInstruction, OldIR::RegisterOperand oldOperand |
oldInstruction = getOldInstruction(instruction) and
oldOperand = oldInstruction.getAnOperand() and
tag = oldOperand.getOperandTag() and
result = getNewInstruction(oldOperand.getAnyDef())
)
}

pragma[noopt]
private predicate hasMemoryOperandDefinition(
OldInstruction oldInstruction, OldIR::NonPhiMemoryOperand oldOperand, Overlap overlap,
Expand Down