Commit Graph

225 Commits

Author SHA1 Message Date
Michael J. Spencer e47230f9b5 Replace all uses of PathV1::get{Basename,Dirname,Suffix} with their PathV2 equivalents.
llvm-svn: 122140
2010-12-18 04:13:32 +00:00
Michael J. Spencer e169675474 Replace all uses of PathV1::getLast with PathV2::filename.
llvm-svn: 122117
2010-12-18 00:19:12 +00:00
Eric Christopher 62a78b04a8 Going back to the drawing board with these two awful hacks.
llvm-svn: 122096
2010-12-17 22:46:41 +00:00
Michael J. Spencer 1a4fe8c991 Fix spelling.
llvm-svn: 122088
2010-12-17 21:22:33 +00:00
Michael J. Spencer f28df4cdba Replace all uses of PathV1::isAbsolute with PathV2::is_{absolute,relative}.
llvm-svn: 122087
2010-12-17 21:22:22 +00:00
Eric Christopher 4698e938b1 Horrible hack for systems that use -dumpversion with clang to expect versions
that match gcc versions. Eew.

llvm-svn: 122080
2010-12-17 19:13:21 +00:00
Daniel Dunbar 86aed7d5fc Driver: M and MM should be grouped together, <rdar://problem/8744831>.
llvm-svn: 121284
2010-12-08 21:33:40 +00:00
Michael J. Spencer 8aaf49959c Merge System into Support.
llvm-svn: 120297
2010-11-29 18:12:39 +00:00
Argyrios Kyrtzidis 31448a415e Use hasErrorOccurred() instead of getNumErrors() where it makes sense.
llvm-svn: 119746
2010-11-18 21:47:07 +00:00
Argyrios Kyrtzidis d004064864 Refactoring of Diagnostic class.
-Move the stuff of Diagnostic related to creating/querying diagnostic IDs into a new DiagnosticIDs class.
-DiagnosticIDs can be shared among multiple Diagnostics for multiple translation units.
-The rest of the state in Diagnostic object is considered related and tied to one translation unit.
-Have Diagnostic point to the SourceManager that is related with. Diagnostic can now accept just a
   SourceLocation instead of a FullSourceLoc.
-Reflect the changes to various interfaces.

