mirror of
https://github.com/github/codeql.git
synced 2026-04-30 11:15:13 +02:00
Swift: change the return types of getCanonicalPointer
This commit is contained in:
@@ -74,7 +74,7 @@ class SwiftDispatcher {
|
||||
if (auto l = store.get(e)) {
|
||||
return *l;
|
||||
}
|
||||
waitingForNewLabel = getCanonicalPtr(e);
|
||||
waitingForNewLabel = getCanonicalPointer(e);
|
||||
visit(e);
|
||||
if (auto l = store.get(e)) {
|
||||
if constexpr (!std::is_base_of_v<swift::TypeBase, E>) {
|
||||
@@ -91,7 +91,7 @@ class SwiftDispatcher {
|
||||
// declarations
|
||||
template <typename E>
|
||||
TrapLabel<ToTag<E>> assignNewLabel(E* e) {
|
||||
assert(waitingForNewLabel == getCanonicalPtr(e) && "assignNewLabel called on wrong entity");
|
||||
assert(waitingForNewLabel == getCanonicalPointer(e) && "assignNewLabel called on wrong entity");
|
||||
auto label = getLabel<ToTag<E>>();
|
||||
trap.assignStar(label);
|
||||
store.insert(e, label);
|
||||
|
||||
@@ -14,22 +14,22 @@ namespace codeql {
|
||||
|
||||
// the following is needed to avoid the problem of subclass pointers not necessarily coinciding
|
||||
// with superclass ones in case of multiple inheritance
|
||||
inline const swift::Decl* getCanonicalPtr(const swift::Decl* e) {
|
||||
inline const swift::Decl* getCanonicalPointer(const swift::Decl* e) {
|
||||
return e;
|
||||
}
|
||||
inline const swift::Stmt* getCanonicalPtr(const swift::Stmt* e) {
|
||||
inline const swift::Stmt* getCanonicalPointer(const swift::Stmt* e) {
|
||||
return e;
|
||||
}
|
||||
inline const swift::Expr* getCanonicalPtr(const swift::Expr* e) {
|
||||
inline const swift::Expr* getCanonicalPointer(const swift::Expr* e) {
|
||||
return e;
|
||||
}
|
||||
inline const swift::Pattern* getCanonicalPtr(const swift::Pattern* e) {
|
||||
inline const swift::Pattern* getCanonicalPointer(const swift::Pattern* e) {
|
||||
return e;
|
||||
}
|
||||
inline const swift::TypeRepr* getCanonicalPtr(const swift::TypeRepr* e) {
|
||||
inline const swift::TypeRepr* getCanonicalPointer(const swift::TypeRepr* e) {
|
||||
return e;
|
||||
}
|
||||
inline const swift::TypeBase* getCanonicalPtr(const swift::TypeBase* e) {
|
||||
inline const swift::TypeBase* getCanonicalPointer(const swift::TypeBase* e) {
|
||||
return e;
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ class TrapLabelStore {
|
||||
public:
|
||||
template <typename T>
|
||||
std::optional<TrapLabel<ToTag<T>>> get(const T* e) {
|
||||
if (auto found = store_.find(getCanonicalPtr(e)); found != store_.end()) {
|
||||
if (auto found = store_.find(getCanonicalPointer(e)); found != store_.end()) {
|
||||
return TrapLabel<ToTag<T>>::unsafeCreateFromUntyped(found->second);
|
||||
}
|
||||
return std::nullopt;
|
||||
@@ -48,7 +48,7 @@ class TrapLabelStore {
|
||||
|
||||
template <typename T>
|
||||
void insert(const T* e, TrapLabel<ToTag<T>> l) {
|
||||
auto [_, inserted] = store_.emplace(getCanonicalPtr(e), l);
|
||||
auto [_, inserted] = store_.emplace(getCanonicalPointer(e), l);
|
||||
assert(inserted && "already inserted");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user