mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Use perfect forwarding for diagnostic arguments.
While this should be a pointless performance tweak along a path where we don't care about performance, it actually matters because we occasionally end up copying SmallStrings or std::strings, then taking StringRefs to the copies and holding on to them. This was manifesting as occasional corruption in keyword-argument diagnostics. Swift SVN r17811
This commit is contained in:
@@ -447,14 +447,15 @@ public:
|
||||
|
||||
template<typename ...DiagArgTypes, typename ...ArgTypes>
|
||||
InFlightDiagnostic diagnose(SourceLoc Loc, Diag<DiagArgTypes...> DiagID,
|
||||
ArgTypes... Args) {
|
||||
return diagnose(Loc, Diagnostic(DiagID, Args...));
|
||||
ArgTypes &&...Args) {
|
||||
return diagnose(Loc, Diagnostic(DiagID, std::forward<ArgTypes>(Args)...));
|
||||
}
|
||||
|
||||
template<typename ...DiagArgTypes, typename ...ArgTypes>
|
||||
InFlightDiagnostic diagnose(Token Tok, Diag<DiagArgTypes...> DiagID,
|
||||
ArgTypes... Args) {
|
||||
return diagnose(Tok.getLoc(), Diagnostic(DiagID, Args...));
|
||||
ArgTypes &&...Args) {
|
||||
return diagnose(Tok.getLoc(),
|
||||
Diagnostic(DiagID, std::forward<ArgTypes>(Args)...));
|
||||
}
|
||||
|
||||
void diagnoseRedefinition(ValueDecl *Prev, ValueDecl *New);
|
||||
|
||||
Reference in New Issue
Block a user