Don't attempt to actually do double code removals

...that easily works around the problem that in a rewriter rewriting types of
VarDecls like

   T x, y;

it would try to replace T twice.  Also, keep the list of removals globally with
the (global) rewriter.

Change-Id: I55b8d11986c2a29e09ff40132fd114a0cc48dc90
This commit is contained in:
Stephan Bergmann
2014-02-20 19:47:01 +01:00
parent 58038cb26a
commit 5dcb634dcb
4 changed files with 27 additions and 12 deletions

View File

@@ -14,6 +14,8 @@
#include "plugin.hxx"
#include <set>
#include <clang/AST/ASTConsumer.h>
#include <clang/Frontend/FrontendAction.h>
@@ -33,12 +35,14 @@ class PluginHandler
static void registerPlugin( Plugin* (*create)( const Plugin::InstantiationData& ), const char* optionName, bool isPPCallback, bool byDefault );
DiagnosticBuilder report( DiagnosticsEngine::Level level, const char * plugin, StringRef message,
CompilerInstance& compiler, SourceLocation loc = SourceLocation());
bool addRemoval( SourceLocation loc );
private:
void handleOption( const string& option );
void createPlugins( set< string > rewriters );
DiagnosticBuilder report( DiagnosticsEngine::Level level, StringRef message, SourceLocation loc = SourceLocation());
CompilerInstance& compiler;
Rewriter rewriter;
set< SourceLocation > removals;
string scope;
string warningsOnly;
};