summaryrefslogtreecommitdiffstats
path: root/clang/lib/Driver/Driver.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
* Fix cmake for r136702 (at least for the most part). Chandler has been kind Chad Rosier2011-08-021-2/+2
| | | | | | | enough to offer to investigate the underlying issue. Thanks to Doug for his assistance as well. llvm-svn: 136719
* Temporarily revert parts of r136702 to make cmake builds happy.Chad Rosier2011-08-021-2/+2
| | | | | | Someone with more cmake experience want to throw me a bone? :) llvm-svn: 136709
* When the compiler crashes, the compiler driver now produces diagnostic Chad Rosier2011-08-021-9/+65
| | | | | | | | | information including the fully preprocessed source file(s) and command line arguments. The developer is asked to attach this diagnostic information to a bug report. rdar://9575623 llvm-svn: 136702
* The -fapple-kext flag was designed to "do the right thing" for building code forChad Rosier2011-07-271-28/+56
| | | | | | | | | | | use in KEXTs. However, users/Xcode still need to tweak the linker flags to do the right thing, and end up using -Xlinker, for example. Instead, have the driver "do the right thing" when linking when -fapple-kext is present on the command line, and we should have Xcode use -fapple-kext instead of setting other flags like -Xlinker -kext or -nodefaultlibs. rdar://7809940 llvm-svn: 136294
* Move ArrayRef to LLVM.h and eliminate now-redundant qualifiers, patch by Jon ↵Chris Lattner2011-07-231-2/+2
| | | | | | Mulder! llvm-svn: 135855
* remove unneeded llvm:: namespace qualifiers on some core types now that ↵Chris Lattner2011-07-231-16/+16
| | | | | | | | LLVM.h imports them into the clang namespace. llvm-svn: 135852
* Temporarily revert r135614 while I fix the cmake build.Chad Rosier2011-07-201-65/+9
| | | | llvm-svn: 135621
* When the compiler crashes, the compiler driver now produces diagnostic ↵Chad Rosier2011-07-201-9/+65
| | | | | | | | | information including the fully preprocessed source file(s) and command line arguments. The developer is asked to attach this diagnostic information to a bug report. llvm-svn: 135614
OpenPOWER on IntegriCloud