summaryrefslogtreecommitdiffstats
path: root/clang/lib/Driver/Compilation.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Driver: Remove the Job class. NFCJustin Bogner2015-07-021-10/+6
| | | | | | | | | | | 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: Use pointee_iterator rather than iterating over unique_ptrsJustin Bogner2014-10-031-3/+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-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Fix some cases where StringRef was being passed by const reference. Remove ↵Craig Topper2014-08-301-2/+2
| | | | | | const from some other StringRefs since its implicitly const already. llvm-svn: 216825
* Update for llvm api change.Rafael Espindola2014-08-251-4/+4
| | | | llvm-svn: 216397
* Remove unused sys/stat.h includesAlp Toker2014-07-071-2/+0
| | | | | | The facility was abstracted to LLVM in r187364. llvm-svn: 212441
* Driver: Record that we're in crashdump and push flags to ConstructJobJustin Bogner2014-06-201-3/+5
| | | | | | | | | | | It's more flexible and arguably better layering to set flags to modify compiling for diagnostics in the CC1 job themselves, rather than tweaking the driver flags and letting them propagate. There is one visible change this causes: crash report files will now get preprocessed names (.i and friends). llvm-svn: 211411
* Replace llvm::error_code with std::error_code.Rafael Espindola2014-06-121-1/+1
| | | | llvm-svn: 210780
* [C++11] Use 'nullptr'. Driver edition.Craig Topper2014-05-171-3/+3
| | | | llvm-svn: 209069
* Update for llvm api change.Rafael Espindola2014-02-241-1/+2
| | | | llvm-svn: 202053
* Remove a whole lot of unused variablesAlp Toker2013-11-271-2/+0
| | | | | | | There are about 30 removed in this patch, generated by a new FixIt I haven't got round to submitting yet. llvm-svn: 195814
* Move the execution code from Compilation::ExecuteCommand to Command::ExecuteHans Wennborg2013-09-121-11/+1
| | | | | | | | | | | | | | 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-132/+1
| | | | | | | | | | | | | | | | | 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 the -ccc-echo option that is now unused.Rafael Espindola2013-07-231-1/+1
| | | | llvm-svn: 186970
* Update for llvm API change.Rafael Espindola2013-07-161-3/+2
| | | | llvm-svn: 186448
* Convert last use of PathV1.h in Compilation.cppRafael Espindola2013-06-241-17/+20
| | | | | | | | The way we decide which file to remove is fairly odd. I took a quick look at maybe changing that, but it would be a more work than I want to put at this right now, so I left pair of FIXMEs. llvm-svn: 184766
* Convert a use of PathV1.hRafael Espindola2013-06-241-2/+2
| | | | llvm-svn: 184753
* Use llvm::sys::fs::can_write.Rafael Espindola2013-06-181-1/+2
| | | | llvm-svn: 184234
* Include PathV1.h only where it is used.Rafael Espindola2013-06-171-0/+1
| | | | llvm-svn: 184090
* [Driver] Refactor clang driver to use LLVM's Option libraryReid Kleckner2013-06-141-1/+2
| | | | | | | | | | | | | | | | | | 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
* Use the sys::ExecuteAndWait that takes StringRefs.Rafael Espindola2013-06-131-4/+5
| | | | | | Also don't depend on Program.h including PathV1.h. llvm-svn: 183935
* Use the global functions instead of the Program methods.Rafael Espindola2013-06-121-5/+3
| | | | llvm-svn: 183861
* [driver] Do not generate crash diagnostics if the compilation command failedChad Rosier2013-03-261-2/+3
| | | | | | | to execute as the crash will surely reoccur while generating the diagnostics. rdar://13362359 llvm-svn: 178089
* [driver] The failure of any phase (e.g., preprocess, compile, assemble) for aChad Rosier2013-02-271-1/+28
| | | | | | | | | single translation unit should prevent later phases from executing. Otherwise, this generates lots of noise in build systems. This a fallout from r173825. Patch by Matthew Curtis <mcurtis@codeaurora.org>. rdar://13298009 llvm-svn: 176198
* Form the default -fmodules-cache-path= properly.Douglas Gregor2013-02-071-1/+1
| | | | llvm-svn: 174674
* [driver] Clear the FailureResultFiles when initializing clang diagnostics. Also,Chad Rosier2013-01-291-0/+1
| | | | | | minor cleanup. llvm-svn: 173852
* [driver] Refactor the driver so that a failing commands doesn't preventChad Rosier2013-01-291-8/+8
| | | | | | | | | | | subsequent commands from being executed. The diagnostics generation isn't designed for this use case, so add a note to fix this in the very near future. For now, just generated the diagnostics for the first failing command. Part of rdar://12984531 llvm-svn: 173825
* [driver] Associate a JobAction with each result file. This enables the driverChad Rosier2013-01-241-25/+42
| | | | | | | to delete result files for only those commands that fail. Part of rdar://12984531 llvm-svn: 173361
* [Driver] Don't remove non-regular files that were outputs.Daniel Dunbar2013-01-231-3/+3
| | | | llvm-svn: 173215
* Sort all of Clang's files under 'lib', and fix up the broken headersChandler Carruth2012-12-041-4/+2
| | | | | | | | | | | | | 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
* Use empty parens for empty function parameter list instead of '(void)'.Dmitri Gribenko2012-11-151-2/+2
| | | | llvm-svn: 168041
* [driver] Remove an extra space with the -iprefix option, so thatChad Rosier2012-10-311-1/+1
| | | | | | | matching works correctly. Part of rdar://12329974 llvm-svn: 167173
* [driver] Remove an extra space with the -internal-externc-isystem option, soChad Rosier2012-10-311-1/+1
| | | | | | | that matching works correctly. Part of rdar://12329974 llvm-svn: 167161
* [driver] Completely rework how superfluous options are stripped out of the crashChad Rosier2012-10-311-0/+100
| | | | | | | | | | | | diagnostics script. This addresses the FIXME pertaining to quoted arguments. We also delineate between those flags that have an argument (e.g., -D macro, -MF file) and those that do not (e.g., -M, -MM, -MG). Finally, we add the -dwarf-debug-flags to the list of flags to be removed. rdar://12329974 llvm-svn: 167152
* Use array_lengthof instead of sizeof trickery.Chad Rosier2012-05-031-2/+1
| | | | llvm-svn: 156104
* Canonicalize loop.Chad Rosier2012-05-031-1/+2
| | | | llvm-svn: 156093
* use DEFAULT_SYSROOTSebastian Pop2012-04-161-0/+4
| | | | llvm-svn: 154792
* Add the depfile as a result file so that it is deleted if we crash,Peter Collingbourne2011-11-061-2/+6
| | | | | | and prevent the diagnostic preprocessor run from writing a depfile. llvm-svn: 143846
* Use strpbrk(3) instead of open coding it.Benjamin Kramer2011-10-061-8/+1
| | | | llvm-svn: 141328
* [driver] For consistency, handle all shell special characters handled by theChad Rosier2011-10-051-1/+1
| | | | | | quoting code. llvm-svn: 141205
* [driver] The -v option doesn't quoted the command line arguments for historicalChad Rosier2011-10-051-1/+8
| | | | | | | reasons. However, it does seems practical to quote strings that need it. rdar://10221951 llvm-svn: 141202
* When the compiler crashes, the compiler driver now produces diagnostic Chad Rosier2011-08-021-4/+33
| | | | | | | | | 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
* Unbreak the MSVC build, using namespace clang is required otherwise MSVC ↵Francois Pichet2011-07-231-0/+2
| | | | | | will not find raw_ostream. llvm-svn: 135853
* remove unneeded llvm:: namespace qualifiers on some core types now that ↵Chris Lattner2011-07-231-2/+2
| | | | | | | | LLVM.h imports them into the clang namespace. llvm-svn: 135852
* Temporarily revert r135614 while I fix the cmake build.Chad Rosier2011-07-201-35/+4
| | | | llvm-svn: 135621
* When the compiler crashes, the compiler driver now produces diagnostic ↵Chad Rosier2011-07-201-4/+35
| | | | | | | | | 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
* Missing header from last commit; accidental change.John McCall2011-07-061-1/+0
| | | | llvm-svn: 134455
* Change the driver's logic about Objective-C runtimes: abstract out aJohn McCall2011-07-061-0/+1
| | | | | | | | | | | | structure to hold inferred information, then propagate each invididual bit down to -cc1. Separate the bits of "supports weak" and "has a native ARC runtime"; make the latter a CodeGenOption. The tool chain is still driving this decision, because it's the place that has the required deployment target information on Darwin, but at least it's better-factored now. llvm-svn: 134453
* Driver: When compilation fails, don't try to remove output files we don't haveDaniel Dunbar2011-04-251-0/+6
| | | | | | write access to. llvm-svn: 130150
* 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
OpenPOWER on IntegriCloud