Skip to content

Commit 2241350

Browse files
committed
wait with deprecating Container::getURL()
1 parent a4ef861 commit 2241350

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
@@ -175,6 +183,12 @@ class Folder extends Container, @folder {
175183
}
176184

177185
override string getAPrimaryQlClass() { result = "Folder" }
186+
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" }
178192
}
179193

180194
/**
@@ -199,6 +213,12 @@ class File extends Container, @file {
199213
result.hasLocationInfo(_, 0, 0, 0, 0)
200214
}
201215

216+
/**
217+
* DEPRECATED: Use `getLocation` instead.
218+
* Gets the URL of this file.
219+
*/
220+
deprecated override string getURL() { result = "file://" + this.getAbsolutePath() + ":0:0:0:0" }
221+
202222
/** Holds if this file was compiled as C (at any point). */
203223
predicate compiledAsC() { fileannotations(underlyingElement(this), 1, "compiled as c", "1") }
204224

0 commit comments

Comments
 (0)