diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-04-02 19:05:20 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-04-02 19:05:20 +0000 |
commit | 26df2f09587ad6978ac8e357ca46b2731d591cc4 (patch) | |
tree | 1196ee4c5e3ebc1f03d3b89676484f23f6a0bf9c /include/clang/Frontend/FixItRewriter.h | |
parent | d09a456e466597fe1667ea5e757bfe53be2cba7d (diff) |
Add a new command-line option "-fixit-at=file:line:column" that only
applies fix-its to error messages that occur at that specific location
in the program.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68342 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Frontend/FixItRewriter.h')
-rw-r--r-- | include/clang/Frontend/FixItRewriter.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/include/clang/Frontend/FixItRewriter.h b/include/clang/Frontend/FixItRewriter.h index 752b00836c..363b9ad9a3 100644 --- a/include/clang/Frontend/FixItRewriter.h +++ b/include/clang/Frontend/FixItRewriter.h @@ -17,10 +17,23 @@ #include "clang/Basic/Diagnostic.h" #include "clang/Rewrite/Rewriter.h" +#include "llvm/ADT/SmallVector.h" namespace clang { class SourceManager; +class FileEntry; + +/// \brief Stores a source location in the form that it shows up on +/// the Clang command line, e.g., file:line:column. +/// +/// FIXME: Would prefer to use real SourceLocations, but I don't see a +/// good way to resolve them during parsing. +struct RequestedSourceLocation { + const FileEntry *File; + unsigned Line; + unsigned Column; +}; class FixItRewriter : public DiagnosticClient { /// \brief The diagnostics machinery. @@ -37,6 +50,11 @@ class FixItRewriter : public DiagnosticClient { /// \brief The number of rewriter failures. unsigned NumFailures; + /// \brief Locations at which we should perform fix-its. + /// + /// When empty, perform fix-it modifications everywhere. + llvm::SmallVector<RequestedSourceLocation, 4> FixItLocations; + public: /// \brief Initialize a new fix-it rewriter. FixItRewriter(Diagnostic &Diags, SourceManager &SourceMgr); @@ -44,6 +62,12 @@ public: /// \brief Destroy the fix-it rewriter. ~FixItRewriter(); + /// \brief Add a location where fix-it modifications should be + /// performed. + void addFixItLocation(RequestedSourceLocation Loc) { + FixItLocations.push_back(Loc); + } + /// \brief Write the modified source file. /// /// \returns true if there was an error, false otherwise. |