[PATCH] Teach Clang how to use response files when calling other tools
Rafael Ávila de Espíndola
rafael.espindola at gmail.com
Tue Sep 2 14:51:44 PDT 2014
My main comment is on the llvm side. We really can't have something as core as raw_fd_ostream handling char conversion. Some options are
* build a buffer and write it at once.
* have another streamer implementation. Hopefully implement it in a way that avoids reasoning about partial multibyte chars. A simple option might be to build the entire buffer in memory inside the streamer and convert on close (and error on sync?). Even for large response files, I expect the work being done by the sub process to always dwarf the cost of creating it, so we probably don't need to get fancy.
I have one more nit on the code itself and one on the tests.
================
Comment at: include/clang/Driver/Tool.h:81
@@ +80,3 @@
+ /// whether it accepts arguments to be passed via a file on disk.
+ virtual ResponseFileSupport getResponseFilesSupport() const {
+ return RF_None;
----------------
All the overrides of these 3 methods always return a symbol constant, no? Maybe it would be better to make them non-virtual:
ResponseFileSupport getResponseFilesSupport() const {
return RespFileSupport;
}
and set RespFileSupport in the constructor of the base classes. We do things like that in, for example, MCAsmInfo.
================
Comment at: test/Driver/response-file.c:17
@@ +16,3 @@
+// limit.
+// RUN: awk "BEGIN { while (count++<300000) string=string \"-DTEST \";\
+// RUN: print string }" > %t.1.txt
----------------
Please don't introduce an use of awk :-)
Can you use clang -E to produce a large file on the fly? Is 2MB really too big for current linux systems?
http://reviews.llvm.org/D4897
More information about the cfe-commits
mailing list