Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8c0b6f2

Browse files
committed
Merge remote-tracking branch 'upstream/master' into moarExceptions
2 parents 904976c + 648c199 commit 8c0b6f2

39 files changed

Lines changed: 278 additions & 153 deletions

File tree

.github/labeler.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
"C++":
2+
- cpp/**/*
3+
- change-notes/**/*cpp*
4+
5+
"C#":
6+
- csharp/**/*
7+
- change-notes/**/*csharp*
8+
9+
Java:
10+
- java/**/*
11+
- change-notes/**/*java.*
12+
13+
JS:
14+
- javascript/**/*
15+
- change-notes/**/*javascript*
16+
17+
Python:
18+
- python/**/*
19+
- change-notes/**/*python*
20+
21+
documentation:
22+
- "**/*.qhelp"
23+
- "**/*.md"
24+
- docs/**/*

.github/workflows/labeler.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
name: "Pull Request Labeler"
2+
on:
3+
- pull_request
4+
5+
jobs:
6+
triage:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/labeler@v2
10+
with:
11+
repo-token: "${{ secrets.GITHUB_TOKEN }}"

change-notes/1.24/analysis-cpp.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ The following changes in version 1.24 affect C/C++ analysis in all applications.
1313

1414
| **Query** | **Expected impact** | **Change** |
1515
|----------------------------|------------------------|------------------------------------------------------------------|
16+
| Hard-coded Japanese era start date (`cpp/japanese-era/exact-era-date`) | | This query is no longer run on LGTM. |
1617
| No space for zero terminator (`cpp/no-space-for-terminator`) | Fewer false positive results | This query has been modified to be more conservative when identifying which pointers point to null-terminated strings. This approach produces fewer, more accurate results. |
1718

1819
## Changes to libraries

cpp/config/suites/c/correctness

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
+ semmlecode-cpp-queries/Likely Bugs/Arithmetic/FloatComparison.ql: /Correctness/Common Errors
2424
+ semmlecode-cpp-queries/Likely Bugs/Arithmetic/BitwiseSignCheck.ql: /Correctness/Common Errors
2525
+ semmlecode-cpp-queries/Likely Bugs/Arithmetic/BadAdditionOverflowCheck.ql: /Correctness/Common Errors
26+
+ semmlecode-cpp-queries/Likely Bugs/Arithmetic/SignedOverflowCheck.ql: /Correctness/Common Errors
27+
+ semmlecode-cpp-queries/Likely Bugs/Memory Management/PointerOverflow.ql: /Correctness/Common Errors
2628
+ semmlecode-cpp-queries/Likely Bugs/NestedLoopSameVar.ql: /Correctness/Common Errors
2729
+ semmlecode-cpp-queries/Likely Bugs/UseInOwnInitializer.ql: /Correctness/Common Errors
2830
+ semmlecode-cpp-queries/Critical/NewArrayDeleteMismatch.ql: /Correctness/Common Errors

cpp/config/suites/cpp/correctness

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
+ semmlecode-cpp-queries/Likely Bugs/Arithmetic/FloatComparison.ql: /Correctness/Common Errors
2525
+ semmlecode-cpp-queries/Likely Bugs/Arithmetic/BitwiseSignCheck.ql: /Correctness/Common Errors
2626
+ semmlecode-cpp-queries/Likely Bugs/Arithmetic/BadAdditionOverflowCheck.ql: /Correctness/Common Errors
27+
+ semmlecode-cpp-queries/Likely Bugs/Arithmetic/SignedOverflowCheck.ql: /Correctness/Common Errors
28+
+ semmlecode-cpp-queries/Likely Bugs/Memory Management/PointerOverflow.ql: /Correctness/Common Errors
2729
+ semmlecode-cpp-queries/Likely Bugs/NestedLoopSameVar.ql: /Correctness/Common Errors
2830
+ semmlecode-cpp-queries/Likely Bugs/UseInOwnInitializer.ql: /Correctness/Common Errors
2931
+ semmlecode-cpp-queries/Critical/NewArrayDeleteMismatch.ql: /Correctness/Common Errors

