Skip to content

Commit ab7850c

Browse files
committed
Revert "Merge pull request #7982 from jketema/remove-legacy-relations"
This reverts commit 2b6d57d, reversing changes made to 9b4dbb9.
1 parent 2b6d57d commit ab7850c

File tree

12 files changed

+2774
-8488
lines changed

12 files changed

+2774
-8488
lines changed

cpp/downgrades/7455933b9d8832b7c385cfca8cf43bddc25b6d0f/old.dbscheme

Lines changed: 0 additions & 2082 deletions
This file was deleted.

cpp/downgrades/7455933b9d8832b7c385cfca8cf43bddc25b6d0f/semmlecode.cpp.dbscheme

Lines changed: 0 additions & 2136 deletions
This file was deleted.

cpp/downgrades/7455933b9d8832b7c385cfca8cf43bddc25b6d0f/upgrade.properties

Lines changed: 0 additions & 2 deletions
This file was deleted.

cpp/ql/lib/change-notes/2022-02-11-external-artifact.md

Lines changed: 0 additions & 4 deletions
This file was deleted.

cpp/ql/lib/external/ExternalArtifact.qll

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,12 @@
44

55
import cpp
66

7-
private newtype TExternalDataElement = MKExternalDataElement()
8-
97
/**
10-
* DEPRECATED: This class is no longer used.
11-
*
128
* An external data item.
139
*/
14-
class ExternalData extends TExternalDataElement {
10+
class ExternalData extends @externalDataElement {
1511
/** Gets the path of the file this data was loaded from. */
16-
string getDataPath() { none() }
12+
string getDataPath() { externalData(this, result, _, _) }
1713

1814
/**
1915
* Gets the path of the file this data was loaded from, with its
@@ -22,10 +18,10 @@ class ExternalData extends TExternalDataElement {
2218
string getQueryPath() { result = this.getDataPath().regexpReplaceAll("\\.[^.]*$", ".ql") }
2319

2420
/** Gets the number of fields in this data item. */
25-
int getNumFields() { none() }
21+
int getNumFields() { result = 1 + max(int i | externalData(this, _, i, _) | i) }
2622

2723
/** Gets the value of the `i`th field of this data item. */
28-
string getField(int i) { none() }
24+
string getField(int i) { externalData(this, _, i, result) }
2925

3026
/** Gets the integer value of the `i`th field of this data item. */
3127
int getFieldAsInt(int i) { result = this.getField(i).toInt() }

cpp/ql/lib/semmlecode.cpp.dbscheme

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,65 @@ compilation_finished(
122122
float elapsed_seconds : float ref
123123
);
124124

125+
126+
/**
127+
* External data, loaded from CSV files during snapshot creation. See
128+
* [Tutorial: Incorporating external data](https://help.semmle.com/wiki/display/SD/Tutorial%3A+Incorporating+external+data)
129+
* for more information.
130+
*/
131+
externalData(
132+
int id : @externalDataElement,
133+
string path : string ref,
134+
int column: int ref,
135+
string value : string ref
136+
);
137+
138+
/**
139+
* The date of the snapshot.
140+
*/
141+
snapshotDate(unique date snapshotDate : date ref);
142+
125143
/**
126144
* The source location of the snapshot.
127145
*/
128146
sourceLocationPrefix(string prefix : string ref);
129147

148+
/**
149+
* Data used by the 'duplicate code' detection.
150+
*/
151+
duplicateCode(
152+
unique int id : @duplication,
153+
string relativePath : string ref,
154+
int equivClass : int ref
155+
);
156+
157+
/**
158+
* Data used by the 'similar code' detection.
159+
*/
160+
similarCode(
161+
unique int id : @similarity,
162+
string relativePath : string ref,
163+
int equivClass : int ref
164+
);
165+
166+
/**
167+
* Data used by the 'duplicate code' and 'similar code' detection.
168+
*/
169+
@duplication_or_similarity = @duplication | @similarity
170+
171+
/**
172+
* Data used by the 'duplicate code' and 'similar code' detection.
173+
*/
174+
#keyset[id, offset]
175+
tokens(
176+
int id : @duplication_or_similarity ref,
177+
int offset : int ref,
178+
int beginLine : int ref,
179+
int beginColumn : int ref,
180+
int endLine : int ref,
181+
int endColumn : int ref
182+
);
183+
130184
/**
131185
* Information about packages that provide code used during compilation.
132186
* The `id` is just a unique identifier.

0 commit comments

Comments
 (0)