Skip to content

Commit e140548

Browse files
committed
C++: reintroduce deprecated predicates that affect an internal test
1 parent 309e376 commit e140548

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

cpp/ql/lib/semmle/code/cpp/File.qll

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,14 @@ class Container extends Locatable, @container {
3434
*/
3535
string getAbsolutePath() { none() } // overridden by subclasses
3636

37+
/**
38+
* DEPRECATED: Use `getLocation` instead.
39+
* Gets a URL representing the location of this container.
40+
*
41+
* For more information see [Providing URLs](https://codeql.github.com/docs/writing-codeql-queries/providing-locations-in-codeql-queries/#providing-urls).
42+
*/
43+
deprecated string getURL() { none() } // overridden by subclasses
44+
3745
/**
3846
* Gets the relative path of this file or folder from the root folder of the
3947
* analyzed source location. The relative path of the root folder itself is
@@ -176,6 +184,12 @@ class Folder extends Container, @folder {
176184

177185
override string getAPrimaryQlClass() { result = "Folder" }
178186

187+
/**
188+
* DEPRECATED: Use `getLocation` instead.
189+
* Gets the URL of this folder.
190+
*/
191+
deprecated override string getURL() { result = "file://" + this.getAbsolutePath() + ":0:0:0:0" }
192+
179193
/**
180194
* DEPRECATED: use `getAbsolutePath` instead.
181195
* Gets the name of this folder.
@@ -213,6 +227,12 @@ class File extends Container, @file {
213227
result.hasLocationInfo(_, 0, 0, 0, 0)
214228
}
215229

230+
/**
231+
* DEPRECATED: Use `getLocation` instead.
232+
* Gets the URL of this file.
233+
*/
234+
deprecated override string getURL() { result = "file://" + this.getAbsolutePath() + ":0:0:0:0" }
235+
216236
/** Holds if this file was compiled as C (at any point). */
217237
predicate compiledAsC() { fileannotations(underlyingElement(this), 1, "compiled as c", "1") }
218238

0 commit comments

Comments
 (0)