translate-c: fix sometimes getting (no file) warnings

Thanks to Mason Remaley for testing the fix.
This commit is contained in:
Andrew Kelley 2017-11-28 00:32:32 -05:00
parent 3e8fd24547
commit 1ab84a27d3

View File

@ -138,7 +138,7 @@ static void emit_warning(Context *c, const SourceLocation &sl, const char *forma
Buf *msg = buf_vprintf(format, ap);
va_end(ap);
StringRef filename = c->source_manager->getFilename(sl);
StringRef filename = c->source_manager->getFilename(c->source_manager->getSpellingLoc(sl));
const char *filename_bytes = (const char *)filename.bytes_begin();
Buf *path;
if (filename_bytes) {