mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Update ASTPrinting of lifetime dependence
This commit is contained in:
@@ -364,6 +364,22 @@ public:
|
||||
return printedClangDecl.insert(d).second;
|
||||
}
|
||||
|
||||
void printLifetimeDependence(
|
||||
std::optional<LifetimeDependenceInfo> lifetimeDependence) {
|
||||
if (!lifetimeDependence.has_value()) {
|
||||
return;
|
||||
}
|
||||
*this << lifetimeDependence->getString();
|
||||
}
|
||||
|
||||
void printLifetimeDependenceAt(
|
||||
ArrayRef<LifetimeDependenceInfo> lifetimeDependencies, unsigned index) {
|
||||
if (auto lifetimeDependence =
|
||||
getLifetimeDependenceFor(lifetimeDependencies, index)) {
|
||||
printLifetimeDependence(*lifetimeDependence);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
virtual void anchor();
|
||||
};
|
||||
|
||||
@@ -3792,6 +3792,10 @@ public:
|
||||
targetIndex);
|
||||
}
|
||||
|
||||
std::optional<LifetimeDependenceInfo> getLifetimeDependenceForResult() const {
|
||||
return getLifetimeDependenceFor(getNumParams());
|
||||
}
|
||||
|
||||
void Profile(llvm::FoldingSetNodeID &ID) {
|
||||
std::optional<ExtInfo> info = std::nullopt;
|
||||
if (hasExtInfo())
|
||||
@@ -4465,8 +4469,12 @@ public:
|
||||
|
||||
SWIFT_DEBUG_DUMP;
|
||||
void print(llvm::raw_ostream &out,
|
||||
const PrintOptions &options = PrintOptions()) const;
|
||||
void print(ASTPrinter &Printer, const PrintOptions &Options) const;
|
||||
const PrintOptions &options = PrintOptions(),
|
||||
std::optional<LifetimeDependenceInfo> lifetimeDependence =
|
||||
std::nullopt) const;
|
||||
void print(ASTPrinter &Printer, const PrintOptions &Options,
|
||||
std::optional<LifetimeDependenceInfo> lifetimeDependence =
|
||||
std::nullopt) const;
|
||||
friend llvm::raw_ostream &operator<<(llvm::raw_ostream &out,
|
||||
SILParameterInfo type) {
|
||||
type.print(out);
|
||||
@@ -5363,6 +5371,16 @@ public:
|
||||
NumLifetimeDependencies};
|
||||
}
|
||||
|
||||
std::optional<LifetimeDependenceInfo>
|
||||
getLifetimeDependenceFor(unsigned targetIndex) const {
|
||||
return swift::getLifetimeDependenceFor(getLifetimeDependencies(),
|
||||
targetIndex);
|
||||
}
|
||||
|
||||
std::optional<LifetimeDependenceInfo> getLifetimeDependenceForResult() const {
|
||||
return getLifetimeDependenceFor(getNumParameters());
|
||||
}
|
||||
|
||||
/// Returns true if the function type stores a Clang type that cannot
|
||||
/// be derived from its Swift type. Returns false otherwise, including if
|
||||
/// the function type is not @convention(c) or @convention(block).
|
||||
|
||||
Reference in New Issue
Block a user