summaryrefslogtreecommitdiffstats
path: root/clang/lib/Driver
Commit message (Collapse)AuthorAgeFilesLines
...
* [Driver] Unify linking of OpenMP runtime. NFCI.Jonas Hahnfeld2017-04-193-33/+22
| | | | | | | | While at it, extend test for FreeBSD and check for -lrt iff on Linux. Differential Revision: https://reviews.llvm.org/D30087 llvm-svn: 300689
* Add support for editor placeholders to ClangAlex Lorenz2017-04-191-0/+3
| | | | | | | | | | | | | | | | | | | | | This commit teaches Clang to recognize editor placeholders that are produced when an IDE like Xcode inserts a code-completion result that includes a placeholder. Now when the lexer sees a placeholder token, it emits an 'editor placeholder in source file' error and creates an identifier token that represents the placeholder. The parser/sema can now recognize the placeholders and can suppress the diagnostics related to the placeholders. This ensures that live issues in an IDE like Xcode won't get spurious diagnostics related to placeholders. This commit also adds a new compiler option named '-fallow-editor-placeholders' that silences the 'editor placeholder in source file' error. This is useful for an IDE like Xcode as we don't want to display those errors in live issues. rdar://31581400 Differential Revision: https://reviews.llvm.org/D32081 llvm-svn: 300667
* [modules-ts] Fold together -x c++ and -x c++-module at -cc1 level.Richard Smith2017-04-181-2/+18
| | | | | | | | | | | | | The driver needs to know whether it's building a module interface or implementation unit because it affects which outputs it produces and how it builds the command pipeline. But the frontend doesn't need to know and should not care: all it needs to know is what action it is being asked to perform on the input. (This is in preparation for permitting -emit-obj to be used on a module interface unit to produce object code without going via a "full" PCM file.) llvm-svn: 300611
* [AArch64][clang] Pass cpu/arch information to assembler for AArch64.Manoj Gupta2017-04-181-0/+6
| | | | | | | | | | | | | | | | Summary: Pass Cpu/Arch options to assembler for AArch64 with no-integrated-as. This fixes PR20019. Reviewers: richard.barton.arm, kristof.beyls, rengolin Reviewed By: rengolin Subscribers: srhines, pirama, aemerson, rengolin, cfe-commits Differential Revision: https://reviews.llvm.org/D32132 llvm-svn: 300571
* Driver: Better detection of mingw-gccMartell Malone2017-04-182-11/+14
| | | | | | | | | | | | | Stop blindly searching for "gcc.exe" on windows. Stop assuming "/usr" on unix, fixes cross compiling. Reviewers: mati865, yaron.keren Subscribers: ismail, rnk Differential revision: https://reviews.llvm.org/D15005 llvm-svn: 300555
* [ARM] Add hardware build attributes in assemblerOliver Stannard2017-04-181-0/+13
| | | | | | | | | | | | | | | | | This passes an option to the ARM assembly parser to emit build attributes for the hardware selected by command line options, when assembling an assembly file. This is not enabled for C/C++, as this would result in duplicate build attribute directives being emitted in each inline assembly block, when emitting assembly. This also adds an option to allow disabling this behaviour for assembly files, for users who were relying on the old behaviour. Differential revision: https://reviews.llvm.org/D31813 llvm-svn: 300550
* Make Gentoo GNU GCC Config override whitespace tolerantErich Keane2017-04-141-0/+1
| | | | | | | | | | | The config-*triple* file handling isn't tolerant of leading/trailing whitespace, making it not terribly obvious when a single extraneous tab/space/etc will cause the override to be ignored. This patch simply trims the lines to ensure that it is tolerant of whitespace. llvm-svn: 300328
* Update to match LLVM r300135.Richard Smith2017-04-121-1/+2
| | | | | | Remove "REQUIRES: long_tests" from test/Driver/response-file.c since it is now about 10x faster. (We can add that back if it's still too slow for some buildbot.) llvm-svn: 300136
* [Driver] Add compiler option to generate a reproducerBruno Cardoso Lopes2017-04-121-1/+4
| | | | | | | | | | | | | | | | | | | | | One way to currently test the reproducers is to setup "FORCE_CLANG_DIAGNOSTICS_CRASH=1" before invoking clang. This simulates a crash and produces the same contents needed by the reproducers. The reproducers are specially useful when triaging Modules issues, not only on crashes, but also for reproducing misleading warnings, errors, etc. Add a '-gen-reproducer' driver option to clang (or any similar name) and give users a flag option. Note that clang already has a -fno-crash-diagnostics, which disables the crash reproducers. I've decided not to propose "-fcrash-diagnostics" since it doesn't convey the ideia of reproduction despite a crash. rdar://problem/24114619 Differential Revision: https://reviews.llvm.org/D27604 llvm-svn: 300109
* [lsan] Enable LSan on arm Linux, clang partMaxim Ostapenko2017-04-111-1/+4
| | | | | | | | This is a compiler part of https://reviews.llvm.org/D29586. Enable LSan on arm Linux. Differential Revision: https://reviews.llvm.org/D31760 llvm-svn: 299921
* Toolchains: remove crtbegin on xwindowsSaleem Abdulrasool2017-04-071-9/+0
| | | | | | | | | | crtbegin is not really a proper windows support thing. This was duplicated when the toolchain was initially built. If the injection of crtbegin is needed, it can be done via the `/include` directive. Furthermore, since `-fPIC` doesnt make sense on PE/COFF, crtbegin and crtbeginS dont really need to be different. llvm-svn: 299800
* [Driver] Print a newline when invoking `-print-resource-dir`Meador Inge2017-04-051-1/+1
| | | | | | | | | The commit yesterday (r299473) to add the `-print-resource-dir` option was supposed to emit a newline after the resource dir. Differential Revision: https://reviews.llvm.org/D31447 llvm-svn: 299597
* [Driver] Add option to print the resource directoryMeador Inge2017-04-041-0/+5
| | | | | | | | | | | | This patch adds the option -print-resource-dir. It simply prints the resource directory. This information will eventually be used in compiler-rt to setup COMPILER_RT_LIBRARY_INSTALL_DIR. Patch by Catherine Moore! Differential Revision: https://reviews.llvm.org/D31447 llvm-svn: 299473
* [X86] Remove some code that tries to disable HLE feature. This feature flag ↵Craig Topper2017-04-041-1/+0
| | | | | | was removed from the backend. llvm-svn: 299416
* Add/update PIE defaults for OpenBSD.Brad Smith2017-03-311-1/+3
| | | | llvm-svn: 299269
* [XRay][clang] Fix the -fxray-instruction-threshold flag processingDean Michael Berris2017-03-301-3/+3
| | | | | | | | | | | | | | | Summary: The refactoring introduced a regression in the flag processing for -fxray-instruction-threshold which causes it to not get passed properly. This change should restore the previous behaviour. Reviewers: rnk, pelikan Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D31491 llvm-svn: 299126
* [XRay][clang] Use llvm::to_string instead of std::stringDean Michael Berris2017-03-301-1/+2
| | | | | | | | This should unbreak some bots. Follow-up on D30388. llvm-svn: 299044
* [XRay] Add -fxray-{always,never}-instrument= flags to clangDean Michael Berris2017-03-304-31/+125
| | | | | | | | | | | | | | | | | | | | | | Summary: The -fxray-always-instrument= and -fxray-never-instrument= flags take filenames that are used to imbue the XRay instrumentation attributes using a whitelist mechanism (similar to the sanitizer special cases list). We use the same syntax and semantics as the sanitizer blacklists files in the implementation. As implemented, we respect the attributes that are already defined in the source file (i.e. those that have the [[clang::xray_{always,never}_instrument]] attributes) before applying the always/never instrument lists. Reviewers: rsmith, chandlerc Subscribers: jfb, mgorny, cfe-commits Differential Revision: https://reviews.llvm.org/D30388 llvm-svn: 299041
* Add the -grecord-gcc-switches option and pass the flags down on the compile ↵Eric Christopher2017-03-291-2/+8
| | | | | | | | unit. Patch by Zhizhou Yang llvm-svn: 299037
* [ARM] Add a driver option for +no-neg-immediatesSanne Wouda2017-03-272-0/+6
| | | | | | | | | | | | Reviewers: olista01, rengolin, javed.absar, samparker Reviewed By: samparker Subscribers: samparker, llvm-commits, aemerson Differential Revision: https://reviews.llvm.org/D31197 llvm-svn: 298850
* [XRay][clang] Remove dependency on libatomic for XRay buildsDean Michael Berris2017-03-271-1/+0
| | | | | | | | | | | | | | | | Summary: This change depends on D31381 where we change the implementation to use sanitizer_common provided atomic operations library. Fixes http://llvm.org/PR32274. Reviewers: pelikan, dblaikie Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D31382 llvm-svn: 298835
* [XRay] Do not depend on C++ stdlib for XRay buildsDean Michael Berris2017-03-241-2/+0
| | | | | | | | | | | | | | Summary: Now that XRay doesn't require a runtime dependency on a C++ standard library, we remove that dependency from the clang linker flags. Reviewers: saugustine, pelikan Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D31313 llvm-svn: 298670
* Remove the -faltivec alias option and replace it with -maltivec everywhere.Eric Christopher2017-03-212-22/+10
| | | | | | | | | | | The alias was only ever used on darwin and had some issues there, and isn't used in practice much. Also fixes a problem with -mno-altivec not turning off -maltivec. Also add a diagnostic for faltivec/fno-altivec that directs users to use maltivec options and include the altivec.h file explicitly. llvm-svn: 298449
* Add support for -fno-auto-profile and -fno-profile-sample-useDehao Chen2017-03-213-2/+19
| | | | | | | | | | | | | | Summary: We need to be able to disable samplepgo for specific files by supporting -fno-auto-profile and -fno-profile-sample-use Reviewers: davidxl, dnovillo, echristo Reviewed By: echristo Subscribers: echristo, cfe-commits Differential Revision: https://reviews.llvm.org/D31213 llvm-svn: 298446
* [clang-cl] Fix cross-compilation with MSVC 2017.Zachary Turner2017-03-172-8/+87
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | clang-cl works best when the user runs vcvarsall to set up an environment before running, but even this is not enough on VC 2017 when cross compiling (e.g. using an x64 toolchain to target x86, or vice versa). The reason is that although clang-cl itself will have a valid environment, it will shell out to other tools (such as link.exe) which may not. Generally we solve this through adding the appropriate linker flags, but this is not enough in VC 2017. The cross-linker and the regular linker both link against some common DLLs, but these DLLs live in the binary directory of the native linker. When setting up a cross-compilation environment through vcvarsall, it will add *both* directories to %PATH%, so that when cl shells out to any of the associated tools, those tools will be able to find all of the dependencies that it links against. If you don't do this, link.exe will fail to run because the loader won't be able to find all of the required DLLs that it links against. To solve this we teach the driver how to spawn a process with an explicitly specified environment. Then we modify the PATH before shelling out to subtools and run with the modified PATH. Patch by Hamza Sood Differential Revision: https://reviews.llvm.org/D30991 llvm-svn: 298098
* Test commit.David Green2017-03-171-1/+1
| | | | llvm-svn: 298097
* enable -save-temps with -finclude-defult-headerGuansong Zhang2017-03-151-1/+13
| | | | | | | | | | | | | | | | | | | | | | | | Currently the two flags can not work together. To illustrate the issue, we can have an one line file a.cl contains only an empty function cat a.cl void test(){} Then use clang -v -save-temps -x cl -Xclang -cl-std=CL2.0 -Xclang -finclude-default-header -target amdgcn -S -c a.cl we will get redefinition errors for various things. The reason is that the -finclude-default-header flag is not meant to be on cc1 command other than the preprocessor. The fix is modeled after the code just below the change to filter the -finclude-default-header flag out when we are not in the preprocess phase. Differential Revision: https://reviews.llvm.org/D30743 llvm-svn: 297890
* Fix uninitialized value.Zachary Turner2017-03-151-1/+1
| | | | llvm-svn: 297881
* [Driver] Define macro __APPLE_EMBEDDED_SIMULATOR__ when optionAkira Hatanaka2017-03-151-3/+16
| | | | | | | | | | | | | | | | | -m(i|tv|watch)os-simulator-version-min is on the command line. Previously the driver would treat -m(i|tv|watch)os-simulator-version-min as an alias of -m(i|tv|watch)os-version-min. This no longer works since we now need to distinguish between the two options (the latter is used for iOS running in a VM, for example). This commit stops making the simulator options the aliases of the OS options and defines a macro to differentiate between the two groups of options. rdar://problem/28872911 llvm-svn: 297866
* Don't use MSVC Setup Api on MinGW.Zachary Turner2017-03-151-1/+6
| | | | llvm-svn: 297861
* Update clang-cl driver for MSVC 2017.Zachary Turner2017-03-153-249/+889
| | | | | | | | | | | | | | | | | 2017 changes the way you find an installed copy of Visual Studio as well as its internal directory layout. As a result, clang-cl was unable to find VS2017 even when you had run vcvarsall to set up a toolchain environment. This patch updates everything for 2017 and cleans up the way we handle a tiered search a la environment -> installation -> PATH for which copy of Visual Studio to bind to. Patch originally by Hamza Sood, with some fixups for landing. Differential Revision: https://reviews.llvm.org/D30758 llvm-svn: 297851
* [Driver] Restructure handling of -ffast-math and similar optionsJohn Brawn2017-03-151-124/+129
| | | | | | | | | | | | | | | | | | The way -ffast-math and the various related options to tweak floating-point handling are handled is inflexible and rather confusing. This patch restructures things so that we go through the options adjusting our idea of what's enabled as we go, instead of trying to figure each individual thing out by working backwards from the end, as this makes the behaviour of each individual option more clear. Doing it this way also means we get gcc-compatible behaviour for when the __FAST_MATH__ and __FINITE_MATH_ONLY__ macros are defined, as they should depend on the final set of features that are enabled and not just on -ffast-math and -ffinite-math-only specifically. Differential Revision: http://reviews.llvm.org/D30582 llvm-svn: 297837
* [Driver] Add flag to request arch-specific-subdir in -rpathPirama Arumuga Nainar2017-03-141-4/+0
| | | | | | | | | | | | | | | | | | Summary: This patch adds -f[no-]rtlib-add-rpath, which if enabled, embeds the arch-specific subdirectory in resource directory using -rpath (instead of doing so only during native compilation). This patch also re-enables test arch-specific-libdir.c which was silently unsupported because of the REQUIRES tag 'linux'. Reviewers: bkramer, rnk, mgorny Subscribers: srhines, cfe-commits Differential Revision: https://reviews.llvm.org/D30700 llvm-svn: 297751
* [ubsan] Add a nullability sanitizerVedant Kumar2017-03-142-6/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Teach UBSan to detect when a value with the _Nonnull type annotation assumes a null value. Call expressions, initializers, assignments, and return statements are all checked. Because _Nonnull does not affect IRGen, the new checks are disabled by default. The new driver flags are: -fsanitize=nullability-arg (_Nonnull violation in call) -fsanitize=nullability-assign (_Nonnull violation in assignment) -fsanitize=nullability-return (_Nonnull violation in return stmt) -fsanitize=nullability (all of the above) This patch builds on top of UBSan's existing support for detecting violations of the nonnull attributes ('nonnull' and 'returns_nonnull'), and relies on the compiler-rt support for those checks. Eventually we will need to update the diagnostic messages in compiler-rt (there are FIXME's for this, which will be addressed in a follow-up). One point of note is that the nullability-return check is only allowed to kick in if all arguments to the function satisfy their nullability preconditions. This makes it necessary to emit some null checks in the function body itself. Testing: check-clang and check-ubsan. I also built some Apple ObjC frameworks with an asserts-enabled compiler, and verified that we get valid reports. Differential Revision: https://reviews.llvm.org/D30762 llvm-svn: 297700
* Driver/ToolChains: Remove extra semicolons. NFCKonstantin Zhuravlyov2017-03-093-3/+3
| | | | llvm-svn: 297329
* Driver/ToolChains: Mips -> MipsLinuxKonstantin Zhuravlyov2017-03-084-6/+6
| | | | | | | | | - Mips is architecture, not a toolchain - Might help eliminate the confusion in the future by not having header files with the same name Differential Revision: https://reviews.llvm.org/D30753 llvm-svn: 297312
* [XRay] Use AddCXXStdlibLibArgs. NFCI.Jonas Hahnfeld2017-03-081-4/+3
| | | | | | This function already does the very same thing. llvm-svn: 297271
* [Driver] Consolidate tools and toolchains by target platform. (NFC)David L. Jones2017-03-0886-19213/+20919
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: (This is a move-only refactoring patch. There are no functionality changes.) This patch splits apart the Clang driver's tool and toolchain implementation files. Each target platform toolchain is moved to its own file, along with the closest-related tools. Each target platform toolchain has separate headers and implementation files, so the hierarchy of classes is unchanged. There are some remaining shared free functions, mostly from Tools.cpp. Several of these move to their own architecture-specific files, similar to r296056. Some of them are only used by a single target platform; since the tools and toolchains are now together, some helpers now live in a platform-specific file. The balance are helpers related to manipulating argument lists, so they are now in a new file pair, CommonArgs.h and .cpp. I've tried to cluster the code logically, which is fairly straightforward for most of the target platforms and shared architectures. I think I've made reasonable choices for these, as well as the various shared helpers; but of course, I'm happy to hear feedback in the review. There are some particular things I don't like about this patch, but haven't been able to find a better overall solution. The first is the proliferation of files: there are several files that are tiny because the toolchain is not very different from its base (usually the Gnu tools/toolchain). I think this is mostly a reflection of the true complexity, though, so it may not be "fixable" in any reasonable sense. The second thing I don't like are the includes like "../Something.h". I've avoided this largely by clustering into the current file structure. However, a few of these includes remain, and in those cases it doesn't make sense to me to sink an existing file any deeper. Reviewers: rsmith, mehdi_amini, compnerd, rnk, javed.absar Subscribers: emaste, jfb, danalbert, srhines, dschuff, jyknight, nemanjai, nhaehnle, mgorny, cfe-commits Differential Revision: https://reviews.llvm.org/D30372 llvm-svn: 297250
* Do not include GCC "resource" directory into the set of built-in include ↵Anton Korobeynikov2017-03-061-17/+1
| | | | | | | | | | paths on MingW. Patch by Mateusz Mikuła. Differential Revision: https://reviews.llvm.org/D29464 llvm-svn: 297005
* Add arch-specific directory to search pathPirama Arumuga Nainar2017-03-032-1/+37
| | | | | | | | | | | | | | | | | Summary: This change adds an arch-specific subdirectory in <ResourceDir>/lib/<OS> to the linker search path. This path also gets added as '-rpath' for native compilation if a runtime is linked in as a shared object. This allows arch-specific libraries to be installed alongside clang. Reviewers: danalbert, cbergstrom, javed.absar Subscribers: srhines Differential Revision: https://reviews.llvm.org/D30015 llvm-svn: 296927
* [PowerPC] Enable -fomit-frame-pointer by default for PPCNemanja Ivanovic2017-03-031-0/+3
| | | | | | | | | | | | As is the case on platforms like Mips, X86 and SystemZ, the -fomit-frame-pointer should be enabled by default on PPC when optimizing at -O1 and above. This brings the behaviour of LLVM on PPC in line with GCC. Committing on behalf of Hiroshi Inoue. Differential Revision: https://reviews.llvm.org/D29750 llvm-svn: 296861
* Driver: Update devtoolset usage for RHELTom Stellard2017-02-281-2/+1
| | | | | | | | | | | - remove path to dts-1.x (corresponds to gcc 4.7) - add path to dts-6 (corresponds to 6.x) Patch By: Maria Gottschalk Differential Revision: https://reviews.llvm.org/D29855 llvm-svn: 296485
* [ARM] Don't pass -arm-execute-only to cc1asChristof Douma2017-02-281-17/+20
| | | | | | | | | | | The option -mexecute-only is translated into the backend option -arm-execute-only. But this option only makes sense for the compiler and the assembler does not recognize it. This patch stops clang from passing this option to the assembler. Change-Id: I4f4cb1162c13cfd50a0a36702a4ecab1bc0324ba Review: https://reviews.llvm.org/D30414 llvm-svn: 296454
* Set ABIs correctly for OpenBSD/arm; soft float and aapcs-linux.Brad Smith2017-02-282-0/+6
| | | | llvm-svn: 296430
* enable -flto=thin in clang-clBob Haarman2017-02-271-2/+6
| | | | | | | | | | | | | | Summary: This enables LTO to be used with the clang-cl frontend. Reviewers: rnk, hans Reviewed By: hans Subscribers: pcc, cfe-commits, mehdi_amini, Prazek Differential Revision: https://reviews.llvm.org/D30239 llvm-svn: 296373
* [driver] Pass a resource dir without the '/../' part.Argyrios Kyrtzidis2017-02-251-1/+2
| | | | | | | This get the resource dir string to match with the one from libclang (which is not adding '/../'), and allows clang to accept a modules-enabled PCH that was created by libclang. llvm-svn: 296262
* [Driver] Enable SafeStack for Fuchsia targetsPetr Hosek2017-02-242-0/+8
| | | | | | | | | | | The runtime support is provided directly by the Fuchsia system C library. Patch by Roland McGrath Differential Revision: https://reviews.llvm.org/D30238 llvm-svn: 296082
* [Driver] Move architecture-specific free helper functions to their own files.David L. Jones2017-02-2410-1384/+1584
| | | | | | | | | | | | | | | | | | | | | | | | | | This patch moves helper functions that are CPU-specific out of Driver.cpp and to separate implementation files. The new files are named for the architecture, e.g. ARMArch.cpp. The next step after this will be to move OS-specific code, which I expect will include many of the tool implementations, to similarly separate files. Some CPU-specific functions are not being moved just yet. In cases where the only caller is the platform-specific tools, I plan to move them together. An example is Hexagon, where the only caller of the architecture-specific functions are the tools themselves. (I'm happy to revise this choice, it just seems like less churn to me.) This does mean that some functions which were previously static are now exposed through the library header Driver.h. Reviewers: rsmith, javed.absar Subscribers: aemerson, danalbert, srhines, dschuff, jyknight, nemanjai, mgorny, cfe-commits Differential Revision: https://reviews.llvm.org/D30315 llvm-svn: 296056
* Driver: inline a single caller of a function (NFC)Saleem Abdulrasool2017-02-191-9/+1
| | | | | | Inline the addCompilerRT call to the single caller. NFC. llvm-svn: 295620
* Always use --eh-frame-hdr on OpenBSD, even for -staticBrad Smith2017-02-191-1/+1
| | | | llvm-svn: 295614
OpenPOWER on IntegriCloud