[SourceKit] Suppress oslog_invalid_log_message diagnostic in live issues

The index build skips *all* function bodies, including inlinable. The
`OSLogOptimization` pass expects SIL for inlinable bodies and thus
outputs a spurious diagnostic for live issues when the
`OSLogInterpolation` extension is in a separate module to the log
statement.

Ignore this for now, but we may need to re-evaluate if this becomes a
more widespread problem.

Resolves rdar://79100763
This commit is contained in:
Ben Barham
2021-08-06 16:49:43 +10:00
parent b12ab969b2
commit f6899eda96
2 changed files with 44 additions and 1 deletions

View File

@@ -27,6 +27,7 @@
#include "swift/AST/DiagnosticsClangImporter.h"
#include "swift/AST/DiagnosticsParse.h"
#include "swift/AST/DiagnosticsFrontend.h"
#include "swift/AST/DiagnosticsSIL.h"
#include "swift/Basic/SourceManager.h"
#include "swift/Demangling/ManglingUtils.h"
#include "swift/Frontend/Frontend.h"
@@ -83,7 +84,13 @@ void EditorDiagConsumer::handleDiagnostic(SourceManager &SM,
}
// Filter out benign diagnostics for editing.
if (Info.ID == diag::lex_editor_placeholder.ID)
// oslog_invalid_log_message is spuriously output for live issues as modules
// in the index build are built without function bodies (including inline
// functions). OSLogOptimization expects SIL for bodies and hence errors
// when there isn't any. Ignore in live issues for now and re-evaluate if
// this (not having SIL for inline functions) becomes a more widespread issue.
if (Info.ID == diag::lex_editor_placeholder.ID ||
Info.ID == diag::oslog_invalid_log_message.ID)
return;
bool IsNote = (Info.Kind == DiagnosticKind::Note);