mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[rbi] Use interned StringRefs for diagnostics instead of SmallString<64>.
This makes the code easier to write and also prevents any lifetime issues from a diagnostic outliving the SmallString due to diagnostic transactions.
This commit is contained in:
@@ -332,8 +332,16 @@ public:
|
||||
/// form of diagnostic than other cases.
|
||||
void printForCodeDiagnostic(SILFunction *fn, llvm::raw_ostream &os) const;
|
||||
|
||||
/// Overload of printForCodeDiagnostics that returns an interned StringRef
|
||||
/// owned by the AST.
|
||||
StringRef printForCodeDiagnostic(SILFunction *fn) const;
|
||||
|
||||
void printForDiagnostics(SILFunction *fn, llvm::raw_ostream &os) const;
|
||||
|
||||
/// Overload of printForDiagnostics that returns an interned StringRef owned
|
||||
/// by the AST.
|
||||
StringRef printForDiagnostics(SILFunction *fn) const;
|
||||
|
||||
SWIFT_DEBUG_DUMPER(dumpForDiagnostics(SILFunction *fn)) {
|
||||
printForDiagnostics(fn, llvm::dbgs());
|
||||
llvm::dbgs() << '\n';
|
||||
@@ -524,6 +532,12 @@ public:
|
||||
SILFunction *fn, ActorIsolation iso, llvm::raw_ostream &os,
|
||||
StringRef openingQuotationMark = "'", bool asNoun = false);
|
||||
|
||||
/// Overload for printActorIsolationForDiagnostics that produces a StringRef.
|
||||
static StringRef
|
||||
printActorIsolationForDiagnostics(SILFunction *fn, ActorIsolation iso,
|
||||
StringRef openingQuotationMark = "'",
|
||||
bool asNoun = false);
|
||||
|
||||
void Profile(llvm::FoldingSetNodeID &id) const;
|
||||
|
||||
private:
|
||||
@@ -593,6 +607,10 @@ public:
|
||||
innerInfo.printForDiagnostics(fn, os);
|
||||
}
|
||||
|
||||
StringRef printForDiagnostics(SILFunction *fn) const {
|
||||
return innerInfo.printForDiagnostics(fn);
|
||||
}
|
||||
|
||||
SWIFT_DEBUG_DUMPER(dumpForDiagnostics(SILFunction *fn)) {
|
||||
innerInfo.dumpForDiagnostics(fn);
|
||||
}
|
||||
@@ -601,6 +619,10 @@ public:
|
||||
innerInfo.printForCodeDiagnostic(fn, os);
|
||||
}
|
||||
|
||||
StringRef printForCodeDiagnostic(SILFunction *fn) const {
|
||||
return innerInfo.printForCodeDiagnostic(fn);
|
||||
}
|
||||
|
||||
void printForOneLineLogging(SILFunction *fn, llvm::raw_ostream &os) const {
|
||||
innerInfo.printForOneLineLogging(fn, os);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user