[cfe-commits] [PATCH] First version of a command line clang-format tool.
Daniel Jasper
djasper at google.com
Tue Dec 4 23:55:38 PST 2012
================
Comment at: clang-format/ClangFormat.cpp:44
@@ +43,3 @@
+ const FileEntry *Entry =
+ Files.getVirtualFile("file.cpp", Source->getBufferSize(), 0);
+ Sources.overrideFileContents(Entry, Source, true);
----------------
Manuel Klimek wrote:
> Perhaps call it "<stdin>" so it's clear that this isn't a file?
Done.
================
Comment at: clang-format/ClangFormat.cpp:55
@@ +54,3 @@
+ OwningPtr<MemoryBuffer> Code;
+ assert(!MemoryBuffer::getSTDIN(Code) && "Could not read stdin.");
+ FileID ID = createInMemoryFile(Code.get(), Sources, Files);
----------------
Manuel Klimek wrote:
> Won't that be a bad idea in a non-assert build?
*facepalm*
Fixed.
================
Comment at: clang-format/ClangFormat.cpp:63
@@ +62,3 @@
+ SourceLocation End = Sources.getLocForEndOfFile(ID);
+ if (Length != - 1)
+ End = Start.getLocWithOffset(Length);
----------------
Manuel Klimek wrote:
> Please run an updated clang-format :D
Manually fixed, fix to clang-format coming up next.
http://llvm-reviews.chandlerc.com/D167
More information about the cfe-commits
mailing list