summaryrefslogtreecommitdiffstats
path: root/clang/lib/Driver/Driver.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Driver: Use an early return instead of a long if condition (NFC)Justin Bogner2014-10-201-56/+55
| | | | | | | This just flattens an if block by returning early on the "else" condition. llvm-svn: 220235
* Driver: Make FailingCommand mandatory for generateCompilationDiagnosticsJustin Bogner2014-10-201-9/+4
| | | | | | | | | | | | | We currently use a null FailingCommand when generating crash reports as an indication that the cause is FORCE_CLANG_DIAGNOSTICS_CRASH, the environment variable that exists to test crash dumps. This means that our tests don't actually cover real crashes at all, and adds a more complicated code path that's only used in the tests. Instead, we can have the driver synthesize that every command failed and just call generateCompilationDiagnostics normally. llvm-svn: 220234
* CFE Knob for: Add a thread-model knob for lowering atomics on baremetal & ↵Jonathan Roelofs2014-10-031-3/+7
| | | | | | | | single threaded systems http://reviews.llvm.org/D4985 llvm-svn: 219027
* 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
* Driver: use range based for loopSaleem Abdulrasool2014-09-161-8/+6
| | | | | | Use a couple more range based for loops. NFC. llvm-svn: 217857
* Teach Clang how to use response files when calling other toolsReid Kleckner2014-09-151-2/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* clang-cl: Warn when a /TC or /TP argument is unusedEhsan Akhgari2014-09-121-2/+2
| | | | | | | | | | | | Test Plan: The patch includes a test case. Reviewers: hansw Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D5338 llvm-svn: 217710
* clang-cl: Don't treat linker input files differently when /TP or /TC is ↵Ehsan Akhgari2014-09-121-2/+11
| | | | | | | | | | | | | | | | specified. Summary: This fixes http://llvm.org/PR20923. Test Plan: This patch includes an automated test. Reviewers: hansw Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D5334 llvm-svn: 217699
* clang-cl: Add support for the /o option for object files, executables, and ↵Ehsan Akhgari2014-09-111-7/+19
| | | | | | | | | | | | | | | | | | | | | | | | | preprocessor output Summary: cl.exe recognizes /o as a deprecated and undocumented option similar to /Fe. This patch adds support for this option to clang-cl for /Fe, /Fo and /Fi. It also ensures that the last option among /o and /F* wins, if both specified. This is required at least for building autoconf based software, since autoconf uses -o to specify the executable output. This fixes http://llvm.org/PR20894. Test Plan: The patch includes automated tests. Reviewers: rnk Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D5308 llvm-svn: 217615
* Avoid some unnecessary SmallVector copies.Benjamin Kramer2014-09-111-1/+1
| | | | | | No functionality change. llvm-svn: 217586
* Only override the target architecture on -m32 and friends if it isJoerg Sonnenberger2014-09-101-1/+1
| | | | | | | | actually different. Fixes a surprising link error with nodejs on rpi, where armv6-netbsd-eabihf turned into armv5e-netbsd-eabihf, which doesn't lacks the necessary VFP support. llvm-svn: 217546
* unique_ptrify Driver Action handlingDavid Blaikie2014-08-291-31/+43
| | | | | | | | | | | | It hits a limit when we reach ActionList, which is used for dynamic conditional ownership, so we lose type safety there. This did expose at least one caller "lying" about ownership (passing ownership to an Action, then updating the Action to specify that it doesn't actually own the thing that was passed) - changing this to unique_ptr just makes that oddity more obvious. llvm-svn: 216713
* Update for llvm api change.Rafael Espindola2014-08-251-4/+4
| | | | llvm-svn: 216397
* Fix PR17239 by changing the semantics of the RemainingArgsClass Option kindReid Kleckner2014-08-221-2/+5
| | | | | | | | | | | | | | | | | | | | | | | This patch aims at fixing PR17239. This bug happens because the /link (clang-cl.exe argument) is marked as "consume all remaining arguments". However, when inside a response file, /link should only consume all remaining arguments inside the response file where it is located, not the entire command line after expansion. The LLVM side of the patch will change the semantics of the RemainingArgsClass kind to always consume only until the end of the response file when the option originally came from a response file. There are only two options in this class: dash dash (--) and /link. This is the Clang side of the patch in http://reviews.llvm.org/D4899 Reviewered By: rafael, rnk Differential Revision: http://reviews.llvm.org/D4900 Patch by Rafael Auler! llvm-svn: 216281
* [x32] Handle -m64/-m32 switches by Driver in x32 modePavel Chupin2014-08-181-4/+8
| | | | | | | | | | | | | | | | | Summary: Adding remaining 2 cases handling: * from x32 to 32 via -m32 * from x32 to 64 via -m64 Test Plan: linux-ld test updated Reviewers: chandlerc, atanasyan Subscribers: cfe-commits, zinovy.nis Differential Revision: http://reviews.llvm.org/D4930 llvm-svn: 215899
* Delete support for AuroraUX.Rafael Espindola2014-08-141-6/+1
| | | | | | auroraux.org is not resolving. llvm-svn: 215644
* Make crash diagnostics on Windows the tiniest bit more usefulReid Kleckner2014-08-051-0/+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
* AArch64: update Clang for merged arm64/aarch64 triples.Tim Northover2014-07-231-4/+0
| | | | | | | | | | | | | | The main subtlety here is that the Darwin tools still need to be given "-arch arm64" rather than "-arch aarch64". Fortunately this already goes via a custom function to handle weird edge-cases in other architectures, and it tested. I removed a few arm64_be tests because that really isn't an interesting thing to worry about. No-one using big-endian is also referring to the target as arm64 (at least as far as toolchains go). Mostly they date from when arm64 was a separate target and we *did* need a parallel name simply to test it at all. Now aarch64_be is sufficient. llvm-svn: 213744
* [PATCH] [x32] Introduce -mx32 flag enforcing x32 mode for other triplets. By ↵Zinovy Nis2014-07-111-4/+8
| | | | | | | | | | | | Pavel Chupin (@pavel.v.chupin). -mx32 flag setup target environment to GNUX32 and can be used for other 32/64-bit triplets (i386-unknown-linux, x86_64-unknown-linux) to turn on x32 mode. Compatible with GCC -mx32 flag. Differential Revision: http://reviews.llvm.org/D4470 llvm-svn: 212817
* Driver: Fix think-o in adding -ivfsoverlay flag to crashdumpsJustin Bogner2014-07-071-3/+5
| | | | | | | If there isn't a VFS to overlay we shouldn't be adding a -ivfsoverlay flag. llvm-svn: 212468
* Use the newly added FindInEnvPath helper in clangEhsan Akhgari2014-06-301-30/+1
| | | | llvm-svn: 212058
* Revert r211866, r211895 and r211995, "Driver: use GNU::Link for the ↵NAKAMURA Takumi2014-06-291-3/+0
| | | | | | | | | | | Generic_GCC toolchain". It broke users of Generic_GCC, cygwin and mingw32. It reverts commits as follows: r211866: "Driver: use GNU::Link for the Generic_GCC toolchain" r211895: "Replace GetProgramPath("ld") with GetLinkerPath()." r211995: "Driver: add a cygwin linker tool" llvm-svn: 211998
* Driver: add a cygwin linker toolSaleem Abdulrasool2014-06-291-0/+3
| | | | | | | | | This adds a linker tool for the Windows cygwin environment. This linker invocation is significantly different from the generic ld invocation. It requires additional parameters as well as does not accept some normal parameters. This should fix self-hosting on Cygwin. llvm-svn: 211995
* Driver: Pass -ivfsoverlay to module crashdumpsJustin Bogner2014-06-271-1/+8
| | | | | | | | When we create a crashdump involving modules, we build a VFS to reproduce the problem with. This updates the reproduction script to use that VFS. llvm-svn: 211876
* Driver: Fix a misleading comment and test for what it actually didJustin Bogner2014-06-261-1/+1
| | | | llvm-svn: 211806
* Driver: Remove trailing whitespaceJustin Bogner2014-06-261-2/+2
| | | | llvm-svn: 211805
* Driver: Restore proper naming of crashdump filesJustin Bogner2014-06-241-1/+2
| | | | | | Based on a review of r211411 by Jordan Rose. llvm-svn: 211572
* Driver: In crashdumps with -fmodule, dump the module dependenciesJustin Bogner2014-06-201-1/+6
| | | | llvm-svn: 211421
* Driver: Record that we're in crashdump and push flags to ConstructJobJustin Bogner2014-06-201-2/+0
| | | | | | | | | | | 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
* Make clang-cl accept .lib inputs (PR20065)Hans Wennborg2014-06-181-0/+34
| | | | | | | | | | Patch by Ehsan Akhgari! (Tiny tweak by me: renamed PathSegment to LibDir.) Differential Revision: http://reviews.llvm.org/D4192 llvm-svn: 211189
* Add support for the /Fi argument to clang-cl (PR20036)Hans Wennborg2014-06-171-1/+4
| | | | | | | | Patch by Ehsan Akhgari! Differential Revision: http://reviews.llvm.org/D4143 llvm-svn: 211081
* Add support for the /EP argument to clang-clHans Wennborg2014-06-131-1/+2
| | | | | | | | | | This maps the /EP argument to both -E and -P. Patch by Ehsan Akhgari! Differential Reviion: http://reviews.llvm.org/D4133 llvm-svn: 210935
* Replace llvm::error_code with std::error_code.Rafael Espindola2014-06-121-2/+1
| | | | llvm-svn: 210780
* Remove the last remaining llvm/Config/config.h includesAlp Toker2014-06-041-4/+1
| | | | | | | | | | | | This corrects long-standing misuses of LLVM's internal config.h. In most cases the public llvm-config.h header was intended and we can now remove the old hacks thanks to LLVM r210144. The config.h header is private, won't be installed and should no longer be included by clang or other modules. llvm-svn: 210145
* [C++11] Use 'nullptr'. Driver edition.Craig Topper2014-05-171-10/+11
| | | | llvm-svn: 209069
* Eliminate DefaultImageName from the Driver constructorAlp Toker2014-05-151-2/+1
| | | | | | | | | | | | All callers were passing in "a.out" or garbage so a sensible default works fine here as a cleanup. This also brings about the possibility of adapting the value based on the driver's compatibility mode in future. The setting can still be changed via Driver::DefaultImageName as needed. llvm-svn: 208926
* Fix clang-cl Driver leakHans Wennborg2014-05-021-2/+3
| | | | | | | We were synthesizing new arguments from e.g. '/Tcfile.c' arguments, but didn't handle ownership correctly. llvm-svn: 207880
* When Driver::generateCompilationDiagnostics is filtering the list ofPaul Robinson2014-04-281-3/+4
| | | | | | | inputs to the preprocessor, check for invalid types first because not all linker inputs have an option value to retrieve. llvm-svn: 207454
* [ARM64] Plumb in big-endian - add arm64_be to the many switches where it was ↵James Molloy2014-04-171-0/+4
| | | | | | missing. llvm-svn: 206462
* AArch64: Add command line option to select big or little endianChristian Pirker2014-04-101-3/+9
| | | | llvm-svn: 205966
* Simplify clang-cl's target triple settingHans Wennborg2014-03-281-3/+2
| | | | llvm-svn: 205051
* clang-cl wants MSVC-style win32Hans Wennborg2014-03-281-1/+3
| | | | | | | This should fix the clang-cl tests after the Windows target triple canonicalization (r204978) llvm-svn: 204985
* Use the new Windows environment for target detectionSaleem Abdulrasool2014-03-271-3/+22
| | | | | | | | | This follows the LLVM change to canonicalise the Windows target triple spellings. Rather than treating each Windows environment as a single entity, the environments are now modelled properly as an environment. This is a mechanical change to convert the triple use to reflect that change. llvm-svn: 204978
* Fix an logic error in the clang driver preventing crtfastmath.o from linking ↵Benjamin Kramer2014-03-251-0/+4
| | | | | | | | | | | | | | when -Ofast is used without -ffast-math In gcc using -Ofast forces linking of crtfastmath.o. In the current clang crtfastmath.o is only linked when -ffast-math/-funsafe-math-optimizations passed. It can lead to performance issues, when using only -Ofast without explicit -ffast-math (I faced with it). My patch fixes inconsistency with gcc behaviour and also introduces few tests on it. Patch by Zinovy Nis! Differential Revision: http://llvm-reviews.chandlerc.com/D3114 llvm-svn: 204742
* Only allow streaming exactly type 'bool' to a DiagnosticBuilder, not anythingRichard Smith2014-03-121-2/+2
| | | | | | | that implicitly converts to 'bool' (such as pointers, and the first operand of ?:). Clean up issues found by this. Patch by Stephan Tolksdorf! llvm-svn: 203735
* [C++11] Replace OwningPtr include with <memory>.Ahmed Charles2014-03-091-1/+1
| | | | llvm-svn: 203389
* Replace OwningPtr with std::unique_ptr.Ahmed Charles2014-03-071-1/+1
| | | | | | This compiles cleanly with lldb/lld/clang-tools-extra/llvm. llvm-svn: 203279
* Change OwningPtr::take() to OwningPtr::release().Ahmed Charles2014-03-071-3/+3
| | | | | | This is a precursor to moving to std::unique_ptr. llvm-svn: 203275
* Update for LLVM API changeSaleem Abdulrasool2014-03-061-1/+1
| | | | | | | Use the new getObjectFormat/setObjectFormat instead of Environment now that the file format is a separate field. llvm-svn: 203161
* [C++11] Replace llvm::tie with std::tie.Benjamin Kramer2014-03-021-2/+2
| | | | llvm-svn: 202639
OpenPOWER on IntegriCloud