From ba5f6eced29937e4e4851a2c0980744768413d66 Mon Sep 17 00:00:00 2001 From: Nick Lewycky Date: Sat, 24 Apr 2010 01:30:46 +0000 Subject: Teach clang -fixit to modify files in-place, or -fixit=suffix to create new files with the additional suffix in the middle. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102230 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Frontend/CompilerInvocation.cpp | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) (limited to 'lib/Frontend/CompilerInvocation.cpp') diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp index 3386eff5ba..db937bc4c7 100644 --- a/lib/Frontend/CompilerInvocation.cpp +++ b/lib/Frontend/CompilerInvocation.cpp @@ -361,12 +361,6 @@ static void FrontendOptsToArgs(const FrontendOptions &Opts, Res.push_back("-cxx-inheritance-view"); Res.push_back(Opts.ViewClassInheritance); } - for (unsigned i = 0, e = Opts.FixItLocations.size(); i != e; ++i) { - Res.push_back("-fixit-at"); - Res.push_back(Opts.FixItLocations[i].FileName + ":" + - llvm::utostr(Opts.FixItLocations[i].Line) + ":" + - llvm::utostr(Opts.FixItLocations[i].Column)); - } if (!Opts.CodeCompletionAt.FileName.empty()) { Res.push_back("-code-completion-at"); Res.push_back(Opts.CodeCompletionAt.FileName + ":" + @@ -910,6 +904,9 @@ ParseFrontendArgs(FrontendOptions &Opts, ArgList &Args, Diagnostic &Diags) { Opts.ProgramAction = frontend::EmitLLVMOnly; break; case OPT_emit_obj: Opts.ProgramAction = frontend::EmitObj; break; + case OPT_fixit_EQ: + Opts.FixItSuffix = A->getValue(Args); + // fall-through! case OPT_fixit: Opts.ProgramAction = frontend::FixIt; break; case OPT_emit_pch: @@ -956,20 +953,6 @@ ParseFrontendArgs(FrontendOptions &Opts, ArgList &Args, Diagnostic &Diags) { !Args.hasArg(OPT_no_code_completion_debug_printer); Opts.DisableFree = Args.hasArg(OPT_disable_free); - Opts.FixItLocations.clear(); - for (arg_iterator it = Args.filtered_begin(OPT_fixit_at), - ie = Args.filtered_end(); it != ie; ++it) { - const char *Loc = it->getValue(Args); - ParsedSourceLocation PSL = ParsedSourceLocation::FromString(Loc); - - if (PSL.FileName.empty()) { - Diags.Report(diag::err_drv_invalid_value) << it->getAsString(Args) << Loc; - continue; - } - - Opts.FixItLocations.push_back(PSL); - } - Opts.OutputFile = getLastArgValue(Args, OPT_o); Opts.Plugins = getAllArgValues(Args, OPT_load); Opts.RelocatablePCH = Args.hasArg(OPT_relocatable_pch); -- cgit v1.2.3-18-g5258