[cfe-commits] r155180 - /cfe/trunk/lib/Driver/Driver.cpp
Chad Rosier
mcrosier at apple.com
Thu Apr 19 17:30:04 PDT 2012
Author: mcrosier
Date: Thu Apr 19 19:30:04 2012
New Revision: 155180
URL: http://llvm.org/viewvc/llvm-project?rev=155180&view=rev
Log:
When generating the clang crash diagnostic script, strip out the -D, -F, and -I
flags. We have preprocessed source, so we don't need these.
No test case as it's fairly difficult to make the compiler crash on demand. I'll
patiently wait for Ben to tell me how to do this in 2 lines of code. :)
rdar://11283560
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=155180&r1=155179&r2=155180&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Thu Apr 19 19:30:04 2012
@@ -489,6 +489,20 @@
Diag(clang::diag::note_drv_command_failed_diag_msg)
<< "Error generating run script: " + Script + " " + Err;
} else {
+ // Strip -D, -F, and -I.
+ // FIXME: This doesn't work with quotes (e.g., -D "foo bar").
+ std::string Flag[3] = {"-D ", "-F", "-I "};
+ for (unsigned i = 0; i < 3; ++i) {
+ size_t I = 0, E = 0;
+ do {
+ I = Cmd.find(Flag[i], I);
+ if (I == std::string::npos) break;
+
+ E = Cmd.find(" ", I + Flag[i].length());
+ if (E == std::string::npos) break;
+ Cmd.erase(I, E - I + 1);
+ } while(1);
+ }
ScriptOS << Cmd;
Diag(clang::diag::note_drv_command_failed_diag_msg) << Script;
}
More information about the cfe-commits
mailing list