Commit 1ab84a27d3

Andrew Kelley <superjoe30@gmail.com>
2017-11-28 06:32:32
translate-c: fix sometimes getting (no file) warnings
Thanks to Mason Remaley for testing the fix.
1 parent 3e8fd24
Changed files (1)
src/translate_c.cpp
@@ -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) {