summaryrefslogtreecommitdiffstats
path: root/clang/lib/Driver/Tools.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Add driver flags -ftrigraphs, -fno-trigraphs.Nico Weber2014-12-231-2/+5
| | | | | | | | | | | | | | | | | -trigraphs is now an alias for -ftrigraphs. -fno-trigraphs makes it possible to explicitly disable trigraphs, which couldn't be done before. clang -std=c++11 -fno-trigraphs now builds without GNU extensions, but with trigraphs disabled. Previously, trigraphs were only disabled in GNU modes or with -std=c++1z. Make the new -f flags the cc1 interface too. This requires changing -trigraphs to -ftrigraphs in a few cc1 tests. Related to PR21974. llvm-svn: 224790
* Reapply "Change -save-temps to emit unoptimized bitcode files."Bob Wilson2014-12-211-6/+17
| | | | | | | | | | | | | | | | | | | | | | | | This reapplies r224503 along with a fix for compiling Fortran by having the clang driver invoke gcc (see r224546, where it was reverted). I have added a testcase for that as well. Original commit message: It is often convenient to use -save-temps to collect the intermediate results of a compilation, e.g., when triaging a bug report. Besides the temporary files for preprocessed source and assembly code, this adds the unoptimized bitcode files as well. This adds a new BackendJobAction, which is mostly mechanical, to run after the CompileJobAction. When not using -save-temps, the BackendJobAction is combined into one job with the CompileJobAction, similar to the way the integrated assembler is handled. I've implemented this entirely as a driver change, so under the hood, it is just using -disable-llvm-optzns to get the unoptimized bitcode. Based in part on a patch by Steven Wu. rdar://problem/18909437 llvm-svn: 224688
* Driver: hoist an assertionSaleem Abdulrasool2014-12-191-10/+4
| | | | | | | Remove an unnecessary conditional, hoisting the assertion. Minor style tweaks/reflowing. NFC. llvm-svn: 224654
* Driver: refactor a local variableSaleem Abdulrasool2014-12-191-10/+10
| | | | | | | Pull out a getToolChain() into a local variable to share the call across to all the uses. NFC. llvm-svn: 224653
* Revert "Change -save-temps to emit unoptimized bitcode files."Reid Kleckner2014-12-181-17/+6
| | | | | | | | | | This reverts commit r224503. It broke compilation of fortran through the Clang driver. Previously `clang -c t.f` would invoke `gcc t.f` and `clang -cc1as`, but now it tries to call `clang -cc1 t.f` which fails for obvious reasons. llvm-svn: 224546
* Correction to -mfu=neon-vfpv4 to pass the correct backend feature nameRichard Barton2014-12-181-2/+2
| | | | | Change-Id: I4dbfe1d97670fc4e626368ef1f91fc008778dfca llvm-svn: 224523
* Change -save-temps to emit unoptimized bitcode files.Bob Wilson2014-12-181-6/+17
| | | | | | | | | | | | | | | | | | | It is often convenient to use -save-temps to collect the intermediate results of a compilation, e.g., when triaging a bug report. Besides the temporary files for preprocessed source and assembly code, this adds the unoptimized bitcode files as well. This adds a new BackendJobAction, which is mostly mechanical, to run after the CompileJobAction. When not using -save-temps, the BackendJobAction is combined into one job with the CompileJobAction, similar to the way the integrated assembler is handled. I've implemented this entirely as a driver change, so under the hood, it is just using -disable-llvm-optzns to get the unoptimized bitcode. Based in part on a patch by Steven Wu. rdar://problem/18909437 llvm-svn: 224503
* Reinstate aapcs as the default arm abi.Eric Christopher2014-12-181-3/+4
| | | | llvm-svn: 224490
* Add a new flag, -fspell-checking-limit=<number> to control how many times ↵Nick Lewycky2014-12-161-1/+5
| | | | | | | | we'll do spell checking. Note that spell checking will change the produced AST, so we don't automatically change this value when someone sets -ferror-limit=. With this, merge test typo-correction-pt2.cpp into typo-correction.cpp. Remove Sema::UnqualifiedTyposCorrected, a cache of corrected typos. It would only cache typo corrections that didn't provide ValidateCandidate of which there were few left, and it had a bug when we had the same identifier spelled wrong twice. See the last two tests in typo-correction.cpp for cases this fires. llvm-svn: 224375
* Add a FIXME for unifying ARM target abi handling.Eric Christopher2014-12-101-0/+1
| | | | llvm-svn: 223977
* Revert the default changing behavior part of r216662 until weEric Christopher2014-12-101-4/+3
| | | | | | | | can change the backend to be the same default. Leave the modified/new testcases with the exception of the default behavior since it increases our testing footprint. llvm-svn: 223976
* Revert "Driver: Objective-C should respect -fno-exceptions"David Majnemer2014-12-091-14/+25
| | | | | | | | This reverts commit r223455. It's been succesfully argued that -fexceptions (at the driver level) is a misnomer and has little to do with -fobjc-exceptions. llvm-svn: 223723
* Driver: Objective-C should respect -fno-exceptionsDavid Majnemer2014-12-051-25/+14
| | | | | | | | | | | | Clang attempted to replicate a GCC bug: -fobjc-exceptions forces -fexceptions to be enabled. However, this has unintended effects and other awkard side effects that Clang doesn't "correctly" ape (e.g. it's impossible to turn off C++ exceptions in ObjC++ mode). Instead, -f[no]objc-exceptions and -f[no]cxx-exceptions now have an identical relationship with -f[no]exceptions. llvm-svn: 223455
* Driver: Cleanup -fexceptions behaviorDavid Majnemer2014-12-051-48/+15
| | | | | | | No functionality change is intended, just a cleanup of the logic clang uses to determine what -fexceptions/-fno-exceptions ends up doing. llvm-svn: 223453
* Use isOSBinFormatMachO() instead of comparing the object formatEric Christopher2014-12-051-2/+1
| | | | | | against an enum. llvm-svn: 223422
* Remove special case for aarch64 static vs. PIC code in iOS kernel code.Bob Wilson2014-12-021-2/+1
| | | | | | | | | | I added this check a while back but then made a note to myself that it should be completely unnecessary since iOS always uses PIC code-gen for aarch64. Since I could never come up with any reason why it would be necessary, I'm just going to remove it and we'll see if anything breaks. rdar://problem/13627985 llvm-svn: 223097
* Make -fuse-ld=lld work properly on Windows.Zachary Turner2014-12-011-4/+20
| | | | | | | | | | | | Using lld on Windows requires calling link-lld.exe instead of lld.exe. This patch puts this knowledge into clang so that when using the GCC style clang driver, it can properly delegate to lld. Differential Revision: http://reviews.llvm.org/D6428 Reviewed by: Reid Kleckner, Rui Ueyama llvm-svn: 223086
* Add additional arguments for -mfpu optionsRichard Barton2014-11-281-0/+3
| | | | | | | | | Add neon-vfpv3 to allow specifying both at the same time. This is not an option that GCC supports, but follows the same track and should be non-controversial. Change-Id: Id9ec157c835937d7d11ad0f49dbe5171fac17658 llvm-svn: 222933
* Add -mfpu=neon-vfpv4Richard Barton2014-11-281-0/+3
| | | | | | | This enables user to architecturally specify ARMv7A + VFPv4 + NEON. Change-Id: I779b01fef5c47e5e4ac702ae24ed2f76a0e4c63f llvm-svn: 222932
* [Sanitizer] Parse and produce all sanitizer-relevant arguments in SanitizerArgs.Alexey Samsonov2014-11-161-9/+0
| | | | | | | | | | | | | In particular, make SanitizerArgs responsible for parsing and passing down to frontend -fsanitize-recover and -fsanitize-undefined-trap-on-error flags. Simplify parsing -f(no-)sanitize= flags parsing: get rid of too complex filterUnsupportedKinds function. No functionality change. llvm-svn: 222105
* Remove -fseh-exceptions in favor of checking the tripleReid Kleckner2014-11-141-2/+0
| | | | | | | | | This option was misleading because it looked like it enabled the language feature of SEH (__try / __except), when this option was really controlling which EH personality function to use. Mingw only supports SEH and SjLj EH on x86_64, so we can simply do away with this flag. llvm-svn: 221963
* [Profile] Always build profile runtime library with -fPIC.Alexey Samsonov2014-11-141-9/+3
| | | | | | | | | This change removes libclang_rt.profile-pic-<arch>.a version of profile runtime. Instead, it's sufficient to always build libclang_rt.profile-<arch>.a with -fPIC, as it can be linked into both executables and shared objects. llvm-svn: 221952
* AArch64: set all processor features from -arch if nothing else presentTim Northover2014-11-101-0/+6
| | | | | | | | | | Darwin's "-arch arm64" option implies full Cyclone CPU, for both architectural and tuning purposes. So if neither of the explicit options have been given, forward that on to the proper invocation. rdar://problem/18906227 llvm-svn: 221631
* Fix clash of gcc toolchains in hexagon driver regression tests.Samuel Antao2014-11-071-2/+2
| | | | | | If clang was configured with a custom gcc toolchain (either by using GCC_INSTALL_PREFIX in cmake or the equivalent configure command), the path to the custom gcc toolchain path takes precedence to the one specified by -ccc-install-dir. This causes several regression tests to fail as they will be using an unexpected path. Adding the switch --gcc-toolchain="" in each test command is not enough as the hexagon toolchain implementation in the driver is not evaluating this argument. This commit modifies the hexagon toolchain to take the --gcc-toolchain="" argument into account when deciding the toolchain path, similarly to what is already done for other targets toolchains. Additionally, the faulty regression tests are modified in order to --gcc-toolchain="" be passed to the commands. llvm-svn: 221535
* Remove references to the cortex-a9-mp CPU.Charlie Turner2014-11-061-1/+1
| | | | | | | | | | This CPU definition is redundant. The Cortex-A9 is defined as supporting multiprocessing extensions. Remove references to this CPU. This CPU was recently removed from LLVM. See http://reviews.llvm.org/D6057 Change-Id: I62ae7cc656fcae54fbaefc4b6976e77e694a8678 llvm-svn: 221458
* Use backslashes to escape spaces and other backslashes in -dwarf-debug-flags.Bob Wilson2014-11-041-2/+23
| | | | | | | | | | The command line options are specified in a space-separated list that is an argument to -dwarf-debug-flags, so that breaks if there are spaces in the options. This feature came from Apple's internal version of GCC, so I went back to check how llvm-gcc handled this and matched that behavior. rdar://problem/18775420 llvm-svn: 221309
* Driver: remove a stray s that propagated in cross-windowsSaleem Abdulrasool2014-10-281-1/+1
| | | | | | The option is '--allow-multiple-definition' not '--allow-multiple-definitions'. llvm-svn: 220760
* [Thumb] Clang thinks "char" is signed when using a thumb tripleOliver Stannard2014-10-241-0/+2
| | | | | | | | 'char' is unsigned on all ARM and Thumb architectures. Clang gets this right for ARM, and for thumb when using and arm triple and the -mthumb option, but gets it wrong for thumb triples. This fixes that. llvm-svn: 220555
* Driver: add CrossWindowsToolChainSaleem Abdulrasool2014-10-241-1/+195
| | | | | | | | | | | | | | | | | | | | This is a very basic toolchain. It supports cross-compiling Windows (primarily inspired by the WoA target). It is meant to use clang with the LLVM IAS and a binutils ld-compatible interface for the linker (eventually to be lld). It does not perform any "standard" GCC lookup, nor does it perform any special adjustments given that it is expected to be used in an environment where the user is using MSVCRT (and as such Visual Studio headers) and the Windows SDK. The primary runtime library is expected to be compiler-rt and the C++ implementation to be libc++. It also expects that a sysroot has been setup given the usual Unix semantics (standard C headers in /usr/include, all the import libraries available in /usr/lib). It also expects that an entry point stub is present in /usr/lib (crtbegin.obj for executables, crtbeginS.obj for shared libraries). The entry point stub is responsible for running any GNU constructors. llvm-svn: 220546
* Revert r218541 - Don't link in sanitizer runtimes if ↵Alexey Samsonov2014-10-231-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | -nostdlib/-nodefaultlibs is provided. This is a sad thing to do, but all the alternatives look ugly. Looks like there are legitimate cases when users may want to link with sanitizer runtimes *and* -nodefaultlibs (and ensure they provide replacements for system libraries). For example, this happens in libc++ test suite. "-nodefaultlibs" is told to link only the libraries explicitly provided by the user, and providing "-fsanitize=address" is a clear indication of intention to link with ASan runtime. We can't easily introduce analogue of "-print-libgcc-name": linking with sanitizers runtimes is not trivial: some runtimes are split into several archive libraries, which are required to be wrapped in -whole-archive/-no-whole-archive. If "-fsanitize=whatever" and "-nodefaultlibs" are provided, system library dependencies of sanitizer runtimes (-lc/-ldl/-lpthread/-lrt) will *not* be linked, and user would have to link them in manually. Note that this can cause problems, as failing to provide "-lrt" might lead to crashes in runtime during ASan initialization. But looks like we should bite this bullet. See r218541 review thread for the discussion. llvm-svn: 220455
* Make a good guess about where MSVC and Windows SDK libraries are for linking.Zachary Turner2014-10-221-0/+33
| | | | | | | | | | | | | When a user has not configured a standard Visual Studio environment by running vcvarsall, clang tries its best to find Visual Studio include files and executables anyway. This patch makes clang also try to find system and Windows SDK libraries for linking against, as well. Reviewed by: Hans Wennborg Differential Revision: http://reviews.llvm.org/D5873 llvm-svn: 220425
* Resubmit "Improve Windows toolchain support for non-standard environments."Zachary Turner2014-10-221-32/+27
| | | | | | | | | | | | | | This resubmits change r220226. That change broke the chromium build bots because chromium it ships an hermetic MSVC toolchain that it expects clang to fallback to by finding it on the path. This patch fixes the issue by bumping up the prioritization of PATH when looking for MSVC binaries. Reviewed by: Hans Wennborg, Reid Kleckner Differential Revision: http://reviews.llvm.org/D5892 llvm-svn: 220424
* [modules] Initial support for explicitly loading .pcm files.Richard Smith2014-10-221-1/+5
| | | | | | | | | | | | | | | Implicit module builds are not well-suited to a lot of build systems. In particular, they fare badly in distributed build systems, and they lead to build artifacts that are not tracked as part of the usual dependency management process. This change allows explicitly-built module files (which are already supported through the -emit-module flag) to be explicitly loaded into a build, allowing build systems to opt to manage module builds and dependencies themselves. This is only the first step in supporting such configurations, and it should be considered experimental and subject to change or removal for now. llvm-svn: 220359
* Treat -g1 as -gline-tables-onlyHal Finkel2014-10-211-1/+2
| | | | | | | | | | | | | -g1 on gcc (and also IBM's xlc) are documented to be very similar to -gline-tables-only. Our -gline-tables-only might still be more verbose than -g1 on other compilers, but currently we treat -g1 as -g, and so we're producing much more debug info at -g1 than everybody else. Treating -g1 as -gline-tables-only brings us much closer to what everyone else is doing. For more information, see the discussion on http://lists.cs.uiuc.edu/pipermail/cfe-dev/2014-October/039649.html llvm-svn: 220311
* Revert "Improve Windows toolchain support for non-standard environments." ↵Hans Wennborg2014-10-201-51/+32
| | | | | | | | | | | | | | (r220226) In environments where PATH was set to point to the VS installation, Clang would override that by looking in the registry and finding the latest VS installation. If the environment is set up to point to a VS installation, that should take precedence. Reverting this until we can fix it. llvm-svn: 220243
* Driver: Consolidate the logic for naming the module crashdump cacheJustin Bogner2014-10-201-0/+3
| | | | | | | | List the module cache we use for crashdumps as a tempfile. This simplifies how we pick up this directory when generating the actual crash diagnostic and removes some duplicate logic. llvm-svn: 220241
* Improve Windows toolchain support for non-standard environments.Zachary Turner2014-10-201-32/+51
| | | | | | | | | | | | | | | | | | | | | Typically clang finds Visual Studio by the user explicitly setting up a Visual Studio environment via vcvarsall. But we still try to behave intelligently and fallback to different methods of finding Visual Studio when this is not done. This patch improves various fallback codepaths to make Visual Studio locating more robust. Specifically, this patch: * Adds support for searching environment variables for VS 12.0 * Correctly locates include folders for Windows SDK 8.x (this was previously broken, and would cause clang to error) * Prefers locating link.exe in the same location as cl.exe. This is helpful in case another link.exe is in the path earlier than Visual Studio (e.g. GnuWin32) * Minor cleanup in the registry reading code to make it more robust in the presence of long pathnames. llvm-svn: 220226
* PR21215: Support -fmodule-map-file being specified multiple times. SupportRichard Smith2014-10-171-8/+5
| | | | | | loading multiple module map files from the same directory. llvm-svn: 220020
* [AArch64] Enable A53 erratum workaround (835769) by default for Android targetsBradley Smith2014-10-161-0/+4
| | | | llvm-svn: 219933
* specify dwarf version for SolarisAlexander Eremin2014-10-161-4/+6
| | | | llvm-svn: 219901
* Adds support for the Cortex-A17 processor to ClangRenato Golin2014-10-131-1/+1
| | | | | | Patch by Matthew Wahab. llvm-svn: 219607
* [AArch64] Add workaround for Cortex-A53 erratum (835769)Bradley Smith2014-10-131-0/+9
| | | | | | | | | | | | | | | | | | | Some early revisions of the Cortex-A53 have an erratum (835769) whereby it is possible for a 64-bit multiply-accumulate instruction in AArch64 state to generate an incorrect result. The details are quite complex and hard to determine statically, since branches in the code may exist in some circumstances, but all cases end with a memory (load, store, or prefetch) instruction followed immediately by the multiply-accumulate operation. The safest work-around for this issue is to make the compiler avoid emitting multiply-accumulate instructions immediately after memory instructions and the simplest way to do this is to insert a NOP. This patch implements clang options to enable this workaround in the backend. The work-around code generation is not enabled by default. llvm-svn: 219604
* Hopefully fixes test failures for msvc.Dan Albert2014-10-101-2/+1
| | | | | | | | | Looks like llvm::sys::path::filename() was canonicalizing my paths before emitting them for FileCheck to stumble over. Fix a style nit with r219460 while I'm at it. llvm-svn: 219464
* PR21195: Emit .gcno files to the proper location.Dan Albert2014-10-101-1/+7
| | | | | | | | When building with coverage, -no-integrated-as, and -c, the driver was emitting -cc1 -coverage-file pointing at a file in /tmp. Ensure the coverage file is emitted in the same directory as the output file. llvm-svn: 219460
* Emit diagnostic for -munaligned-access on v6mJonathan Roelofs2014-10-071-2/+1
| | | | | | Patch by: Charlie Turner <charlie.turner@arm.com> llvm-svn: 219211
* CFE Knob for: Add a thread-model knob for lowering atomics on baremetal & ↵Jonathan Roelofs2014-10-031-0/+6
| | | | | | | | single threaded systems http://reviews.llvm.org/D4985 llvm-svn: 219027
* Revert changes in r218863, r218864Asiri Rathnayake2014-10-031-51/+7
| | | | | | | | | Summary: The changes introduced in the above two commits are giving a rough time to one of the build bots. Reverting the changes for the moment so that the bot can go green again. Change-Id: Id19f6cb2a8bc292631fac2262268927563d820c2 llvm-svn: 218970
* [ARM] Handle conflicts between -mfpu and -mfloat-abi options.Asiri Rathnayake2014-10-021-7/+51
| | | | | | | | | Summary: This patch implements warnings/downgradable errors for invalid -mfpu, -mfloat-abi option combinations (e.g. -mfpu=none -mfloat-abi=hard). Change-Id: I94fa664e1bc0b5855ad835abd7a50a3e0395632d llvm-svn: 218863
* [ARM] Add support for Cortex-M7, FPv5-SP and FPv5-DPOliver Stannard2014-10-011-1/+13
| | | | | | | | | The Cortex-M7 has 3 options for its FPU: none, FPv5-SP-D16 and FPv5-DP-D16. FPv5 has the same instructions as FP-ARMv8, so it can be modeled using the same target feature, and all double-precision operations are already disabled by the fp-only-sp target features. llvm-svn: 218748
* Enable both C and C++ modules with -fmodules, by switching -fcxx-modules toRichard Smith2014-09-301-4/+4
| | | | | | | | | | | | | | | | | being on by default. -fno-cxx-modules can still be used to enable C modules but not C++ modules, but C++ modules is not significantly less stable than C modules any more. Also remove some of the scare words from the modules documentation. We're certainly not going to remove modules support (though we might change the interface), and it works well enough to bootstrap and build lots of non-trivial code. Note that this does not represent a commitment to the current interface nor implementation, and we still intend to follow whatever direction the C and C++ committees take regarding modules support. llvm-svn: 218717
OpenPOWER on IntegriCloud