cpp/ql/src/Architecture/FeatureEnvy.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* @description A function that uses more functions and variables from another file than functions and variables from its own file. This function might be better placed in the other file, to avoid exposing internals of the file it depends on.
44
* @kind problem
55
* @problem.severity recommendation
6-
* @precision high
6+
* @precision medium
77
* @id cpp/feature-envy
88
* @tags maintainability
99
* modularity

cpp/ql/src/Architecture/InappropriateIntimacy.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* @description Two files share too much information about each other (accessing many operations or variables in both directions). It would be better to invert some of the dependencies to reduce the coupling between the two files.
44
* @kind problem
55
* @problem.severity recommendation
6-
* @precision high
6+
* @precision medium
77
* @id cpp/file-intimacy
88
* @tags maintainability
99
* modularity

cpp/ql/src/Architecture/Refactoring Opportunities/ClassesWithManyFields.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* @description Finds classes with many fields; they could probably be refactored by breaking them down into smaller classes, and using composition.
44
* @kind problem
55
* @problem.severity recommendation
6-
* @precision high
6+
* @precision medium
77
* @id cpp/class-many-fields
88
* @tags maintainability
99
* statistical

cpp/ql/src/Best Practices/Magic Constants/JapaneseEraDate.ql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* @kind problem
55
* @problem.severity warning
66
* @id cpp/japanese-era/exact-era-date
7-
* @precision medium
7+
* @precision low
88
* @tags reliability
99
* japanese-era
1010
*/

cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/Operand.qll

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -11,42 +11,20 @@ cached
1111
private newtype TOperand =
1212
TRegisterOperand(Instruction useInstr, RegisterOperandTag tag, Instruction defInstr) {
1313
defInstr = Construction::getRegisterOperandDefinition(useInstr, tag) and
14-
not isInCycle(useInstr)
14+
not Construction::isInCycle(useInstr)
1515
} or
1616
TNonPhiMemoryOperand(
1717
Instruction useInstr, MemoryOperandTag tag, Instruction defInstr, Overlap overlap
1818
) {
1919
defInstr = Construction::getMemoryOperandDefinition(useInstr, tag, overlap) and
20-
not isInCycle(useInstr)
20+
not Construction::isInCycle(useInstr)
2121
} or
2222
TPhiOperand(
2323
PhiInstruction useInstr, Instruction defInstr, IRBlock predecessorBlock, Overlap overlap
2424
) {
2525
defInstr = Construction::getPhiOperandDefinition(useInstr, predecessorBlock, overlap)
2626
}
2727

28-
/** Gets a non-phi instruction that defines an operand of `instr`. */
29-
private Instruction getNonPhiOperandDef(Instruction instr) {
30-
result = Construction::getRegisterOperandDefinition(instr, _)
31-
or
32-
result = Construction::getMemoryOperandDefinition(instr, _, _)
33-
}
34-
35-
/**
36-
* Holds if `instr` is part of a cycle in the operand graph that doesn't go
37-
* through a phi instruction and therefore should be impossible.
38-
*
39-
* If such cycles are present, either due to a programming error in the IR
40-
* generation or due to a malformed database, it can cause infinite loops in
41-
* analyses that assume a cycle-free graph of non-phi operands. Therefore it's
42-
* better to remove these operands than to leave cycles in the operand graph.
43-
*/
44-
pragma[noopt]
45-
private predicate isInCycle(Instruction instr) {
46-
instr instanceof Instruction and
47-
getNonPhiOperandDef+(instr) = instr
48-
}
49-
5028
/**
5129
* A source operand of an `Instruction`. The operand represents a value consumed by the instruction.
5230
*/

0 commit comments

Comments
 (0)