[PATCH] D18551: Added Fixer implementation and fix() interface in clang-format for removing redundant code.
Manuel Klimek via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 25 07:56:14 PDT 2016
klimek accepted this revision.
klimek added a reviewer: klimek.
klimek added a comment.
This revision is now accepted and ready to land.
We'll probably want Daniel to also take another look over it, as it's a pretty substantial change that will haunt us for a while, but I think this now pretty much looks like I expect it to look.
================
Comment at: lib/Format/Format.cpp:1509
@@ +1508,3 @@
+ // above.
+ IntrusiveRefCntPtr<SourceManager> SourceMgr(
+ new SourceManager(*Diagnostics, *FileMgr));
----------------
Don't name it SourceMgr, as there is a class of that name. Unfortunately we'll probably want to name it SM, like everywhere else in clang :(
================
Comment at: lib/Format/Format.cpp:1454
@@ -1450,8 +1453,3 @@
public:
- Formatter(const FormatStyle &Style, SourceManager &SourceMgr, FileID ID,
- ArrayRef<CharSourceRange> Ranges)
- : Style(Style), ID(ID), SourceMgr(SourceMgr),
- Whitespaces(SourceMgr, Style,
- inputUsesCRLF(SourceMgr.getBufferData(ID))),
- Ranges(Ranges.begin(), Ranges.end()), UnwrappedLines(1),
- Encoding(encoding::detectEncoding(SourceMgr.getBufferData(ID))) {
+ Environment() = delete;
+
----------------
Won't deleting this line have the same effect?
================
Comment at: lib/Format/Format.cpp:1489-1490
@@ +1488,4 @@
+ new DiagnosticOptions));
+ // This will be passed to the base class `Environment` as reference, so the
+ // pointer has to be stored in `Environment` due to the same reason above.
+ std::unique_ptr<SourceManager> VirtualSM(
----------------
There is no base class any more.
================
Comment at: lib/Format/Format.cpp:1872
@@ +1871,3 @@
+ // it does not make the namespace non-empty.
+ // TODO: error handling if there is no left brace.
+ if (!AnnotatedLines[++CurrentLine]->startsWith(tok::l_brace)) {
----------------
In LLVM TODOs are spelled FIXME.
http://reviews.llvm.org/D18551
More information about the cfe-commits
mailing list