summaryrefslogtreecommitdiffstats
path: root/clang/tools/driver
Commit message (Collapse)AuthorAgeFilesLines
...
* Rewrite the VS integration scripts.Zachary Turner2018-07-201-4/+0
| | | | | | | | | | | | | | | | | | | | | | | This is a new modernized VS integration installer. It adds a Visual Studio .sln file which, when built, outputs a VSIX that can be used to install ourselves as a "real" Visual Studio Extension. We can even upload this extension to the visual studio marketplace. This fixes a longstanding problem where we didn't support installing into VS 2017 and higher. In addition to supporting VS 2017, due to the way this is written we now longer need to do anything special to support future versions of VS as well. Everything should "just work". This also fixes several bugs with our old integration, such as MSBuild triggering full rebuilds when /Zi was used. Finally, we add a new UI page called "LLVM" which becomes visible when the LLVM toolchain is selected. For now this only contains one option which is the path to clang-cl.exe, but in the future we can add more things here. Differential Revision: https://reviews.llvm.org/D42762 llvm-svn: 337572
* Support -fdebug-prefix-map for assembler source (pass to cc1as). ThisPaul Robinson2018-07-101-0/+7
| | | | | | | | | | | is useful to omit the debug compilation dir when compiling assembly files with -g. Part of PR38050. Patch by Siddhartha Bagaria! Differential Revision: https://reviews.llvm.org/D48989 llvm-svn: 336685
* Factor out Clang's desired 8MB stack size constant from the variousRichard Smith2018-07-031-14/+8
| | | | | | places we hardcode it. llvm-svn: 336231
* [cmake] Add linker detection for Apple platformsShoaib Meenai2018-06-141-2/+2
| | | | | | | | | | | | | | | | LLVM currently assumes that Apple platforms will always use ld64. In the future, LLD Mach-O might also be supported, so add the beginnings of linker detection support. ld64 is currently the only detected linker, since `ld64.lld -v` doesn't yield any useful version output, but we can add that detection later, and in the meantime it's still useful to have the ld64 identification. Switch clang's order file check to use this new detection rather than just checking for the presence of an ld64 executable. Differential Revision: https://reviews.llvm.org/D48201 llvm-svn: 334780
* [cmake] Support LLD for CLANG_ORDER_FILEShoaib Meenai2018-06-021-2/+5
| | | | | | | | | | | | | | | | | LLD also supports order files using the `--symbol-ordering-file` option. As the name would suggest, the order file format is slightly different from gold; gold's order files specify section names, whereas LLD's specify symbol names. Assuming you have an order file in the correct format though, we should support using it with LLD. Switch the check to actually use LLVM's linker detection rather than just checking for the presence of the gold executable, since we might have a gold executable present but be using LLD (or bfd for that matter) as our linker. Differential Revision: https://reviews.llvm.org/D47669 llvm-svn: 333810
* [cmake] Use LLVM's check_linker_flagShoaib Meenai2018-06-021-8/+1
| | | | | | | LLVM already defines this function, so make use of it instead of rolling our own. llvm-svn: 333808
* Reland r332885, "CodeGen, Driver: Start using direct split dwarf emission in ↵Peter Collingbourne2018-05-221-14/+23
| | | | | | | | | clang." As well as two follow-on commits r332906, r332911 with a fix for test clang/test/CodeGen/split-debug-filename.c. llvm-svn: 333013
* Revert "CodeGen, Driver: Start using direct split dwarf emission in clang."Amara Emerson2018-05-221-23/+14
| | | | | | This reverts commit r332885 as it broke several greendragon buildbots. llvm-svn: 332973
* CodeGen, Driver: Start using direct split dwarf emission in clang.Peter Collingbourne2018-05-211-14/+23
| | | | | | | | Fixes PR37466. Differential Revision: https://reviews.llvm.org/D47093 llvm-svn: 332885
* MC: Change the streamer ctors to take an object writer instead of a stream. ↵Peter Collingbourne2018-05-181-2/+4
| | | | | | | | | | | | | | NFCI. The idea is that a client that wants split dwarf would create a specific kind of object writer that creates two files, and use it to create the streamer. Part of PR37466. Differential Revision: https://reviews.llvm.org/D47050 llvm-svn: 332749
* Remove \brief commands from doxygen comments.Adrian Prantl2018-05-091-1/+1
| | | | | | | | | | | | | | | | | | | This is similar to the LLVM change https://reviews.llvm.org/D46290. We've been running doxygen with the autobrief option for a couple of years now. This makes the \brief markers into our comments redundant. Since they are a visual distraction and we don't want to encourage more \brief markers in new code either, this patch removes them all. Patch produced by for i in $(git grep -l '\@brief'); do perl -pi -e 's/\@brief //g' $i & done for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done Differential Revision: https://reviews.llvm.org/D46320 llvm-svn: 331834
* [MC] Change AsmParser to leverage Assembler during evaluationNirav Dave2018-04-301-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | Teach AsmParser to check with Assembler for when evaluating constant expressions. This improves the handing of preprocessor expressions that must be resolved at parse time. This idiom can be found as assembling-time assertion checks in source-level assemblers. Note that this relies on the MCStreamer to keep sufficient tabs on Section / Fragment information which the MCAsmStreamer does not. As a result the textual output may fail where the equivalent object generation would pass. This can most easily be resolved by folding the MCAsmStreamer and MCObjectStreamer together which is planned for in a separate patch. Currently, this feature is only enabled for assembly input, keeping IR compilation consistent between assembly and object generation. Reviewers: echristo, rnk, probinson, espindola, peter.smith Reviewed By: peter.smith Subscribers: eraman, peter.smith, arichardson, jyknight, hiraditya, llvm-commits Differential Revision: https://reviews.llvm.org/D45164 llvm-svn: 331218
* IWYU for llvm-config.h in clang. See r331124 for details.Nico Weber2018-04-302-1/+1
| | | | llvm-svn: 331177
* s/LLVM_ON_WIN32/_WIN32/, clangNico Weber2018-04-271-2/+2
| | | | | | | | | | | LLVM_ON_WIN32 is set exactly with MSVC and MinGW (but not Cygwin) in HandleLLVMOptions.cmake, which is where _WIN32 defined too. Just use the default macro instead of a reinvented one. See thread "Replacing LLVM_ON_WIN32 with just _WIN32" on llvm-dev and cfe-dev. No intended behavior change. llvm-svn: 331069
* [MC] Undo spurious commit added into r331052.Nirav Dave2018-04-271-3/+0
| | | | llvm-svn: 331055
* [MC] Provide default value for IsResolved.Nirav Dave2018-04-271-0/+3
| | | | llvm-svn: 331052
* [MC] Modify MCAsmStreamer to always build MCAssembler. NFCI.Nirav Dave2018-04-271-13/+18
| | | | llvm-svn: 331048
* Link to AggressiveInstCombine in a few places. Unbreaks build for me.Roman Lebedev2018-04-241-0/+1
| | | | | | | | | | | | /usr/local/bin/ld.lld: error: undefined symbol: llvm::createAggressiveInstCombinerPass() >>> referenced by cc1_main.cpp >>> tools/clang/tools/driver/CMakeFiles/clang.dir/cc1_main.cpp.o:(_GLOBAL__sub_I_cc1_main.cpp) And so on The bot coverage is clearly missing. llvm-svn: 330694
* Use InitLLVM in clang as well.Rui Ueyama2018-04-131-15/+4
| | | | | | Differential Revision: https://reviews.llvm.org/D45634 llvm-svn: 330067
* Recommit r329442: Generate Libclang invocation reproducers using a newAlex Lorenz2018-04-073-0/+201
| | | | | | | | | | | | | | | | | | | | | | | | | | -cc1gen-reproducer driver option The recommit fixes: - An MSAN failure (CCPrintOptions wasn't initialized in the Driver) - Ensures that the strings in the libclang invocation files are escaped Original message: This commit is a follow up to the previous work that recorded Libclang invocations into temporary files: r319702. It adds a new -cc1 mode to clang: -cc1gen-reproducer. The goal of this mode is to generate Clang reproducer files for Libclang tool invocation. The JSON format in the invocation files is not really intended to be stable, so Libclang and Clang should be of the same version when generating reproducers. The new mode emits the information about the temporary files and Libclang-specific information to stdout using JSON. rdar://35322614 Differential Revision: https://reviews.llvm.org/D40983 llvm-svn: 329465
* Revert r329442 "Generate Libclang invocation reproducers using a newAlex Lorenz2018-04-063-201/+0
| | | | | | | | -cc1gen-reproducer driver option" The tests are failing on some bots llvm-svn: 329447
* Generate Libclang invocation reproducers using a new -cc1gen-reproducerAlex Lorenz2018-04-063-0/+201
| | | | | | | | | | | | | | | | | | | | driver option This commit is a follow up to the previous work that recorded Libclang invocations into temporary files: r319702. It adds a new -cc1 mode to clang: -cc1gen-reproducer. The goal of this mode is to generate Clang reproducer files for Libclang tool invocation. The JSON format in the invocation files is not really intended to be stable, so Libclang and Clang should be of the same version when generating reproducers. The new mode emits the information about the temporary files and Libclang-specific information to stdout using JSON. rdar://35322614 Differential Revision: https://reviews.llvm.org/D40983 llvm-svn: 329442
* [Driver] Avoid invalidated iterator in insertTargetAndModeArgsSerge Pavlov2018-03-191-4/+5
| | | | | | | | | | | | | | Doing an .insert() can potentially invalidate iterators by reallocating the vector's storage. When all the stars align just right, this causes segfaults or glibc aborts. Gentoo Linux bug (crashes while building Chromium): https://bugs.gentoo.org/650082. Patch by Hector Martin! Differential Revision: https://reviews.llvm.org/D44607 llvm-svn: 327863
* [Driver] Suggest valid integrated toolsBrian Gesiak2018-01-151-1/+2
| | | | | | | | | | | | | | | | | | | | | | Summary: There are only two valid integrated Clang driver tools: `-cc1` and `-cc1as`. If a user asks for an unknown tool, such as `-cc1asphalt`, an error message is displayed to indicate that there is no such tool, but the message doesn't indicate what the valid options are. Include the valid options in the error message. Test Plan: `check-clang` Reviewers: sepavloff, bkramer, phosek Reviewed By: bkramer Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D42004 llvm-svn: 322517
* [Driver] Add "did you mean?" suggestions to -cc1asBrian Gesiak2018-01-131-1/+7
| | | | | | | | | | | | | | | | | | | | | | Summary: In https://reviews.llvm.org/D41733, the driver was modified such that, when a user provided a mispelled option such as `-hel`, it would suggest a valid option with a nearby edit distance: "did you mean '-help'?". Add these suggestions to invocations of `clang -cc1as` as well. Test Plan: `check-clang` Reviewers: v.g.vassilev, bruno Reviewed By: v.g.vassilev Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D42001 llvm-svn: 322445
* Update clang cc1as for createMCAsmBackend change in r321692Alex Bradbury2018-01-031-3/+2
| | | | llvm-svn: 321693
* [clang] Use PRIVATE in target_link_librariesShoaib Meenai2017-12-061-1/+1
| | | | | | | I'd missed this one in r319840 because I hadn't been configuring with an order file before. llvm-svn: 319950
* [CMake] Use PRIVATE in target_link_libraries for executablesShoaib Meenai2017-12-051-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We currently use target_link_libraries without an explicit scope specifier (INTERFACE, PRIVATE or PUBLIC) when linking executables. Dependencies added in this way apply to both the target and its dependencies, i.e. they become part of the executable's link interface and are transitive. Transitive dependencies generally don't make sense for executables, since you wouldn't normally be linking against an executable. This also causes issues for generating install export files when using LLVM_DISTRIBUTION_COMPONENTS. For example, clang has a lot of LLVM library dependencies, which are currently added as interface dependencies. If clang is in the distribution components but the LLVM libraries it depends on aren't (which is a perfectly legitimate use case if the LLVM libraries are being built static and there are therefore no run-time dependencies on them), CMake will complain about the LLVM libraries not being in export set when attempting to generate the install export file for clang. This is reasonable behavior on CMake's part, and the right thing is for LLVM's build system to explicitly use PRIVATE dependencies for executables. Unfortunately, CMake doesn't allow you to mix and match the keyword and non-keyword target_link_libraries signatures for a single target; i.e., if a single call to target_link_libraries for a particular target uses one of the INTERFACE, PRIVATE, or PUBLIC keywords, all other calls must also be updated to use those keywords. This means we must do this change in a single shot. I also fully expect to have missed some instances; I tested by enabling all the projects in the monorepo (except dragonegg), and configuring both with and without shared libraries, on both Darwin and Linux, but I'm planning to rely on the buildbots for other configurations (since it should be pretty easy to fix those). Even after this change, we still have a lot of target_link_libraries calls that don't specify a scope keyword, mostly for shared libraries. I'm thinking about addressing those in a follow-up, but that's a separate change IMO. Differential Revision: https://reviews.llvm.org/D40823 llvm-svn: 319840
* Update cc1as_main for MCCodeEmitter ownership change in r315531.Lang Hames2017-10-111-1/+1
| | | | llvm-svn: 315532
* Update cc1as_main for MCAsmBackend ownership change in r315410.Lang Hames2017-10-111-2/+2
| | | | llvm-svn: 315411
* Put target deduced from executable name at the start of argument listSerge Pavlov2017-09-201-2/+9
| | | | | | | | | | When clang is called as 'target-clang', put deduced target option at the start of argument list so that option '--target=' specified in command line could override it. This change fixes PR34671. llvm-svn: 313760
* Use class to pass information about executable nameSerge Pavlov2017-08-291-18/+12
| | | | | | | | | | | | | Information about clang executable name components, such as target and driver mode, was passes in std::pair. With this change it is passed in a special structure. It improves readability and makes access to this information more convenient. NFC. Differential Revision: https://reviews.llvm.org/D36057 llvm-svn: 311981
* Update for llvm change.Rafael Espindola2017-08-021-1/+1
| | | | llvm-svn: 309885
* Update after LLVM change r309087George Rimar2017-07-261-1/+2
| | | | llvm-svn: 309088
* [Driver] Actually report errors during parsing instead of stopping when ↵Benjamin Kramer2017-06-301-1/+1
| | | | | | | | | | | | | | there's an error somewhere. This is a more principled version of r303756. That change was both very brittle about the state of the Diags object going into the driver and also broke tooling in funny ways. In particular it prevented tools from capturing diagnostics properly and made the compilation database logic fail to provide arguments to the tool, falling back to scanning directories for JSON files. llvm-svn: 306822
* Revert "Revert r305164/5/7."Saleem Abdulrasool2017-06-231-3/+16
| | | | | | | | | | | | | | | | | | | | | | | Restore the `-gz` option to the driver with some minor tweaks to handle the additional case for `-Wa,--compress-debug-sections`. This intends to make the compression of the debug information controllable from the driver. The following is the behaviour: -gz enable compression (ambiguous for format, will default to zlib-gnu) -gz=none disable compression -gz=zlib-gnu enable compression (deprecated GNU style zlib compression) -gz=zlib enable compression (zlib based compression) Although -Wa,-compress-debug-sections works, it should be discouraged when using the driver to invoke the assembler. However, we permit the assembler to accept the GNU as style argument --compress-debug-sections to maintain compatibility. Note, -gz/-gz= does *NOT* imply -g. That is, you need to additionally specific -g for debug information to be generated. llvm-svn: 306115
* [Driver] Do a PATH lookup if needed when using -no-canonical-prefixesPetr Hosek2017-06-161-2/+9
| | | | | | | | | | | | | When -no-canonical-prefixes option is used and argv0 contains only a program name, we need to do a PATH lookup to get an executable path, otherwise the return value won't be a valid path and any subsequent uses of it (e.g. when invoking -cc1) will fail with an error. This patch fixes PR9576. Differential Revision: https://reviews.llvm.org/D34290 llvm-svn: 305600
* Revert r305164/5/7.Daniel Jasper2017-06-121-16/+3
| | | | | | | | | | | | | | cc1as does not currently access the "--" version of this flag. At the very least this needs to be fixed and proper test cases need to be added. Simple reproducer: clang -Wa,--compress-debug-sections /tmp/test.cc Result: error: unknown argument: '--compress-debug-sections' llvm-svn: 305182
* Driver: add support for `-gz` and `-gz=`Saleem Abdulrasool2017-06-111-3/+16
| | | | | | | | | | | | | | | | | These options control the behaviour of the compression of debug info sections on ELF targets. Our behaviour slightly diverges from the behaviour of GCC. `-gz` maps to the `-compress-debug-sections` rather than `-compress-debug-sections=zlib` or `-compress-debug-sections=zlib-gnu`. This small divergence allows us to be compatible across versions of binutils (=zlib support was introduced in 2.26, while earlier versions only support =zlib-gnu). This also allows users to not have to worry about the version of the assembler they may be using if they are not using the IAS. Previously, users would have had to go through the internal option `-compress-debug-sectionss` and pass that through to the assembler, which is no longer needed. llvm-svn: 305165
* Represent debug information compression type fullySaleem Abdulrasool2017-06-091-4/+6
| | | | | | | | | | | This is tied with the LLVM side of the change to expose the debug information compression types to clang. We now track the compression type as an enumeration rather than a boolean. We still use the same value (GNU) that we did previously. This is in preparation to support passing down the compression type and switch it based on the command line. llvm-svn: 305039
* Driver must return non-zero code on errors in command lineSerge Pavlov2017-05-241-27/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is recommit of r302775, reverted in r302777 due to a fail in clang-tidy. Original mesage is below. Now if clang driver is given wrong arguments, in some cases it continues execution and returns zero code. This change fixes this behavior. The fix revealed some errors in clang test set. File test/Driver/gfortran.f90 added in r118203 checks forwarding gfortran flags to GCC. Now driver reports error on this file, because the option -working-directory implemented in clang differs from the option with the same name implemented in gfortran, in clang the option requires argument, in gfortran does not. In the file test/Driver/arm-darwin-builtin.c clang is called with options -fbuiltin-strcat and -fbuiltin-strcpy. These option were removed in r191435 and now clang reports error on this test. File arm-default-build-attributes.s uses option -verify, which is not supported by driver, it is cc1 option. Similarly, the file split-debug.h uses options -fmodules-embed-all-files and -fmodule-format=obj, which are not supported by driver. Other revealed errors are mainly mistypes. Differential Revision: https://reviews.llvm.org/D33013 llvm-svn: 303756
* Reverted r302775Serge Pavlov2017-05-111-28/+27
| | | | llvm-svn: 302777
* Driver must return non-zero code on errors in command lineSerge Pavlov2017-05-111-27/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now if clang driver is given wrong arguments, in some cases it continues execution and returns zero code. This change fixes this behavior. The fix revealed some errors in clang test set. File test/Driver/gfortran.f90 added in r118203 checks forwarding gfortran flags to GCC. Now driver reports error on this file, because the option -working-directory implemented in clang differs from the option with the same name implemented in gfortran, in clang the option requires argument, in gfortran does not. In the file test/Driver/arm-darwin-builtin.c clang is called with options -fbuiltin-strcat and -fbuiltin-strcpy. These option were removed in r191435 and now clang reports error on this test. File arm-default-build-attributes.s uses option -verify, which is not supported by driver, it is cc1 option. Similarly, the file split-debug.h uses options -fmodules-embed-all-files and -fmodule-format=obj, which are not supported by driver. Other revealed errors are mainly mistypes. Differential Revision: https://reviews.llvm.org/D33013 llvm-svn: 302775
* Fix a leak in tools/driver/cc1as_main.cppKostya Serebryany2017-04-191-2/+2
| | | | | | | | | | | | | | Summary: For some reason, the asan bot has recently started reporting this leak even though it existed for ages. Reviewers: pcc Reviewed By: pcc Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D32243 llvm-svn: 300755
* [Driver] Add compiler option to generate a reproducerBruno Cardoso Lopes2017-04-121-2/+3
| | | | | | | | | | | | | | | | | | | | | 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
* Create msbuild only when using MSVCReid Kleckner2017-03-161-1/+1
| | | | | | | | | | | | | | | | Patch by: Mateusz Mikula Reviewers: rnk Reviewed By: rnk Subscribers: asl, mgorny, cfe-commits Tags: #clang-c Differential Revision: https://reviews.llvm.org/D29772 llvm-svn: 297998
* Cleanup: use range-based for rather than separate calls to begin and end.Richard Smith2017-02-181-6/+4
| | | | llvm-svn: 295524
* [clang] Enable using --section-ordering-file option of ld.goldAlexander Shaposhnikov2017-01-091-8/+12
| | | | | | | | | This diffs enables using --section-ordering-file option of ld.gold via the variable CLANG_ORDER_FILE. Differential revision: https://reviews.llvm.org/D28461 llvm-svn: 291449
* [clang] Fix D26214: Move error handling out of MC and to the callers.Mandeep Singh Grang2016-12-061-4/+7
| | | | | | | | | | | | | | Summary: Related llvm patch: https://reviews.llvm.org/D27359 Reviewers: echristo, t.p.northover, rengolin, grosbach, compnerd Subscribers: mehdi_amini, cfe-commits, llvm-commits Tags: #clang-c Differential Revision: https://reviews.llvm.org/D27360 llvm-svn: 288762
* [clang] Implement support for -defsym assembler optionMandeep Singh Grang2016-12-011-0/+12
| | | | | | | | | | | | | | | | | Summary: Adds support for -Wa,-defsym,abc=1 option. Related llvm patch: https://reviews.llvm.org/D26214 Reviewers: rafael, t.p.northover, colinl, echristo, compnerd, rengolin Subscribers: mehdi_amini Tags: #clang-c Differential Revision: https://reviews.llvm.org/D26213 llvm-svn: 288397
OpenPOWER on IntegriCloud