diff options
author | Nick Lewycky <nicholas@mxc.ca> | 2010-08-13 17:31:00 +0000 |
---|---|---|
committer | Nick Lewycky <nicholas@mxc.ca> | 2010-08-13 17:31:00 +0000 |
commit | 078a5e26fdc2ba4123bdca349139fde083d3c08e (patch) | |
tree | bc902e50a119f235cfc8a324cced06109d9de66a /clang/lib/Rewrite/FixItRewriter.cpp | |
parent | d1f4465df01bc40899ebb428546a734050930dac (diff) | |
download | bcm5719-llvm-078a5e26fdc2ba4123bdca349139fde083d3c08e.tar.gz bcm5719-llvm-078a5e26fdc2ba4123bdca349139fde083d3c08e.zip |
Add a new cc1 option -fix-what-you-can which when combined with the fix-it mode
will apply all fixes even when there were other errors in the file.
llvm-svn: 111020
Diffstat (limited to 'clang/lib/Rewrite/FixItRewriter.cpp')
-rw-r--r-- | clang/lib/Rewrite/FixItRewriter.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/clang/lib/Rewrite/FixItRewriter.cpp b/clang/lib/Rewrite/FixItRewriter.cpp index 29ac7e380bf..875af7a7c77 100644 --- a/clang/lib/Rewrite/FixItRewriter.cpp +++ b/clang/lib/Rewrite/FixItRewriter.cpp @@ -27,10 +27,10 @@ using namespace clang; FixItRewriter::FixItRewriter(Diagnostic &Diags, SourceManager &SourceMgr, const LangOptions &LangOpts, - FixItPathRewriter *PathRewriter) + FixItOptions *FixItOpts) : Diags(Diags), Rewrite(SourceMgr, LangOpts), - PathRewriter(PathRewriter), + FixItOpts(FixItOpts), NumFailures(0) { Client = Diags.getClient(); Diags.setClient(this); @@ -49,7 +49,7 @@ bool FixItRewriter::WriteFixedFile(FileID ID, llvm::raw_ostream &OS) { } bool FixItRewriter::WriteFixedFiles() { - if (NumFailures > 0) { + if (NumFailures > 0 && !FixItOpts->FixWhatYouCan) { Diag(FullSourceLoc(), diag::warn_fixit_no_changes); return true; } @@ -57,8 +57,8 @@ bool FixItRewriter::WriteFixedFiles() { for (iterator I = buffer_begin(), E = buffer_end(); I != E; ++I) { const FileEntry *Entry = Rewrite.getSourceMgr().getFileEntryForID(I->first); std::string Filename = Entry->getName(); - if (PathRewriter) - Filename = PathRewriter->RewriteFilename(Filename); + if (FixItOpts) + Filename = FixItOpts->RewriteFilename(Filename); std::string Err; llvm::raw_fd_ostream OS(Filename.c_str(), Err, llvm::raw_fd_ostream::F_Binary); @@ -164,4 +164,4 @@ void FixItRewriter::Diag(FullSourceLoc Loc, unsigned DiagID) { Diags.setClient(this); } -FixItPathRewriter::~FixItPathRewriter() {} +FixItOptions::~FixItOptions() {} |