[cfe-commits] [clang-tools-extra] r172405 - /clang-tools-extra/trunk/clang-format/ClangFormat.cpp
David Blaikie
dblaikie at gmail.com
Mon Jan 14 08:53:40 PST 2013
On Jan 14, 2013 5:42 AM, "Alexander Kornienko" <alexfh at google.com> wrote:
>
> Author: alexfh
> Date: Mon Jan 14 07:40:44 2013
> New Revision: 172405
>
> URL: http://llvm.org/viewvc/llvm-project?rev=172405&view=rev
> Log:
> Fix: correct file name in diagnostics.
>
> Modified:
> clang-tools-extra/trunk/clang-format/ClangFormat.cpp
Test case?
>
> Modified: clang-tools-extra/trunk/clang-format/ClangFormat.cpp
> URL:
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-format/ClangFormat.cpp?rev=172405&r1=172404&r2=172405&view=diff
>
==============================================================================
> --- clang-tools-extra/trunk/clang-format/ClangFormat.cpp (original)
> +++ clang-tools-extra/trunk/clang-format/ClangFormat.cpp Mon Jan 14
07:40:44 2013
> @@ -44,10 +44,11 @@
> namespace clang {
> namespace format {
>
> -static FileID createInMemoryFile(const MemoryBuffer *Source,
> +static FileID createInMemoryFile(StringRef FileName, const MemoryBuffer
*Source,
> SourceManager &Sources, FileManager
&Files) {
> - const FileEntry *Entry =
> - Files.getVirtualFile("<stdio>", Source->getBufferSize(), 0);
> + const FileEntry *Entry = Files.getVirtualFile(FileName == "-" ?
"<stdin>" :
> + FileName,
> + Source->getBufferSize(),
0);
> Sources.overrideFileContents(Entry, Source, true);
> return Sources.createFileID(Entry, SourceLocation(), SrcMgr::C_User);
> }
> @@ -63,7 +64,7 @@
> llvm::errs() << ec.message() << "\n";
> return;
> }
> - FileID ID = createInMemoryFile(Code.get(), Sources, Files);
> + FileID ID = createInMemoryFile(FileName, Code.get(), Sources, Files);
> Lexer Lex(ID, Sources.getBuffer(ID), Sources, getFormattingLangOpts());
> SourceLocation Start =
> Sources.getLocForStartOfFile(ID).getLocWithOffset(Offset);
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130114/8e8152c2/attachment.html>
More information about the cfe-commits
mailing list