Make runtime warnings about missing metadata more descriptive.

Describe the consequences of missing metadata instead of just posting a scary
message about a bug.  Furthermore, since these warnings tend to show up in
playgrounds, and probably aren't relevant to the user of a playground, suppress
them when running in a playground. rdar://problem/44642942
This commit is contained in:
Joe Groff
2018-09-20 08:48:34 -07:00
parent 0c701964dc
commit e9b45178a0
4 changed files with 82 additions and 13 deletions

View File

@@ -352,22 +352,29 @@ swift::fatalError(uint32_t flags, const char *format, ...)
// Report a warning to system console and stderr.
void
swift::warning(uint32_t flags, const char *format, ...)
swift::warningv(uint32_t flags, const char *format, va_list args)
{
va_list args;
va_start(args, format);
char *log;
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wuninitialized"
swift_vasprintf(&log, format, args);
#pragma GCC diagnostic pop
reportNow(flags, log);
free(log);
}
// Report a warning to system console and stderr.
void
swift::warning(uint32_t flags, const char *format, ...)
{
va_list args;
va_start(args, format);
warningv(flags, format, args);
}
// Crash when a deleted method is called by accident.
SWIFT_RUNTIME_EXPORT
LLVM_ATTRIBUTE_NORETURN