Skip to content

Commit

Permalink
Merge pull request #14337 from aschackmull/cpp/container-not-locatable
Browse files Browse the repository at this point in the history
C++: Remove getLocation from Container.
  • Loading branch information
jketema authored Oct 25, 2023
2 parents 53d92d5 + 75a1173 commit 990d716
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
category: breaking
---
* The `Container` and `Folder` classes now derive from `ElementBase` instead of `Locatable`, and no longer expose the `getLocation` predicate. Use `getURL` instead.
9 changes: 2 additions & 7 deletions cpp/ql/lib/semmle/code/cpp/File.qll
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ private module Input implements InputSig {
private module Impl = Make<Input>;

/** A file or folder. */
class Container extends Locatable, Impl::Container {
class Container extends ElementBase, Impl::Container {
override string toString() { result = Impl::Container.super.toString() }
}

Expand All @@ -47,11 +47,6 @@ class Container extends Locatable, Impl::Container {
* To get the full path, use `getAbsolutePath`.
*/
class Folder extends Container, Impl::Folder {
override Location getLocation() {
result.getContainer() = this and
result.hasLocationInfo(_, 0, 0, 0, 0)
}

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

Expand All @@ -67,7 +62,7 @@ class Folder extends Container, Impl::Folder {
* The base name further decomposes into the _stem_ and _extension_ -- see
* `getStem` and `getExtension`. To get the full path, use `getAbsolutePath`.
*/
class File extends Container, Impl::File {
class File extends Container, Locatable, Impl::File {
override string getAPrimaryQlClass() { result = "File" }

override Location getLocation() {
Expand Down

0 comments on commit 990d716

Please sign in to comment.