llvm-svn: 119730
2010-11-18 20:06:41 +00:00
Argyrios Kyrtzidis 71731d6b05 Implement -working-directory.
When -working-directory is passed in command line, file paths are resolved relative to the specified directory.
This helps both when using libclang (where we can't require the user to actually change the working directory)
and to help reproduce test cases when the reproduction work comes along.

--FileSystemOptions is introduced which controls how file system operations are performed (currently it just contains
 the working directory value if set).
--FileSystemOptions are passed around to various interfaces that perform file operations.
--Opening & reading the content of files should be done only through FileManager. This is useful in general since
 file operations will be abstracted in the future for the reproduction mechanism.

FileSystemOptions is independent of FileManager so that we can have multiple translation units sharing the same
FileManager but with different FileSystemOptions.

Addresses rdar://8583824.

llvm-svn: 118203
2010-11-03 22:45:23 +00:00
Chandler Carruth 06067c556a Use CLANG_RESOURCE_DIR define if one is provided, otherwise use the default of
'../lib/clang/<version>'. Actually use '..' rather than removing the trailing
component to correctly handle paths containing '.' or symlinks in the presence
of -no-canonical-prefixes, etc. This shouldn't change any existing behavior.

llvm-svn: 116803
2010-10-19 08:47:51 +00:00
NAKAMURA Takumi 89acd1e7ef lib/Driver/Driver.cpp: Use the driver g++-4 for Cygwin-1.5.
llvm-svn: 116183
2010-10-11 02:28:42 +00:00
Nick Lewycky 6e1ce29b01 Revert r114712 due to failure on darwin buildbot.
llvm-svn: 114713
2010-09-24 00:46:53 +00:00
Nick Lewycky e351fed104 Make -M/-MM behave like in gcc; use -MF first then -o else use stdout.
llvm-svn: 114712
2010-09-23 23:49:25 +00:00
Nick Lewycky e47c245b90 Fix header comment so we don't break emacs.
llvm-svn: 114711
2010-09-23 23:48:20 +00:00
Shantonu Sen afeb03b41d Driver: implement driver automagic support for -lcc_kext
Rewrite linker arguments to use libclang_rt.cc_kext.a
instead of gcc-specific libcc_kext.a

Resolves Radar 7808495

llvm-svn: 114193
2010-09-17 18:39:08 +00:00
Daniel Dunbar 1b09e04f9e Driver: Support -dumpmachine.
llvm-svn: 114155
2010-09-17 02:47:28 +00:00
Daniel Dunbar 2cc3f17a26 Driver: Add magic handling for "reserved library names", starting with
-lstdc++. This is the best gross solution for a gross problem.

This issue is that historically, GCC has add -L options to its internally
library directories. This has allowed users and platforms to end up depending on
the layout of GCC's internal library directories.

We want to correct this mistake by eliminating that -L, but this means that
existing libraries which are in the GCC lib dir won't be found. We are going to
handle this by treating those -l names as "reserved", and requiring toolchains
to know how to add the right full path to the reserved library.

The immediately side effect of this is that users trying to use -L to find their
own -lstdc++ will need to start using -nostdlib (which is a good idea
anyway). Another side effect is that -stdlib=libc++ -lstdc++ will now do the
"right" thing, for curious definitions of right.

llvm-svn: 114144
2010-09-17 00:45:02 +00:00
Rafael Espindola b2d0d40c3d Make "-ccc-cxx" option work on Linux.
Patch by nobled.

I also took the opportunity to make the field private since now it is only ready from the
outside.

llvm-svn: 113138
2010-09-06 02:36:23 +00:00
Daniel Dunbar 5d3b70a6fc Driver: Update -ccc-install-dir to also set the installed dir. Totally
non-obvious.

llvm-svn: 111838
2010-08-23 20:58:50 +00:00
Michael J. Spencer b186bc3c4b Visual Studio tools used on win32 hosts when targeting win32.
llvm-svn: 111748
2010-08-21 21:55:07 +00:00
Daniel Dunbar b613ffc1aa Driver: Claim the -mlinker-version synthesized argument, it shouldn't be
reported as unused.

llvm-svn: 111310
2010-08-17 22:32:45 +00:00
Daniel Dunbar 628fcf4e3b Driver: Use the compile time linker version as the default for -mlinker-version,
if detected.
 - This is a hack, we really want the linker version at execution time, but we
   don't have any infrastructure for getting that. Yet.

llvm-svn: 110886
2010-08-12 00:05:12 +00:00
Daniel Dunbar a73a9845e2 Driver: Have -ccc-host-triple simply override the default in the driver, for
now.

llvm-svn: 110027
2010-08-02 05:44:04 +00:00
Daniel Dunbar cc7df6cc7b Driver: Move HostInfo::lookupTypeForExtension to ToolChain::LookupTypeForExtension.
llvm-svn: 110024
2010-08-02 05:43:56 +00:00
Daniel Dunbar a36c2b3a62 Driver: Give Build{Universal,}Actions access to the default host tool chain. I
avoided this originally to enforce that the driver actions aren't toolchain
dependent, but it isn't worth the cumbersone additional hostinfo split.

llvm-svn: 110023
2010-08-02 05:43:51 +00:00
Daniel Dunbar 7fbaf53470 Driver: Add Compilation::addCommand and switch tools to using it, now that we
don't have to deal with nested jobs.

llvm-svn: 110015
2010-08-02 02:38:28 +00:00
Daniel Dunbar d00272f6d6 Driver: Simplify.
llvm-svn: 110011
2010-08-02 02:38:15 +00:00
Daniel Dunbar c12a412cb6 Driver: Eliminate now unused argument.
llvm-svn: 110010
2010-08-02 02:38:12 +00:00
Daniel Dunbar 89f791e2c2 Driver: Simplify logic for sending 'clang -E t.c' output to stdout.
llvm-svn: 110009
2010-08-02 02:38:08 +00:00
Daniel Dunbar a7dd15888b Driver: Never try to use piped inputs.
llvm-svn: 110008
2010-08-02 02:38:06 +00:00
Daniel Dunbar 926f81fce5 Driver: Start ripping out support for -pipe, which is worthless and complicates
too many other things.

llvm-svn: 110007
2010-08-02 02:38:03 +00:00
Daniel Dunbar e38764c66c Driver: Change the driver to take the path to the main executable, instead of
taking it in pieces.
 - Fixes a problem where the Clang executable path was not initialized properly
   on Win32, because sys::Path::getBasename() doesn't do what I always think it
   does. Imagine that, a sys::Path interface that is confusing!

llvm-svn: 108667
2010-07-19 00:44:04 +00:00
Daniel Dunbar 9765b9817d Driver: When re'execing clang, use path to the main executable instead of
looking up Clang in the normal search paths (which may end up finding the wrong
clang).

llvm-svn: 108346
2010-07-14 18:46:27 +00:00
Chris Lattner 3e2ee147d0 add driver support for minix, patch by Kees van Reeuwijk
from PR7583

llvm-svn: 107788
2010-07-07 16:01:42 +00:00
Daniel Dunbar 00d3d8e902 Driver/Darwin: Only run dsymutil when we are also compiling/assembling as part
of the compilation.
 - <rdar://problem/8141387> clang is always invoking dsymutil

llvm-svn: 107149
2010-06-29 16:38:33 +00:00
Daniel Dunbar 3648ba756f Driver: Support -Wp,-MMD,FOO, which I found an instance of. :(
llvm-svn: 106039
2010-06-15 20:30:18 +00:00
Daniel Dunbar 5a9d1835be Driver: Fix PR4062 by dissecting one particular -Wp, form.
llvm-svn: 105966
2010-06-14 21:37:09 +00:00
Daniel Dunbar fb3d747fc6 Driver: Dissect -Wl, and -Xlinker arguments to remove --no-demangle, which was a
collect2 option that is passed by some projects (notably WebKit).

llvm-svn: 105964
2010-06-14 21:23:12 +00:00
Daniel Dunbar af8decbde0 Driver: Switch Compilation to return the translated arguments by default.
llvm-svn: 105844
2010-06-11 22:43:38 +00:00
Daniel Dunbar 775d406043 Driver: Add an explicit argument translation phase to the driver itself. We are going to need this to handle things like -Xassembler, -Xpreprocessor, and -Xlinker which we might have to introspect.
llvm-svn: 105842
2010-06-11 22:00:26 +00:00
Daniel Dunbar 18974bdc68 Fix a couple comments.
llvm-svn: 105840
2010-06-11 22:00:19 +00:00
Daniel Dunbar 35cbfeba8f Driver: Eliminate Arg subclasses, which are now unnecessary.
llvm-svn: 105762
2010-06-09 22:31:08 +00:00
Daniel Dunbar 24e52992c0 Driver: Support invoking Clang on .ll or .bc inputs.
- We actually pretend that we have two separate types for LLVM assembly/bitcode because we need to use the standard suffixes with LTO ('clang -O4 -c t.c' should generate 't.o').

It is now possible to do something like:
  $ clang -emit-llvm -S t.c -o t.ll ... assorted other compile flags ...
  $ clang -c t.ll -o t.o ... assorted other compile flags ...
and expect that the output will be almost* identical to:
  $ clang -c t.c -o t.o ... assorted other compile flags ...
because all the target settings (default CPU, target features, etc.) will all be initialized properly by the driver/frontend.

*: This isn't perfect yet, because in practice we will end up running the optimization passes twice. It's possible to get something equivalent out with a well placed -mllvm -disable-llvm-optzns, but I'm still thinking about the cleanest way to solve this problem more generally.

llvm-svn: 105584
2010-06-07 23:28:45 +00:00
Daniel Dunbar 6beaf5110f Driver/Darwin: Model dsymutil properly, as a separate action/tool kind which is
added as the last output step, instead of just hacking it into the link step.
 - Among other things, this fixes dSYM generation when using multiple -arch options.

llvm-svn: 105475
2010-06-04 18:28:41 +00:00
Daniel Dunbar 07494795e5 Driver: When printing a "command was signalled" type of diagnostic, use the
short name of the tool in use, instead of the name of the action that created
the command. The practical impact is we now get:
  clang: error: clang frontend command failed due to signal 6 (use -v to see invocation)
instead of:
  clang: error: assembler command failed due to signal 6 (use -v to see invocation)
when clang crashes on a job that uses the integrated assembler.

llvm-svn: 104417
2010-05-22 00:37:20 +00:00
Daniel Dunbar f9ff35010c Driver: Enable -integrated-as by default, at least for Darwin/x86 without -static.
- How else will we figure out what is broken, eh?

llvm-svn: 103759
2010-05-14 02:03:00 +00:00
Chris Lattner 86ed5b016a add a new --print-diagnostic-categories option, which causes the driver to
print out all of the category numbers with their description.  This is useful
for clients that want to map the numbers produced by 
--fdiagnostics-show-category=id to their human readable string form.  The
output is simple but utilitarian:

$ clang --print-diagnostic-categories
1,Format String
2,Something Else

This implements rdar://7928193

llvm-svn: 103080
2010-05-05 05:53:24 +00:00
Daniel Dunbar 3d45e17d15 Driver: Add a Tool::hasGoodDiagnostics hook, and use it to simplify logic for
deciding when we need to emit an extra "command failed" diagnostic.
 - This also fixes the case where we were emitting that extra diagnostics, even
   when using clang w/ the integrated assembler, which has good diagnostics.

llvm-svn: 100529
2010-04-06 17:07:49 +00:00