Tom Hvitved
078dc7b6c0
C#: Fix false positives in cs/dereferenced-value-may-be-null
2018-12-14 12:03:32 +00:00
Tom Hvitved
287ce4e683
C#: Add more nullness tests
2018-12-14 12:03:32 +00:00
Tom Hvitved
654f2ae290
C#: Address review comment
2018-12-14 10:38:34 +00:00
Aditya Sharad
7bc729a7dc
Merge master into next.
2018-12-14 10:16:47 +00:00
Tom Hvitved
56b80ae13a
C#: Add getALocation() for namespaces and namespace declarations
2018-12-14 10:16:20 +00:00
Tom Hvitved
b11d5c5075
Merge pull request #679 from calumgrant/cs/omitted-array-size
...
C#: Extract stackalloc initializers
2018-12-14 07:48:46 +01:00
Aditya Sharad
f71e5ac338
Merge master into next.
2018-12-13 17:57:31 +00:00
calum
9fba643fb0
C#: Address review comments.
2018-12-13 13:53:58 +00:00
calumgrant
16c065274d
Merge pull request #666 from hvitved/csharp/useless-upcast-performance
...
C#: Improve performance of `cs/useless-upcast`
2018-12-13 12:04:12 +00:00
Tom Hvitved
b155a0f5fb
C#: Avoid computing CIL strings and non-PDB locations in data flow library
...
Computing strings and locations for CIL instructions can be quite time consuming.
The CIL `toString()`s are not very helpful in path explanations, and their locations
are only useful when a PDB source file exists. Therefore, produce a simple constant
`toString()`, and restrict locations to those in PDB files.
2018-12-12 21:58:16 +01:00
Tom Hvitved
344466a8c1
C#: Cache DataFlow::Node::getEnclosingCallable()
2018-12-12 21:49:21 +01:00
Aditya Sharad
f92456fcad
Merge master into next.
...
Conflict in `cpp/ql/test/library-tests/sideEffects/functions/sideEffects.expected`,
resolved by accepting test output (combining changes).
2018-12-12 17:26:18 +00:00
Aditya Sharad
41a48078f7
Merge pull request #673 from calumgrant/cs/sync-files
...
C#: Sync samples and qltest cases
2018-12-12 17:10:00 +00:00
calumgrant
8e546a30b0
Merge pull request #637 from hvitved/csharp/cfg/throwing-callable
...
C#: Fix a bug in `ThrowingCallable`
2018-12-12 16:58:28 +00:00
calum
2bbd55519b
C#: Add tests for C# 7.3 features.
2018-12-12 16:44:55 +00:00
Tom Hvitved
74167e478a
C#: Cache NamedElement::getLabel()
2018-12-12 13:16:28 +01:00
Tom Hvitved
6918dad1db
C#: Refactor localFlowStep()
...
Using the `forceCachingInSameStage()` trick, we can get rid of the non-cached version
of local flow, while still computing it in the same stage.
2018-12-12 13:14:22 +01:00
Tom Hvitved
1366638f06
C#: Fix whitespaces
2018-12-12 13:13:13 +01:00
calum
3037b2b197
C#: Sync the -Good and -Bad files in the qltest to match the sample.
2018-12-12 11:36:00 +00:00
calum
1df1b0c28e
C#: Refactor ArrayCreations to allow stackalloc arrays to have initializers (C# 7.3).
2018-12-12 11:05:34 +00:00
Tom Hvitved
7422947e78
C#: Improve performance of cs/useless-upcast
2018-12-11 17:48:04 +01:00
Tom Hvitved
e80837681f
C#: Refactor LINQ logic
...
Factor `ClauseCall` out into three classes to make it clear when the fields
`operand` and `declaration` can be `null`.
2018-12-11 16:04:25 +01:00
Aditya Sharad
dde42a5723
Merge rc/1.19 into next.
2018-12-11 14:38:58 +00:00
calum
8d072863df
C#: Reorder for statements to ensure variables declared in the condition are declared before they are used.
2018-12-11 10:31:45 +00:00
Tom Hvitved
1e9fe0046a
C#: Address review comments
2018-12-10 15:31:23 +01:00
calumgrant
67d4099e3f
Merge pull request #593 from hvitved/csharp/nullness
...
C#: Rewrite nullness queries
2018-12-07 15:57:27 +00:00
Tom Hvitved
6411d1c7dd
C#: Refactor operator call logic
...
Refactored to make it clear when `@operator.Symbol as IMethodSymbol` can be `null`.
2018-12-07 15:47:20 +01:00
Tom Hvitved
e05bbb0f10
C#: Fix always-null bug in TRAP writer
2018-12-07 15:46:27 +01:00
Tom Hvitved
664453707a
C#: Speedup Assertions::strictlyDominates() and ControlFlowElement::controlsBlock()
...
Only calculate dominance by explicit recursion for split nodes; all other nodes
can use regular CFG dominance.
2018-12-07 12:03:12 +01:00
Tom Hvitved
c887dc89dc
C#: Fix a bug in ThrowingCallable
...
A method such as
```
void M()
{
throw new Exception();
}
```
was incorrectly not categorized as a `ThrowingCallable`, that is, a callable
that always throws an exception upon invocation.
2018-12-07 10:56:11 +01:00
Tom Hvitved
243af36167
C#: Add more CFG tests with throwing methods
2018-12-07 10:43:45 +01:00
Tom Hvitved
fce805834e
C#: Address review comments
2018-12-07 09:40:49 +01:00
calum
919d7cbf01
C#: Fix [INVALID_KEY] errors.
2018-12-05 13:55:55 +00:00
Tom Hvitved
ad77afef04
C#: Autobuilder fixes
...
This commit fixes a few issues that were identified during the last dist upgrade,
and which were introduced/revealed on 836daaf07b .
- Expand environment variables that are passed from `lgtm.yml` to the autobuilder,
for example `solution: $LGTM_SRC/mysolution.sln`.
- Distinguish between when a build rule is applied automatically and when it is applied
manually via `lgtm.yml`.
- Catch `FileNotFoundException`s when parsing project files and solution files.
2018-12-04 14:03:39 +01:00
Tom Hvitved
4739a6334e
C#: Fix a bug and generalize guards implication logic
2018-12-03 15:33:00 +01:00
calumgrant
43d14ce011
Merge pull request #586 from hvitved/csharp/cfg/field-split
...
C#: Handle multiple-field Boolean CFG splitting
2018-12-03 12:52:43 +00:00
Tom Hvitved
3b0d1599ad
C#: Teach guards library about unique assignments
...
For example, in
```
void M(object x)
{
var y = x == null ? 1 : 2;
if (y == 2)
x.ToString();
}
```
the guard `y == 2` implies that the guard `x == null` must be false,
as the assignment of `2` to `y` is unique.
2018-11-30 17:43:10 +01:00
Tom Hvitved
ab9aa7d338
C#: Teach guards library about conditional assignments
...
For example, in
```
void M(object x)
{
var y = x != null ? "" : null;
if (y != null)
x.ToString();
}
```
the guard `y != null` implies that the guard `x != null` must be true.
2018-11-30 17:41:36 +01:00
Tom Hvitved
80144a00c8
C#: Update nullness analyses
...
Port the SSA-based logic from the Java nullness analyses.
2018-11-30 17:41:31 +01:00
Tom Hvitved
d2a431e6f3
C#: Add more nullness tests
...
Port many of the nullness test from Java, as well as add new tests.
2018-11-30 17:02:05 +01:00
calumgrant
1c2dd3e7b9
Merge pull request #570 from hvitved/csharp/ssa/split-to-string
...
C#: Include CFG splits in `Ssa::Definition::toString()`
2018-11-30 15:04:36 +00:00
calumgrant
08f5c2b6a6
Merge pull request #567 from hvitved/csharp/guards-splitting
...
C#: Account for split SSA definitions in guards library
2018-11-30 14:57:57 +00:00
calumgrant
ca72c8ebfe
Merge pull request #579 from hvitved/csharp/guards-loop
...
C#: Fix bug in guards library when the guarded expression is in a loop
2018-11-30 10:27:21 +00:00
Tom Hvitved
05b9519e9a
C#: Handle multiple-field Boolean CFG splitting
...
The internal pre-SSA library was extended on 3e78c2671f
to include fields/properties that are local-scope-like. The CFG splitting logic
uses ranking of SSA definitions to define an (arbitrary) order of splits, but for
fields/properties the implicit entry definition all have the same line and column.
In effect, such SSA definitions incorrectly get the same rank. Adding the name
of the field/property to the lexicographic ordering resolves the issue.
2018-11-30 10:57:34 +01:00
Tom Hvitved
610be85c8c
C#: Add CFG test for multiple-field Boolean splitting
2018-11-30 10:32:08 +01:00
Jonas Jensen
9babb4366b
Merge remote-tracking branch 'upstream/master' into mergeback-20181130
2018-11-30 10:13:33 +01:00
Tom Hvitved
8bd8975795
Merge pull request #568 from calumgrant/cs/index-out-of-bounds
...
C#: Fix false-positives in cs/index-out-of-bounds
2018-11-29 18:40:05 +01:00
Tom Hvitved
a12a72e90f
C#: Fix bug in guards library when the guarded expression is in a loop
...
Follow-up on 03e69e9945 .
2018-11-29 15:53:03 +01:00
calum
6a1ab51d66
C#: Address review comments.
2018-11-29 11:39:10 +00:00
Tom Hvitved
ab7a094439
C#: Include CFG splits in Ssa::Definition::toString()
...
Just like syntax elements can be split in the control flow graph, so can SSA
definitions. To make this clear, and to make debugging easier, this commit
adds the splits as a prefix in the textual representation of SSA definitions.
2018-11-29 10:00:08 +01:00