mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
* spelling: accessible Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: accessories Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: allocated Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: amortizes Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: are Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: arguments Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: cacheable Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: check Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: clazz Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: compatible Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: compilation Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: completely Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: construct Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: conversion Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: declarations Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: derivation Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: deserialization Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: destroyed Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: determined Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: different Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: doesn't Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: equality Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: equivalent Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: formation Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: forwards Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: global Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: guaranteed Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: have Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: identify Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: inaccessible Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: indeterminate Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: indices Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: inefficient Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: inheritance Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: instantaneous Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: instruction Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: intentionally Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: interior Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: intrinsic Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: introducing Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: irrelevant Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: message Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: multi Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: necessarily Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: object Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: one Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: optimization Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: otherwise Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: overridden Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: parameter Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: pattern Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: pipeline Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: possibility Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: postdominance Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: providing Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: reached Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: recognized Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: refrigerator Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: remaining Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: resilient Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: retrieve Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: scavenge Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: scheduled Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: separately Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: serializable Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: signature Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: simplicity Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: specifically Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: substituted Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: substitution Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: subtypes Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: supplement Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: syntax Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: the Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: there Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: these Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: this Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: though Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: through Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: transitively Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: transpose Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: trivial Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: value Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: verification Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: visibility Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: weird Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> * spelling: whole Signed-off-by: Josh Soref <jsoref@users.noreply.github.com> Co-authored-by: Josh Soref <jsoref@users.noreply.github.com>
74 lines
2.7 KiB
C++
74 lines
2.7 KiB
C++
//===-------- SILDebugInfoExpression.cpp - DIExpression for SIL -----------===//
|
|
//
|
|
// This source file is part of the Swift.org open source project
|
|
//
|
|
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
|
|
// Licensed under Apache License v2.0 with Runtime Library Exception
|
|
//
|
|
// See https://swift.org/LICENSE.txt for license information
|
|
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
///
|
|
/// \file
|
|
/// This file contains the table used by SILDIExprInfo to map from
|
|
/// SILDIExprOperator to supplement information like the operator string.
|
|
///
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "swift/SIL/SILDebugInfoExpression.h"
|
|
#include <unordered_map>
|
|
|
|
using namespace swift;
|
|
|
|
namespace std {
|
|
// This is, unfortunately, a workaround for an ancient bug in libstdc++:
|
|
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60970
|
|
// Which prevented std::hash<T> users from having drop-in support for
|
|
// enum class types.
|
|
template <> struct hash<SILDIExprOperator> {
|
|
size_t operator()(SILDIExprOperator V) const noexcept {
|
|
return std::hash<unsigned>{}(static_cast<unsigned>(V));
|
|
}
|
|
};
|
|
} // end namespace std
|
|
|
|
const SILDIExprInfo *SILDIExprInfo::get(SILDIExprOperator Op) {
|
|
static const std::unordered_map<SILDIExprOperator, SILDIExprInfo> Infos = {
|
|
{SILDIExprOperator::Fragment,
|
|
{"op_fragment", {SILDIExprElement::DeclKind}}},
|
|
{SILDIExprOperator::Dereference, {"op_deref", {}}},
|
|
{SILDIExprOperator::Plus, {"op_plus", {}}},
|
|
{SILDIExprOperator::Minus, {"op_minus", {}}},
|
|
{SILDIExprOperator::ConstUInt,
|
|
{"op_constu", {SILDIExprElement::ConstIntKind}}},
|
|
{SILDIExprOperator::ConstSInt,
|
|
{"op_consts", {SILDIExprElement::ConstIntKind}}}};
|
|
|
|
return Infos.count(Op) ? &Infos.at(Op) : nullptr;
|
|
}
|
|
|
|
void SILDebugInfoExpression::op_iterator::increment() {
|
|
if (Remain.empty()) {
|
|
// Effectively making this an end iterator
|
|
Current = {};
|
|
return;
|
|
}
|
|
|
|
const SILDIExprElement &NextHead = Remain[0];
|
|
SILDIExprOperator Op = NextHead.getAsOperator();
|
|
if (const auto *ExprInfo = SILDIExprInfo::get(Op)) {
|
|
auto NewSlice = Remain.take_front(ExprInfo->OperandKinds.size() + 1);
|
|
Current = SILDIExprOperand(NewSlice.data(), NewSlice.size());
|
|
if (Remain.size() >= Current.size())
|
|
Remain = Remain.drop_front(Current.size());
|
|
}
|
|
}
|
|
|
|
SILDebugInfoExpression SILDebugInfoExpression::createFragment(VarDecl *Field) {
|
|
assert(Field);
|
|
return SILDebugInfoExpression(
|
|
{SILDIExprElement::createOperator(SILDIExprOperator::Fragment),
|
|
SILDIExprElement::createDecl(Field)});
|
|
}
|