summaryrefslogtreecommitdiffstats
path: root/clang/lib/Driver/Job.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Driver: Strip -header-include-file and -diagnostic-log-file from crash repro ↵Justin Bogner2015-08-051-0/+1
| | | | | | | | | scripts These two arguments tend to refer to a local path that won't exist when we try to reproduce a bug. Strip them. llvm-svn: 244179
* Driver: Determine file names for crash reports more reliablyJustin Bogner2015-07-171-12/+15
| | | | | | | | Guessing which file name to replace based on the -main-file-name argument to -cc1 is flawed. Instead, keep track of which arguments are inputs to each command. llvm-svn: 242504
* [clang-cl] Use the Windows response file tokenizerReid Kleckner2015-07-151-1/+3
| | | | | | | | | | | | | | | | | | | | We were still using the Unix response file tokenizer for all driver modes. This was difficult to get right in the beginning because there is a circular dependency. The Driver class also can't officially determine its mode until it can see all possible --driver-mode= flags, and those flags could come from the response file. Now we use the Windows parsing algorithm if the program name looks like clang-cl, or if the --driver-mode=cl flag is present on the main command line. Fixes PR23709. Reviewers: hans Differential Revision: http://reviews.llvm.org/D11229 llvm-svn: 242346
* Driver: Include the driver arguments in crash reportsJustin Bogner2015-07-091-6/+6
| | | | | | | Similarly to r231989, the driver arguments can be quite helpful in diagnosing a crash. llvm-svn: 241786
* Driver: Remove the Job class. NFCJustin Bogner2015-07-021-6/+2
| | | | | | | | | | | We had a strange relationship here where we made a list of Jobs inherit from a single Job, but there weren't actually any places where this arbitrary nesting was used or needed. Simplify all of this by removing Job entirely and updating all of the users to either work with a JobList or a single Command. llvm-svn: 241310
* Driver: Don't use reserved names. NFCJustin Bogner2015-07-021-6/+4
| | | | llvm-svn: 241309
* Driver: Keep -isysroot flags in crash scripts if we're dumping a VFSJustin Bogner2015-03-121-4/+7
| | | | | | | | | | | | | For crashes with a VFS (ie, with modules), the -isysroot flag is often necessary to reproduce the crash. This is especially true if some modules need to be rebuilt, since without the sysroot they'll try to read headers that are outside of the VFS. I find it likely that we should keep some of the other -i flags in this case as well, but I haven't seen that come up in practice yet so it seems better to be conservative. llvm-svn: 231997
* Prefer SmallVector::append/insert over push_back loops. Clang edition.Benjamin Kramer2015-02-171-2/+1
| | | | | | Same functionality, but hoists the vector growth out of the loop. llvm-svn: 229508
* Driver: Quote the command in crash reproduction scripts.Justin Bogner2014-10-211-11/+0
| | | | | | | | This fixes crash report generation when filenames have spaces. It also removes an awkward workaround that quoted *some* arguments when generating crash reports. llvm-svn: 220307
* Driver: Move crash report command mangling into Command::PrintJustin Bogner2014-10-211-8/+29
| | | | | | | | | | This pushes the logic for generating a crash reproduction script entirely into Command::Print, instead of Command doing half of the work and then relying on textual substitution for the rest. This makes this logic much easier to read and will simplify fixing a couple of issues in this area. llvm-svn: 220305
* Driver: Use pointee_iterator rather than iterating over unique_ptrsJustin Bogner2014-10-031-2/+2
| | | | | | | | There's probably never a good reason to iterate over unique_ptrs. This lets us use range-for and say Job.foo instead of (*it)->foo in a few places. llvm-svn: 218938
* Teach Clang how to use response files when calling other toolsReid Kleckner2014-09-151-7/+117
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Patch by Rafael Auler! This patch addresses PR15171 and teaches Clang how to call other tools with response files, when the command line exceeds system limits. This is a problem for Windows systems, whose maximum command-line length is 32kb. I introduce the concept of "response file support" for each Tool object. A given Tool may have full support for response files (e.g. MSVC's link.exe) or only support file names inside response files, but no flags (e.g. Apple's ld64, as commented in PR15171), or no support at all (the default case). Therefore, if you implement a toolchain in the clang driver and you want clang to be able to use response files in your tools, you must override a method (getReponseFileSupport()) to tell so. I designed it to support different kinds of tools and internationalisation needs: - VS response files ( UTF-16 ) - GNU tools ( uses system's current code page, windows' legacy intl. support, with escaped backslashes. On unix, fallback to UTF-8 ) - Clang itself ( UTF-16 on windows, UTF-8 on unix ) - ld64 response files ( only a limited file list, UTF-8 on unix ) With this design, I was able to test input file names with spaces and international characters for Windows. When the linker input is large enough, it creates a response file with the correct encoding. On a Mac, to test ld64, I temporarily changed Clang's behavior to always use response files regardless of the command size limit (avoiding using huge command line inputs). I tested clang with the LLVM test suite (compiling benchmarks) and it did fine. Test Plan: A LIT test that tests proper response files support. This is tricky, since, for Unix systems, we need a 2MB response file, otherwise Clang will simply use regular arguments instead of a response file. To do this, my LIT test generate the file on the fly by cloning many -DTEST parameters until we have a 2MB file. I found out that processing 2MB of arguments is pretty slow, it takes 1 minute using my notebook in a debug build, or 10s in a Release build. Therefore, I also added "REQUIRES: long_tests", so it will only run when the user wants to run long tests. In the full discussion in http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20130408/171463.html, Rafael Espindola discusses a proper way to test llvm::sys::argumentsFitWithinSystemLimits(), and, there, Chandler suggests to use 10 times the current system limit (20MB resp file), so we guarantee that the system will always use response file, even if a new linux comes up that can handle a few more bytes of arguments. However, by testing with a 20MB resp file, the test takes long 8 minutes just to perform a silly check to see if the driver will use a response file. I found it to be unreasonable. Thus, I discarded this approach and uses a 2MB response file, which should be enough. Reviewers: asl, rafael, silvas Reviewed By: silvas Subscribers: silvas, rnk, thakis, cfe-commits Differential Revision: http://reviews.llvm.org/D4897 llvm-svn: 217792
* unique_ptrify JobList::JobsDavid Blaikie2014-09-041-11/+4
| | | | llvm-svn: 217168
* Add back the leading space when printing commands with -###Reid Kleckner2014-08-071-0/+1
| | | | | | This was an unintentional behavior change from r214924. llvm-svn: 215044
* Make crash diagnostics on Windows the tiniest bit more usefulReid Kleckner2014-08-051-1/+2
| | | | | | | | | | | | | | This escapes any backslashes in the executable path and fixes an issue with a trailing quote when the main file name had to be quoted during printing. It's impossible to test this without putting backslashes or quotes into the executable path, so I didn't add automated tests. The crash diagnostics are still only useful if you're using bash on Windows, though. This should probably be writing a batch file instead. llvm-svn: 214924
* Driver: Skip the -ivfsoverlay argument in driver crash diagsJustin Bogner2014-06-221-1/+1
| | | | llvm-svn: 211474
* [C++11] Use 'nullptr'. Driver edition.Craig Topper2014-05-171-2/+2
| | | | llvm-svn: 209069
* Driver: Skip the -fmodules-cache-path argument in driver crash diagsJustin Bogner2014-04-221-1/+2
| | | | | | | The modules cache path shouldn't be included in crash reports, as it's a system (or run) specific directory. llvm-svn: 206922
* clang-cl /fallback: turn the note into a warningHans Wennborg2014-02-191-2/+1
| | | | llvm-svn: 201626
* clang-cl /fallback: emit a note when falling backHans Wennborg2014-02-181-0/+8
| | | | | | This makes it a lot easier to see what's going on from the output. llvm-svn: 201604
* clang-cl: implement /fallback modeHans Wennborg2013-09-191-0/+37
| | | | | | | | | | | | | When this flag is enabled, clang-cl falls back to cl.exe if it cannot compile the code itself for some reason. The idea is to use this to help build projects that almost compile with clang-cl, except for some files that can then be built with the fallback mechanism. Differential Revision: http://llvm-reviews.chandlerc.com/D1711 llvm-svn: 191034
* Add comment about exporting clang::driver::ArgStringList,Hans Wennborg2013-09-181-2/+2
| | | | | | | | | | as suggested by Jordan on IRC. Also, use the unqualified name in Job.cpp. And while we're here, refer to StringRef with the unqualified name, because we have a using directive for that too. llvm-svn: 190909
* Revert r190902 and r190906Hans Wennborg2013-09-181-2/+3
| | | | | | The first one broke the build, and the latter one made it worse. llvm-svn: 190907
* Revert "Move using directive from Job.h to Job.cpp" (r190902)Hans Wennborg2013-09-181-1/+0
| | | | | | | | | | Seems like it was intentional to export ArgStringList as driver::ArgStringList, and e.g. examples/clang-interpreter/main.cpp uses it this way. However, exporting it with a typedef seems like a more common way to do it. llvm-svn: 190906
* Move using directive from Job.h to Job.cppHans Wennborg2013-09-171-3/+3
| | | | | | I don't think it belongs in the header, but seems handy in the .cpp file. llvm-svn: 190902
* Move the execution code from Compilation::ExecuteCommand to Command::ExecuteHans Wennborg2013-09-121-0/+14
| | | | | | | | | | | | | | I think it makes sense that a Command knows how to execute itself. There's no functionality change but i rewrote the code to avoid the manual memory management of Argv. My motivation for this is that I plan to subclass Command to build fall-back functionality into clang-cl. Differential Revision: http://llvm-reviews.chandlerc.com/D1654 llvm-svn: 190621
* Move Compilation::PrintJob and PrintDiagnosticJob into Job::Print.Hans Wennborg2013-09-121-2/+98
| | | | | | | | | | | | | | | | | This moves the code to Job.cpp, which seems like a more natural fit, and replaces the "is this a JobList? is this a Command?" logic with a virtual function call. It also removes the code duplication between PrintJob and PrintDiagnosticJob and simplifies the code a little. There's no functionality change here, except that the Executable is now always printed within quotes, whereas it would previously not be quoted in crash reports, which I think was a bug. Differential Revision: http://llvm-reviews.chandlerc.com/D1653 llvm-svn: 190620
* Remove unused method Job::AddCommand.Hans Wennborg2013-09-061-5/+0
| | | | | | | | I was going to update the comment referring to PipedJob, which was removed some time ago, but then it turned out that this method is not actually used at all. llvm-svn: 190171
* [Driver] Refactor clang driver to use LLVM's Option libraryReid Kleckner2013-06-141-5/+4
| | | | | | | | | | | | | | | | | | The big changes are: - Deleting Driver/(Arg|Opt)* - Rewriting includes to llvm/Option/ and re-sorting - 'using namespace llvm::opt' in clang::driver - Fixing the autoconf build by adding option everywhere As discussed in the review, this change includes using directives in header files. I'll make follow up changes to remove those in favor of name specifiers. Reviewers: espindola Differential Revision: http://llvm-reviews.chandlerc.com/D975 llvm-svn: 183989
* Sort all of Clang's files under 'lib', and fix up the broken headersChandler Carruth2012-12-041-2/+0
| | | | | | | | | | | | | uncovered. This required manually correcting all of the incorrect main-module headers I could find, and running the new llvm/utils/sort_includes.py script over the files. I also manually added quite a few missing headers that were uncovered by shuffling the order or moving headers up to be main-module-headers. llvm-svn: 169237
* Unweaken vtables as per ↵David Blaikie2011-12-201-0/+2
| | | | | | http://llvm.org/docs/CodingStandards.html#ll_virtual_anch llvm-svn: 146959
* When the compiler crashes, the compiler driver now produces diagnostic Chad Rosier2011-08-021-0/+6
| | | | | | | | | information including the fully preprocessed source file(s) and command line arguments. The developer is asked to attach this diagnostic information to a bug report. rdar://9575623 llvm-svn: 136702
* Temporarily revert r135614 while I fix the cmake build.Chad Rosier2011-07-201-6/+0
| | | | llvm-svn: 135621
* When the compiler crashes, the compiler driver now produces diagnostic ↵Chad Rosier2011-07-201-0/+6
| | | | | | | | | information including the fully preprocessed source file(s) and command line arguments. The developer is asked to attach this diagnostic information to a bug report. llvm-svn: 135614
* Remove stray emacs mode markers in all these files that was causing emacs toNick Lewycky2010-12-311-1/+1
| | | | | | | open them in fundamental-mode instead of c++-mode. Also twiddle whitespace for consistency in ToolChains.cpp. llvm-svn: 122646
* Driver: Eliminate PipedJob, which is now unused.Daniel Dunbar2010-08-021-11/+1
| | | | llvm-svn: 110014
* Driver: Free jobs in JobList and PipedJob instances.Daniel Dunbar2010-03-111-0/+10
| | | | llvm-svn: 98261
* Driver: Add Command::Creator member variable, which tracks the tool that wasDaniel Dunbar2009-12-021-4/+5
| | | | | | used to create a particular command. llvm-svn: 90287
* Remove tabs, and whitespace cleanups.Mike Stump2009-09-091-3/+3
| | | | llvm-svn: 81346
* Driver: Add Source argument for Commands to hold the Action which caused aDaniel Dunbar2009-07-011-2/+4
| | | | | | | Command to be generated, to support more advanced diagnostics. - No functionality change. llvm-svn: 74627
* Driver: ConstructJob also needs to know the destination (where to putDaniel Dunbar2009-03-181-0/+8
| | | | | | its commands). llvm-svn: 67179
* Driver: Rename Command::Argv to Command::Arguments to make it clearerDaniel Dunbar2009-03-181-2/+2
| | | | | | | that this does not include the implicit first argument (the executable name). llvm-svn: 67172
* Driver: Add simple Job classes, simple wrappers for information aboutDaniel Dunbar2009-03-131-0/+23
what processes to execute during a compilation. llvm-svn: 66985
OpenPOWER on IntegriCloud