<p dir="ltr"><br>
On Jan 14, 2013 5:42 AM, "Alexander Kornienko" <<a href="mailto:alexfh@google.com">alexfh@google.com</a>> wrote:<br>
><br>
> Author: alexfh<br>
> Date: Mon Jan 14 07:40:44 2013<br>
> New Revision: 172405<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=172405&view=rev">http://llvm.org/viewvc/llvm-project?rev=172405&view=rev</a><br>
> Log:<br>
> Fix: correct file name in diagnostics.<br>
><br>
> Modified:<br>
>     clang-tools-extra/trunk/clang-format/ClangFormat.cpp</p>
<p dir="ltr">Test case?</p>
<p dir="ltr">><br>
> Modified: clang-tools-extra/trunk/clang-format/ClangFormat.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-format/ClangFormat.cpp?rev=172405&r1=172404&r2=172405&view=diff">http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-format/ClangFormat.cpp?rev=172405&r1=172404&r2=172405&view=diff</a><br>

> ==============================================================================<br>
> --- clang-tools-extra/trunk/clang-format/ClangFormat.cpp (original)<br>
> +++ clang-tools-extra/trunk/clang-format/ClangFormat.cpp Mon Jan 14 07:40:44 2013<br>
> @@ -44,10 +44,11 @@<br>
>  namespace clang {<br>
>  namespace format {<br>
><br>
> -static FileID createInMemoryFile(const MemoryBuffer *Source,<br>
> +static FileID createInMemoryFile(StringRef FileName, const MemoryBuffer *Source,<br>
>                                   SourceManager &Sources, FileManager &Files) {<br>
> -  const FileEntry *Entry =<br>
> -      Files.getVirtualFile("<stdio>", Source->getBufferSize(), 0);<br>
> +  const FileEntry *Entry = Files.getVirtualFile(FileName == "-" ? "<stdin>" :<br>
> +                                                    FileName,<br>
> +                                                Source->getBufferSize(), 0);<br>
>    Sources.overrideFileContents(Entry, Source, true);<br>
>    return Sources.createFileID(Entry, SourceLocation(), SrcMgr::C_User);<br>
>  }<br>
> @@ -63,7 +64,7 @@<br>
>      llvm::errs() << ec.message() << "\n";<br>
>      return;<br>
>    }<br>
> -  FileID ID = createInMemoryFile(Code.get(), Sources, Files);<br>
> +  FileID ID = createInMemoryFile(FileName, Code.get(), Sources, Files);<br>
>    Lexer Lex(ID, Sources.getBuffer(ID), Sources, getFormattingLangOpts());<br>
>    SourceLocation Start =<br>
>        Sources.getLocForStartOfFile(ID).getLocWithOffset(Offset);<br>
><br>
><br>
> _______________________________________________<br>
> cfe-commits mailing list<br>
> <a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
</p>