Skip to content

Commit 6a381b9

Browse files
committed
Fix queries after merge from main
1 parent e560d06 commit 6a381b9

2 files changed

Lines changed: 4 additions & 34 deletions

File tree

cpp/common/src/codingstandards/cpp/Extensions.qll

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,18 +108,15 @@ class CPPTerseTernaryExtension extends CPPCompilerExtension, ConditionalExpr {
108108
}
109109

110110
/**
111-
* A non-standard `Type` that is only available as a compiler extension, such as `__int128`,
112-
* `_Decimal32`, `_Decimal64`, `_Decimal128`, or `__float128`.
111+
* A non-standard `Type` that is only available as a compiler extension, such as `__int128`
112+
* or `__float128`.
113113
*
114114
* Reference: https://gcc.gnu.org/onlinedocs/gcc/__int128.html
115115
* Reference: https://gcc.gnu.org/onlinedocs/gcc/Decimal-Float.html
116116
*/
117117
class CPPExtensionType extends Type {
118118
CPPExtensionType() {
119119
this instanceof Int128Type or
120-
this instanceof Decimal128Type or
121-
this instanceof Decimal32Type or
122-
this instanceof Decimal64Type or
123120
this instanceof Float128Type
124121
}
125122
}

cpp/misra/src/rules/RULE-8-7-1/PointerArithmeticFormsAnInvalidPointer.ql

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,10 @@ class ArrayAllocation extends TArrayAllocation {
159159
* array, and the minimum estimated value for a heap-allocated one.
160160
*/
161161
int getLength(DataFlow::Node node) {
162-
exists(IndirectUninitializedNode inode |
162+
exists(DataFlow::IndirectUninitializedNode inode |
163163
inode = node and
164164
inode.getLocalVariable() = this.asStackAllocation().getVariable() and
165-
result = this.asStackAllocation().getLength(inode.getIndirection())
165+
result = this.asStackAllocation().getLength(inode.getIndirectionIndex())
166166
)
167167
or
168168
node.asUninitialized() = this.asStackAllocation().getVariable() and
@@ -193,33 +193,6 @@ class ArrayAllocation extends TArrayAllocation {
193193
}
194194
}
195195

196-
/*
197-
* NOTE: `IndirectUninitializedNode` has made its way into `github/codeql`. Once we upgrade it to
198-
* the version that has it, the class can be safely removed.
199-
*/
200-
201-
import semmle.code.cpp.ir.dataflow.internal.SsaInternals as SsaImpl
202-
203-
class IndirectUninitializedNode extends Node {
204-
LocalVariable v;
205-
int indirection;
206-
207-
IndirectUninitializedNode() {
208-
exists(SsaImpl::Definition def, SsaImpl::SourceVariable sv |
209-
def.getIndirectionIndex() = indirection and
210-
indirection > 0 and
211-
def.getValue().asInstruction() instanceof UninitializedInstruction and
212-
SsaImpl::defToNode(this, def, sv) and
213-
v = sv.getBaseVariable().(SsaImpl::BaseIRVariable).getIRVariable().getAst()
214-
)
215-
}
216-
217-
/** Gets the uninitialized local variable corresponding to this node. */
218-
LocalVariable getLocalVariable() { result = v }
219-
220-
int getIndirection() { result = indirection }
221-
}
222-
223196
newtype TPointerFormation =
224197
TArrayExpr(ArrayExprBA arrayExpr) or
225198
TPointerArithmetic(PointerArithmeticOperation pointerArithmetic) or

0 commit comments

Comments
 (0)