summaryrefslogtreecommitdiffstats
path: root/clang/lib/Driver/Driver.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Basic: import SmallString<> into clang namespaceDylan Noblesmith2012-02-051-3/+3
| | | | | | | (I was going to fix the TODO about DenseMap too, but that would break self-host right now. See PR11922.) llvm-svn: 149799
* Basic: import OwningPtr<> into clang namespaceDylan Noblesmith2012-02-051-1/+1
| | | | llvm-svn: 149798
* back out r149504Dylan Noblesmith2012-02-021-2/+5
| | | | | | Too many weird build failures. llvm-svn: 149571
* include clang's config.h unconditionallyDylan Noblesmith2012-02-011-5/+2
| | | | | | | | | | | | | And remove HAVE_CLANG_CONFIG_H, now that the header is generated in the autoconf build, too. (clang r149497 / llvm r149498) Also include the config.h header after all other headers, per the LLVM coding standards. It also turns out WindowsToolChain.cpp wasn't using the config header at all, so that include's just deleted now. llvm-svn: 149504
* Revert r149083 which is not the direction we're going in the ClangChandler Carruth2012-01-311-24/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | driver based on discussions with Doug Gregor. There are several issues: 1) The patch was not reviewed prior to commit and there were review comments. 2) The design of the functionality (triple-prefixed tool invocation) isn't the design we want for Clang going forward: it focuses on the "user triple" rather than on the "toolchain triple", and forces that bit of state into the API of every single toolchain instead of handling it automatically in the common base classes. 3) The tests provided are not stable. They fail on a few Linux variants (Gentoo among them) and on mingw32 and some other environments. I *am* interested in the Clang driver being able to invoke triple-prefixed tools, but we need to design that feature the right way. This patch just extends the previous hack without fixing the underlying problems with it. I'm working on a new design for this that I will mail for review by tomorrow. I am aware that this removes functionality that NetBSD relies on, but this is ToT, not a release. This functionality hasn't been properly designed, implemented, and tested yet. We can't "regress" until we get something that really works, both with the immediate use cases and with long term maintenance of the Clang driver. For reference, the original commit log: Keep track of the original target the user specified before normalization. This used to be captured in DefaultTargetTriple and is used for the (optional) $triple-$tool lookup for cross-compilation. Do this properly by making it an attribute of the toolchain and use it in combination with the computed triple as index for the toolchain lookup. llvm-svn: 149337
* Keep track of the original target the user specified beforeJoerg Sonnenberger2012-01-261-22/+24
| | | | | | | | | | normalization. This used to be captured in DefaultTargetTriple and is used for the (optional) $triple-$tool lookup for cross-compilation. Do this properly by making it an attribute of the toolchain and use it in combination with the computed triple as index for the toolchain lookup. llvm-svn: 149083
* Restore a tiny bit of functionality that I completely overlooked in theChandler Carruth2012-01-251-1/+4
| | | | | | | | | | Linux toolchain selection -- sorry folks. =] This should fix the Hexagon toolchain. However, I would point out that I see why my testing didn't catch this -- we have no tests for Hexagon. ;] llvm-svn: 148977
* Remove the 'ToolTriple' concept from the NetBSD toolchain along with myChandler Carruth2012-01-251-1/+1
| | | | | | | | | | | | | | | | gross hack to provide it from my previous patch removing HostInfo. This was enshrining (and hiding from my searches) the concept of storing and diff-ing the host and target triples. We don't have the host triple reliably available, so we need to merely inspect the target system. I've changed the logic in selecting library search paths for NetBSD to match what I provided for FreeBSD -- we include both search paths, but put the 32-bit-on-64-bit-host path first so it trumps. NetBSD maintainers, you may want to tweak this, or feel free to ask me to tweak it. I've left a FIXME here about the challeng I see in fixing this properly. llvm-svn: 148952
* Delete still more remnants of the now dead HostInfo. The janitoring willChandler Carruth2012-01-251-1/+0
| | | | | | continue until cleanliness improves. llvm-svn: 148951
* Delete the driver's HostInfo class. This abstraction just never reallyChandler Carruth2012-01-251-53/+119
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | did anything. The two big pieces of functionality it tried to provide was to cache the ToolChain objects for each target, and to figure out the exact target based on the flag set coming in to an invocation. However, it had a lot of flaws even with those goals: - Neither of these have anything to do with the host, or its info. - The HostInfo class was setup as a full blown class *hierarchy* with a separate implementation for each "host" OS. This required dispatching just to create the objects in the first place. - The hierarchy claimed to represent the host, when in fact it was based on the target OS. - Each leaf in the hierarchy was responsible for implementing the flag processing and caching, resulting in a *lot* of copy-paste code and quite a few bugs. - The caching was consistently done based on architecture alone, even though *any* aspect of the targeted triple might change the behavior of the configured toolchain. - Flag processing was already being done in the Driver proper, separating the flag handling even more than it already is. Instead of this, we can simply have the dispatch logic in the Driver which previously created a HostInfo object create the ToolChain objects. Adding caching in the Driver layer is a tiny amount of code. Finally, pulling the flag processing into the Driver puts it where it belongs and consolidates it in one location. The result is that two functions, and maybe 100 lines of new code replace over 10 classes and 800 lines of code. Woot. This also paves the way to introduce more detailed ToolChain objects for various OSes without threading through a new HostInfo type as well, and the accompanying boiler plate. That, of course, was the yak I started to shave that began this entire refactoring escapade. Wheee! llvm-svn: 148950
* Remove the TargetTriple object that I added to the Driver recently. ThisChandler Carruth2012-01-251-12/+12
| | | | | | | | | | | | | | | helped stage the refactoring of things a bit, but really isn't the right place for it. The driver may be responsible for compilations with many different targets. In those cases, having a target triple in the driver is actively misleading because for many of those compilations that is not actually the triple being targeted. This moves the last remaining users of the Driver's target triple to instead use the ToolChain's target triple. The toolchain has a single, concrete target it operates over, making this a more stable and natural home for it. llvm-svn: 148942
* Start hoisting the logic for computing the target triple into its ownChandler Carruth2012-01-241-8/+14
| | | | | | | | | | | | | | | | | | | | | | function. The logic for this, and I want to emphasize that this is the logic for computing the *target* triple, is currently scattered throughout various different HostInfo classes ToolChain factoring functions. Best part, it is largely *duplicated* there. The goal is to hoist all of that up to here where we can deal with it once, and in a consistent manner. Unfortunately, this uncovers more fun problems: the ToolChains assume that the *actual* target triple is the one passed into them by these factory functions, while the *host* triple is the one in the driver. This already was a lie, and a damn lie, when the '-target' flag was specified. It only really worked when the difference stemmed from '-m32' and '-m64' flags. I'll have to fix that (and remove all the FIXMEs I've introduced here to document the problem) before I can finish hoisting the target-calculation logic. It's bugs all the way down today it seems... llvm-svn: 148839
* Remove HostInfo::useDriverDriver(). This was only used in two placesChandler Carruth2012-01-241-4/+6
| | | | | | | | | | | | inside the innards of the Driver implementation, and only ever implemented to return 'true' for the Darwin OSes. Instead use a more direct query on the target triple and a comment to document why the target matters here. If anyone is worried about this predicate getting wider use or improper use, I can make it a local or private predicate in the driver. llvm-svn: 148797
* Hoist the targeted triple object into an actual object in the Driver.Chandler Carruth2012-01-241-3/+7
| | | | | | | | | The Driver has a fixed target, whether we like it or not, the DefaultTargetTriple is not a default. This at least makes things more honest. I'll eventually get rid of most (if not all) of DefaultTargetTriple with this proper triple object. Bit of a WIP. llvm-svn: 148796
* rename -ccc-host-triple into -targetSebastian Pop2012-01-201-1/+1
| | | | llvm-svn: 148582
* Fix 80-column violation.Chad Rosier2012-01-141-1/+2
| | | | llvm-svn: 148162
* Revert r148138; it's causing test failures.Eli Friedman2012-01-131-1/+1
| | | | llvm-svn: 148141
* rename -ccc-host-triple into -targetSebastian Pop2012-01-131-1/+1
| | | | llvm-svn: 148138
* rename DefaultHostTriple into DefaultTargetTripleSebastian Pop2012-01-131-5/+5
| | | | llvm-svn: 148137
* [Win32] Catch exceptions (eg. segfault) on waiting for invoked clang from ↵NAKAMURA Takumi2011-11-291-1/+7
| | | | | | | | | | | | the driver. clang/lib/Driver/Driver.cpp: Don't pass through negative exit status, or parent would be confused. llvm::sys::Program::Wait(): Suppose 0x8000XXXX and 0xC000XXXX as abnormal exit code and pass it as negative value. Win32 Exception Handler: Exit with ExceptionCode on an unhandle exception. llvm-svn: 145389
* Teach the driver about failure result files, which are compilationPeter Collingbourne2011-11-211-1/+6
| | | | | | | | output files that are valid regardless of whether the compilation succeeded or failed (but not if we crash). Add depfiles to the failure result file list. llvm-svn: 145018
* Driver: Remove the signal number from the "command failed" diagnostic.Benjamin Kramer2011-11-191-1/+1
| | | | | | | - With the current implementation of sys::Program this always printed "2". - The command execution code will output the right number anyway (including the signal name). llvm-svn: 144993
* [driver] If we're only linking, don't warn about unused arguments which areChad Rosier2011-11-051-2/+3
| | | | | | | obviously only used during compilation. rdar://10386708 llvm-svn: 143813
* In addition to dumping preprocessed source, dump a script with the command lineChad Rosier2011-11-021-2/+23
| | | | | | | arguments that caused clang to crash. rdar://8314451 llvm-svn: 143573
* Stop disabling integrated assembler with -static. <rdar://problem/10175391>Bob Wilson2011-10-301-10/+2
| | | | | | | The integrated assembler seems to be working pretty well for -static code now, so remove the hacks to disable it. llvm-svn: 143304
* Use Triple.isOSDarwin() instead of comparing against Triple::Darwin.Bob Wilson2011-10-141-1/+3
| | | | | | | | | There are now separate Triple::MacOSX and Triple::IOS values for the OS so comparing against Triple::Darwin will fail to match those. Note that I changed the expected output for the Driver/rewrite-objc.m test, which had previously not been passing Darwin-specific options with the macosx triple. llvm-svn: 141944
* Rip out flags for controlling C++ "production mode" separately.Bob Wilson2011-10-041-4/+1
| | | | | | | This is old leftover cruft from the days when C++ was not yet ready for prime time. llvm-svn: 141063
* Revert my --working-directory option, which wasn't well thought through.Daniel Dunbar2011-09-301-8/+0
| | | | llvm-svn: 140889
* Driver: Fix two bad typos that were breaking the buildbots.Benjamin Kramer2011-09-281-2/+1
| | | | llvm-svn: 140682
* Check for GCC paths that have the target triple in them. This is required ↵David Chisnall2011-09-271-9/+22
| | | | | | for a lot of cross-compile toolchains. Also add some slightly better support for -B. llvm-svn: 140645
* Rename Diagnostic to DiagnosticsEngine as per issue 5397David Blaikie2011-09-251-2/+3
| | | | llvm-svn: 140478
* Driver: Use sys::Process::SetWorkingDirectory, for consistency.Daniel Dunbar2011-09-231-7/+2
| | | | llvm-svn: 140434
* Driver: Explicitly include <unistd.h>, libstdc++'s <map> pulls it in, libc++ ↵Benjamin Kramer2011-09-231-0/+6
| | | | | | | | doesn't. Also, on windows, chdir seems to live in <direct.h>. llvm-svn: 140414
* Driver: Add a --working-directory option which can be used to cause the compilerDaniel Dunbar2011-09-231-0/+7
| | | | | | | | | | to operate "as if" in a certain working directory. - For now, we just implement this by changing the actual working directory, but eventually we would want to handle this transparently. This is useful to avoid an extra exec() pair in some situations, and will be something we would want to support for more flexibility in using the Clang libraries. llvm-svn: 140409
* Removing a bunch of dead returns/breaks after llvm_unreachables.David Blaikie2011-09-231-1/+0
| | | | llvm-svn: 140407
* More missing header inclusions from llvm_unreachable migration.David Blaikie2011-09-231-0/+1
| | | | llvm-svn: 140369
* Switch assert(0/false) llvm_unreachable.David Blaikie2011-09-231-2/+2
| | | | llvm-svn: 140367
* [driver] Add support for the COMPILER_PATH environment variable, which adds theChad Rosier2011-09-141-2/+10
| | | | | | | specified path(s) to the list of prefix directories. rdar://10097714 llvm-svn: 139677
* [driver] When clang crashes, don't try to generate diagnostics (i.e., Chad Rosier2011-09-061-0/+17
| | | | | | preprocessor output) with multiple -arch options. llvm-svn: 139207
* Add the resource directory to the search path for Driver::GetFilePath,Peter Collingbourne2011-09-061-3/+8
| | | | | | | | | | | | | | as well as the search path printed by -print-search-dirs. The main purpose of this change is to cause -print-file-name=include to print the path to the include directory under Clang's resource directory, instead of the system compiler's include directory, whose header files Clang may not be able to parse. Some build scripts will do something like: $(CC) -nostdinc -I`$(CC) -print-file-name=include` to exclude all header paths except the compiler's. llvm-svn: 139127
* Cleanup r138662 per Ben and David's suggestions, thanks.Chad Rosier2011-08-261-14/+7
| | | | llvm-svn: 138670
* Make sure the std::string isn't deallocated prior to use. Many thanks to EliChad Rosier2011-08-261-5/+5
| | | | | | for catching this. llvm-svn: 138666
* [driver] When generating temporary files allow a prefix to be added. In manyChad Rosier2011-08-261-5/+17
| | | | | | | | cases we want the prefix to be the original file name less the suffix. For an input such as test.c to named temporary would be something like test-3O4Clq.o Part of <rdar://problem/8314451> llvm-svn: 138662
* [driver] Do not add -kext to the link command line when compiling with Chad Rosier2011-08-251-17/+0
| | | | | | | -fapple-kext. Fixes <rdar://problem/10013310>. Reverts <rdar://problem/7809940>. llvm-svn: 138564
* Add support for a verifier to the driver. Currently only verifies debugEric Christopher2011-08-231-2/+21
| | | | | | | | | | | output on darwin so is hard coded there. As a note this will need a little bit of refactoring in the class hierarchy to separate it out for different verifiers based on input type. Fixes rdar://8256258. llvm-svn: 138343
* [driver] Don't generate diagnostics (i.e., preprocessed source) if reading Chad Rosier2011-08-181-2/+14
| | | | | | | from stdin. This allows Eli and the like to continue with their debugging trickery without loss of limb (or car) on my part. :) llvm-svn: 137906
* Fix else style. No functionality change intended.Chad Rosier2011-08-171-1/+2
| | | | llvm-svn: 137896
* Fix typo.Eric Christopher2011-08-171-9/+9
| | | | llvm-svn: 137893
* [driver] When generating clang failure diagnostics, don't try to preprocess Chad Rosier2011-08-121-0/+14
| | | | | | inputs that aren't preprocessable. llvm-svn: 137532
* [driver] Refactor a bit to enable a few fixes when generating diagnostics. ↵Chad Rosier2011-08-121-14/+25
| | | | | | No functional change intended. llvm-svn: 137524
OpenPOWER on IntegriCloud