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 | 1450f265fcc84a7ca64dd9f3b8d4492c5bd55e23 (patch) | |
tree | c0dc75d7a615172e0636c10db18c126785a9828d /include/clang | |
parent | 1999844e7a18786e61e619e1dc6c789827541863 (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111020 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang')
-rw-r--r-- | include/clang/Driver/CC1Options.td | 3 | ||||
-rw-r--r-- | include/clang/Frontend/FrontendOptions.h | 2 | ||||
-rw-r--r-- | include/clang/Rewrite/FixItRewriter.h | 11 | ||||
-rw-r--r-- | include/clang/Rewrite/FrontendActions.h | 4 |
4 files changed, 13 insertions, 7 deletions
diff --git a/include/clang/Driver/CC1Options.td b/include/clang/Driver/CC1Options.td index 4a69974d92..bfa8c8ba02 100644 --- a/include/clang/Driver/CC1Options.td +++ b/include/clang/Driver/CC1Options.td @@ -358,9 +358,10 @@ def print_stats : Flag<"-print-stats">, HelpText<"Print performance metrics and statistics">; def ftime_report : Flag<"-ftime-report">, HelpText<"Print the amount of time each phase of compilation takes">; - def fdump_record_layouts : Flag<"-fdump-record-layouts">, HelpText<"Dump record layout information">; +def fix_what_you_can : Flag<"-fix-what-you-can">, + HelpText<"Apply fix-it advice even in the presence of unfixable errors">; // Generic forwarding to LLVM options. This should only be used for debugging // and experimental features. diff --git a/include/clang/Frontend/FrontendOptions.h b/include/clang/Frontend/FrontendOptions.h index 7040b5c1f8..48ce5074fa 100644 --- a/include/clang/Frontend/FrontendOptions.h +++ b/include/clang/Frontend/FrontendOptions.h @@ -74,6 +74,8 @@ public: unsigned ShowTimers : 1; ///< Show timers for individual /// actions. unsigned ShowVersion : 1; ///< Show the -version text. + unsigned FixWhatYouCan : 1; ///< Apply fixes even if there are + /// unfixable errors. /// The input files and their types. std::vector<std::pair<InputKind, std::string> > Inputs; diff --git a/include/clang/Rewrite/FixItRewriter.h b/include/clang/Rewrite/FixItRewriter.h index 4ebcef0fff..9b2e0160c5 100644 --- a/include/clang/Rewrite/FixItRewriter.h +++ b/include/clang/Rewrite/FixItRewriter.h @@ -27,13 +27,16 @@ namespace clang { class SourceManager; class FileEntry; -class FixItPathRewriter { +class FixItOptions { public: - virtual ~FixItPathRewriter(); + virtual ~FixItOptions(); /// \brief This file is about to be rewritten. Return the name of the file /// that is okay to write to. virtual std::string RewriteFilename(const std::string &Filename) = 0; + + /// \brief Whether to abort fixing a file when not all errors could be fixed. + bool FixWhatYouCan; }; class FixItRewriter : public DiagnosticClient { @@ -50,7 +53,7 @@ class FixItRewriter : public DiagnosticClient { /// \brief Turn an input path into an output path. NULL implies overwriting /// the original. - FixItPathRewriter *PathRewriter; + FixItOptions *FixItOpts; /// \brief The number of rewriter failures. unsigned NumFailures; @@ -60,7 +63,7 @@ public: /// \brief Initialize a new fix-it rewriter. FixItRewriter(Diagnostic &Diags, SourceManager &SourceMgr, - const LangOptions &LangOpts, FixItPathRewriter *PathRewriter); + const LangOptions &LangOpts, FixItOptions *FixItOpts); /// \brief Destroy the fix-it rewriter. ~FixItRewriter(); diff --git a/include/clang/Rewrite/FrontendActions.h b/include/clang/Rewrite/FrontendActions.h index 2ff8d0a5b6..2b5f88ccee 100644 --- a/include/clang/Rewrite/FrontendActions.h +++ b/include/clang/Rewrite/FrontendActions.h @@ -16,7 +16,7 @@ namespace clang { class FixItRewriter; -class FixItPathRewriter; +class FixItOptions; //===----------------------------------------------------------------------===// // AST Consumer Actions @@ -31,7 +31,7 @@ protected: class FixItAction : public ASTFrontendAction { protected: llvm::OwningPtr<FixItRewriter> Rewriter; - llvm::OwningPtr<FixItPathRewriter> PathRewriter; + llvm::OwningPtr<FixItOptions> FixItOpts; virtual ASTConsumer *CreateASTConsumer(CompilerInstance &CI, llvm::StringRef InFile); |