Skip to content

Commit c925766

Browse files
committed
Swift: change the return types of getCanonicalPointer
1 parent 2f00945 commit c925766

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

swift/extractor/SwiftDispatcher.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ class SwiftDispatcher {
7474
if (auto l = store.get(e)) {
7575
return *l;
7676
}
77-
waitingForNewLabel = getCanonicalPtr(e);
77+
waitingForNewLabel = getCanonicalPointer(e);
7878
visit(e);
7979
if (auto l = store.get(e)) {
8080
if constexpr (!std::is_base_of_v<swift::TypeBase, E>) {
@@ -91,7 +91,7 @@ class SwiftDispatcher {
9191
// declarations
9292
template <typename E>
9393
TrapLabel<ToTag<E>> assignNewLabel(E* e) {
94-
assert(waitingForNewLabel == getCanonicalPtr(e) && "assignNewLabel called on wrong entity");
94+
assert(waitingForNewLabel == getCanonicalPointer(e) && "assignNewLabel called on wrong entity");
9595
auto label = getLabel<ToTag<E>>();
9696
trap.assignStar(label);
9797
store.insert(e, label);

swift/extractor/trap/TrapLabelStore.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,22 @@ namespace codeql {
1414

1515
// the following is needed to avoid the problem of subclass pointers not necessarily coinciding
1616
// with superclass ones in case of multiple inheritance
17-
inline const swift::Decl* getCanonicalPtr(const swift::Decl* e) {
17+
inline const swift::Decl* getCanonicalPointer(const swift::Decl* e) {
1818
return e;
1919
}
20-
inline const swift::Stmt* getCanonicalPtr(const swift::Stmt* e) {
20+
inline const swift::Stmt* getCanonicalPointer(const swift::Stmt* e) {
2121
return e;
2222
}
23-
inline const swift::Expr* getCanonicalPtr(const swift::Expr* e) {
23+
inline const swift::Expr* getCanonicalPointer(const swift::Expr* e) {
2424
return e;
2525
}
26-
inline const swift::Pattern* getCanonicalPtr(const swift::Pattern* e) {
26+
inline const swift::Pattern* getCanonicalPointer(const swift::Pattern* e) {
2727
return e;
2828
}
29-
inline const swift::TypeRepr* getCanonicalPtr(const swift::TypeRepr* e) {
29+
inline const swift::TypeRepr* getCanonicalPointer(const swift::TypeRepr* e) {
3030
return e;
3131
}
32-
inline const swift::TypeBase* getCanonicalPtr(const swift::TypeBase* e) {
32+
inline const swift::TypeBase* getCanonicalPointer(const swift::TypeBase* e) {
3333
return e;
3434
}
3535

@@ -40,15 +40,15 @@ class TrapLabelStore {
4040
public:
4141
template <typename T>
4242
std::optional<TrapLabel<ToTag<T>>> get(const T* e) {
43-
if (auto found = store_.find(getCanonicalPtr(e)); found != store_.end()) {
43+
if (auto found = store_.find(getCanonicalPointer(e)); found != store_.end()) {
4444
return TrapLabel<ToTag<T>>::unsafeCreateFromUntyped(found->second);
4545
}
4646
return std::nullopt;
4747
}
4848

4949
template <typename T>
5050
void insert(const T* e, TrapLabel<ToTag<T>> l) {
51-
auto [_, inserted] = store_.emplace(getCanonicalPtr(e), l);
51+
auto [_, inserted] = store_.emplace(getCanonicalPointer(e), l);
5252
assert(inserted && "already inserted");
5353
}
5454

0 commit comments

Comments
 (0)