[cfe-commits] r156117 - /cfe/trunk/lib/Driver/Driver.cpp
Chad Rosier
mcrosier at apple.com
Thu May 3 15:40:31 PDT 2012
Actually, I didn't convert the flags back to an array of strings and use array_lengthof. I figured I would do that in a separate commit. This commit just addresses the FIXME.
Chad
On May 3, 2012, at 3:38 PM, Chad Rosier wrote:
> Author: mcrosier
> Date: Thu May 3 17:38:00 2012
> New Revision: 156117
>
> URL: http://llvm.org/viewvc/llvm-project?rev=156117&view=rev
> Log:
> [driver - crash diagnostics] Convert the flags back to an array of strings and use
> array_lengthof. Also, append the new filename with correct preprocessed suffix.
> Last part of rdar://11285725
>
> Modified:
> cfe/trunk/lib/Driver/Driver.cpp
>
> Modified: cfe/trunk/lib/Driver/Driver.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=156117&r1=156116&r2=156117&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Driver/Driver.cpp (original)
> +++ cfe/trunk/lib/Driver/Driver.cpp Thu May 3 17:38:00 2012
> @@ -521,7 +521,19 @@
> Cmd.erase(I, E - I + 1);
> } while(1);
> }
> - // FIXME: Append the new filename with correct preprocessed suffix.
> + // Append the new filename with correct preprocessed suffix.
> + size_t I, E;
> + I = Cmd.find("-main-file-name ");
> + assert (I != std::string::npos && "Expected to find -main-file-name");
> + I += 16;
> + E = Cmd.find(" ", I);
> + assert (E != std::string::npos && "-main-file-name missing argument?");
> + std::string OldFilename = Cmd.substr(I, E - I);
> + std::string NewFilename = llvm::sys::path::filename(*it).str();
> + I = Cmd.rfind(OldFilename);
> + E = I + OldFilename.length() - 1;
> + I = Cmd.rfind(" ", I);
> + Cmd.replace(I + 1, E - I, NewFilename);
> ScriptOS << Cmd;
> Diag(clang::diag::note_drv_command_failed_diag_msg) << Script;
> }
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
More information about the cfe-commits
mailing list