Frontend: Allow passing -cc1 level arguments to plugins. Patch by Troy Straszheim!

llvm-svn: 106113
This commit is contained in:
Daniel Dunbar
2010-06-16 16:59:23 +00:00
parent 26036fd722
commit 7c995e8fac
8 changed files with 57 additions and 16 deletions

View File

@@ -31,11 +31,24 @@ public:
}
};
class PrintFunctionNamesAction : public ASTFrontendAction {
class PrintFunctionNamesAction : public PluginASTAction {
protected:
ASTConsumer *CreateASTConsumer(CompilerInstance &CI, llvm::StringRef) {
return new PrintFunctionsConsumer();
}
bool ParseArgs(const std::vector<std::string>& args) {
for (unsigned i=0; i<args.size(); ++i)
llvm::errs() << "PrintFunctionNames arg = " << args[i] << "\n";
if (args.size() && args[0] == "help")
PrintHelp(llvm::errs());
return true;
}
void PrintHelp(llvm::raw_ostream& ros) {
ros << "Help for PrintFunctionNames plugin goes here\n";
}
};
}