Commit Graph

502 Commits

Author SHA1 Message Date
Daniel Dunbar ab7b2f5623 Set __PIC__ (more) correctly.
- Add -pic-level clang-cc option to specify the value for the define,
   updated driver to pass this.

 - Added __pic__

 - Added OBJC_ZEROCOST_EXCEPTIONS define while I was here (to match gcc).

llvm-svn: 68584
2009-04-08 03:03:23 +00:00
Daniel Dunbar d4510f2223 Driver: Fix forwarding of -fpascal-strings.
llvm-svn: 68570
2009-04-07 23:51:44 +00:00
Daniel Dunbar c44b4ccca8 Driver: Fix forwarding of -{std,ansi,trigraphs} when there are
multiple instances of an option.

Also, removed direct -ansi support from clang-cc.

llvm-svn: 68558
2009-04-07 22:13:21 +00:00
Daniel Dunbar 3a148f2625 Driver: Forward remaining -f options to clang manually.
- Groups are really just intended to hold inherent structure of the
   options, not be abused for individual tool argument translation.

llvm-svn: 68554
2009-04-07 21:51:40 +00:00
Daniel Dunbar 9dc82a2632 Driver: Only forward last instance of -mmacosx-version-min= and
-isysroot to clang.
 - Don't forward arbitrary -i* options to clang, just the ones we know
   about.

llvm-svn: 68553
2009-04-07 21:42:00 +00:00
Daniel Dunbar d18049ab1d Driver: Manually translate a number of -f with no- variants options to
clang.
 - We will eventually want some more driver infrastructre for this
   probably.

 - For now, the clang-cc interface stays relatively the same, but we
   don't accept multiple instances anymore, or the [no-] variants
   directly.

llvm-svn: 68550
2009-04-07 21:16:11 +00:00
Daniel Dunbar 30bf11e181 Driver: Add default for ArgList::hasFlag and simplify implementation.
llvm-svn: 68549
2009-04-07 21:08:57 +00:00
Daniel Dunbar 513d500fda Driver: Explicitly warn that -pg isn't supported (even though we
aren't failing the compilation).

llvm-svn: 68540
2009-04-07 19:18:24 +00:00
Daniel Dunbar a3cfbe33da Driver: Add 'q' flag for options which shouldn't be reported as unused.
- <rdar://problem/6756295> warning about '-dynamic' argument unused
   during compilation seems incorrect

llvm-svn: 68535
2009-04-07 19:04:18 +00:00
Daniel Dunbar b2a7c062aa Driver: Fix a parsing bug where some options were matched
incorrectly. I'm blanking on the smartest way to write this search,
but we should just do the right thing when we move to TableGen.
 - <rdar://problem/6761194> [driver] -Wextra-tokens isn't parsed
   correctly

llvm-svn: 68525
2009-04-07 18:21:47 +00:00
Daniel Dunbar c790b09b81 Driver: More verbosity reduction.
- Ignore some more -W options and -[fm] options which we can somewhat
   safely ignore.

 - Recognize that -W is an alias for -Wextra

W: -Wdeclaration-after-statement -Werror-implicit-function-declaration -Wfour-char-constants -Winit-self -Wmissing-format-attribute -Wno-#warnings -Wno-comment -Wno-long-long -Wno-variadic-macros -Wold-style-definition -Wstrict-prototypes -Wunused-parameter

f: -fconstant-cfstrings -fdollars-in-identifiers -finline -finline-functions -fno-inline -fno-keep-inline-functions -fno-strict-aliasing -fobjc-atdefs -fobjc-call-cxx-cdtors -fobjc-new-property -fstack-protector

m: -mconstant-cfstrings -mfix-and-continue
llvm-svn: 68487
2009-04-07 02:59:27 +00:00
Daniel Dunbar a9bbcfa130 Driver: Handle -dumpversion, this is used by some configuration
scripts.

llvm-svn: 68418
2009-04-04 05:17:38 +00:00
Daniel Dunbar f89733cfb8 Driver: Handle properly calling dsymutil when source input is
preceeded by a linker input flag.
 - <rdar://problem/6757236> clang should make a dSYM when going
   straight from source to binary

 - This still matches gcc, but the right way to solve this would be to
   detect the situation we care about (we are compiling from source
   and linking in one step), instead of looking at the suffix of the
   input file. The Tool doesn't quite have enough information to do
   this yet, however.

 - Also, find the suffix correctly.

llvm-svn: 68417
2009-04-04 00:55:30 +00:00
Daniel Dunbar 90dd6f45cc Driver: Automatically suppress warnings for duplicate versions of
flags which were used for something.

llvm-svn: 68416
2009-04-04 00:52:26 +00:00
Daniel Dunbar f69985511d Driver: Add -Qunused-arguments option to suppress driver "unused
arguments" warning.

llvm-svn: 68410
2009-04-03 22:09:23 +00:00
Daniel Dunbar c2a7189048 Driver: Explicitly ignore -fpch-preprocess when using clang, we don't
need to do anything special to support this.

llvm-svn: 68403
2009-04-03 20:51:31 +00:00
Daniel Dunbar 6a8803a34f Driver: Add missed translation for darwin::Preprocess (gcc), -d*
wasn't being forwarded.

llvm-svn: 68365
2009-04-03 01:27:06 +00:00
Ed Schouten e33194b9d5 Add some whitespace to test my commit privileges.
Approved by:	ddunbar

llvm-svn: 68343
2009-04-02 19:13:12 +00:00
Daniel Dunbar b48a4aaec9 Driver: Tweak search paths for FreeBSD.
- Patch by Pawel Worach!

llvm-svn: 68332
2009-04-02 18:30:04 +00:00
Daniel Dunbar b0006ae76d Wire --version to normal -v version text.
llvm-svn: 68316
2009-04-02 15:05:41 +00:00
Daniel Dunbar 7803c9546b Driver: Allow -ccc-gcc-name to specify the name/path to use when
calling gcc in generic configurations.

llvm-svn: 68260
2009-04-01 23:34:41 +00:00
Daniel Dunbar 0a05d93ed6 Quick and dirty (!) fix to make sure we use powerpc in triples.
- PR3922

 - I have a clean solution for this in flight, but it may take a while
   to come to fruition so we'll take a quick fix for now.

llvm-svn: 68241
2009-04-01 20:33:11 +00:00
Daniel Dunbar d854c8d8a6 Driver: Add freebsd::Link
- Patch by Ed Schouten!

llvm-svn: 68233
2009-04-01 19:36:32 +00:00
Daniel Dunbar 2ec6e8e2ba Remove a FIXME, use -emit-pth to drive PTH generation.
-  c.f. r68164

llvm-svn: 68184
2009-04-01 03:28:10 +00:00
Daniel Dunbar ae8bca038d Tweak/cleanup darwin::Link a bit, add several FIXMES, and improve test
case.

llvm-svn: 68182
2009-04-01 03:17:40 +00:00
Daniel Dunbar 5c9c118600 Tweak darwin::Assemble and add a FIXME.
llvm-svn: 68165
2009-04-01 00:27:44 +00:00
Daniel Dunbar 7c92528530 Driver: Implement basic --help text.
- PR3875.
 - <rdar://problem/6615249> [driver] ccc should support some form of
   --help

llvm-svn: 68148
2009-03-31 21:38:17 +00:00
Daniel Dunbar 77684ead4b Driver: Add OptTable::getOptionKind.
Also, removed default value for getOptionMetaVar.

llvm-svn: 68146
2009-03-31 21:26:12 +00:00
Daniel Dunbar e521a8994c Driver: Forward -Wp, and -Xpreprocessor arguments to clang when using
the preprocessor.
 - PR3602.

 - As is inherent in the blanket forwarding options, this will only
   work if clang-cc happens to accept what the user passed. Users by
   and large should use driver options to interact with the
   preprocessor, if at all possible.

llvm-svn: 68144
2009-03-31 20:53:55 +00:00
Daniel Dunbar a207254f94 Driver: Add extra parameters for help text to option definitions.
- Currently unused.

And yes, now may be about the time I want a TableGen backend.

llvm-svn: 68139
2009-03-31 20:12:05 +00:00
Daniel Dunbar 8eb473c477 Driver: Call 'as' directly on FreeBSD.
- Patch by Ed Schouten!

llvm-svn: 68121
2009-03-31 17:45:15 +00:00
Daniel Dunbar d640be24fd (LLVM up) Update to use llvm::sys::getHostTriple().
- Always pass -triple to clang-cc (-arch will be removed).

 - clang-cc doesn't play guess work with the target triple anymore.

llvm-svn: 68119
2009-03-31 17:35:15 +00:00
Daniel Dunbar cbe5b2f800 Comment fix.
llvm-svn: 68069
2009-03-30 22:11:38 +00:00
Daniel Dunbar e24297c6b5 Driver: Sketch FreeBSD tool chain.
- Patch by Ed Schouten!

llvm-svn: 68061
2009-03-30 21:06:03 +00:00
Daniel Dunbar 13357aef14 Driver: Unbreak ArgList::hasFlag.
- <rdar://problem/6726511> [driver] clang does not have -msoft-float
   hooked up.

llvm-svn: 68044
2009-03-30 18:13:26 +00:00
Daniel Dunbar 759b1c9b80 Fix -MD with no -MT when -o is specified (and fix test case).
llvm-svn: 68042
2009-03-30 17:59:58 +00:00
Daniel Dunbar d67a32252c Driver: Support -M and -MM.
- Not particularly elegant, but my hand is forced by gcc.

Also, tweak -ccc-print-bindings output.

llvm-svn: 68027
2009-03-30 06:36:42 +00:00
Daniel Dunbar 52e96cc932 Improve dependency file support.
- Rip out various bits of logic from clang-cc's dependency file gen,
   force driver to provide instead.

 - -MD output now goes to proper location
<rdar://problem/6723948> clang -MD puts dep file in /tmp with wrong name

 - -M and -MM still don't work correctly.

llvm-svn: 68022
2009-03-30 00:34:04 +00:00
Daniel Dunbar 53b406f40a Driver: Track which original arguments an arg is derived from, so that
we can properly claim arguments, even if they have been translated by
the tool chain.

llvm-svn: 68020
2009-03-29 22:29:05 +00:00
Daniel Dunbar f64f5307dc Driver: Add test case for darwin::Preprocess and darwin::Compile
tools, and enable them.

llvm-svn: 68019
2009-03-29 22:27:40 +00:00
Daniel Dunbar 58399aecc1 Driver: Make sure to claim -### before emitting "unused argument"
warnings.

llvm-svn: 68018
2009-03-29 22:24:54 +00:00
Daniel Dunbar afec1f58e9 Driver: Finish porting Darwin::Preprocess and Compile port (still
unused, and lacking a test case).
 - ccc is now on death row, pending some more testing and bug fixes.

llvm-svn: 68012
2009-03-29 18:40:18 +00:00
Daniel Dunbar e6adeeece3 Driver: Start porting Darwin::Preprocess and Compile implementations
(currently unused).

llvm-svn: 68003
2009-03-29 17:08:39 +00:00
Daniel Dunbar a21c833d74 Driver: Pass -f[no-]pascal-strings on to clang, even if it has been
turned into -m[no-]pascal-strings by the tool chain.
 - This still has issue that derived arguments don't propogate "used"
   information correctly so spurious "argument unused" warnings will
   still show up.

llvm-svn: 67841
2009-03-27 15:22:28 +00:00
Daniel Dunbar 565eefd4ab Driver: -print-libgcc-file-name was searching wrong path list.
llvm-svn: 67837
2009-03-27 14:26:33 +00:00
Mike Stump db65737b1c Fix searching for gcc, we only want executable files.
llvm-svn: 67806
2009-03-27 00:40:20 +00:00
Mike Stump ffea82e2f4 Remove dead code.
llvm-svn: 67769
2009-03-26 21:25:00 +00:00
Daniel Dunbar c196421fbc Driver: Add darwin::Link tool.
- <rdar://problem/6717381> [driver] implement ld argument translation
   in new driver

llvm-svn: 67760
2009-03-26 16:23:12 +00:00
Daniel Dunbar dd76524d76 Driver: Fix a number of option definition mismatches (flags instead of
separate, or vice versa).

Also, fix initialization of LinkingOutput variable.

llvm-svn: 67757
2009-03-26 16:12:09 +00:00
Daniel Dunbar b1024880f1 Driver: Print the correct target when printing the version.
llvm-svn: 67756
2009-03-26 16:09:13 +00:00
Daniel Dunbar c7fd57a2f3 Driver: Move GetReleaseVersion to static Driver::GetReleaseVersion method.
llvm-svn: 67754
2009-03-26 15:58:36 +00:00
Daniel Dunbar 4e5696b984 Driver: Add ArgList::AddAllArgsTranslated; for forwarding options to
tools with the name of the option replace, and arguments rendered
separately.

llvm-svn: 67753
2009-03-26 15:39:22 +00:00
Chris Lattner ada1c91537 hopefully fix VC++ build error.
llvm-svn: 67741
2009-03-26 05:56:24 +00:00
Daniel Dunbar 0af75a19a4 Driver: Implement Darwin_X86 tool chain level argument translation.
- This is really gross, but its the easiest way to match gcc. Once we
   are confident in the driver, we can try and push these translations
   down into tools.

 - No test cases for this yet, it's hard to see the effects of these
   translations before the gcc tool argument translation is pulled
   over.

 - Interaction with "unused argument" warning hasn't been worked out
   yet.

 - <rdar://problem/6717359> [driver] implement toolchain specific
   argument translation.

"It's horrible in here."

llvm-svn: 67683
2009-03-25 06:58:31 +00:00
Daniel Dunbar aabb0b11a3 Driver: Handle -Xarch_, including warning for nasty -Xarch_ use cases
we aren't going to support. For example:
  clang -Xarch_i386 -S -Xarch_i386 -o -Xarch_i386 myi386asm.s ...

llvm-svn: 67680
2009-03-25 06:12:34 +00:00
Daniel Dunbar 0e378b1e26 Driver: Replace Option::ForwardToGCC by Option::DriverOption (which
matches the flag in Options.def).

llvm-svn: 67679
2009-03-25 06:08:46 +00:00
Daniel Dunbar b2304ee0d1 Driver: Fix typo in JoinedAndSeparateArg::render.
llvm-svn: 67677
2009-03-25 05:23:40 +00:00
Daniel Dunbar dac54a81df Driver: Prep for tool chain specific argument translation.
- Lift ArgList to a base class for InputArgList and DerivedArgList.
 
 - This is not a great decomposition, but it does embed the
   translation into the type system, and keep things efficient for
   tool chains that don't want to do any translation.

 - No intended functionality change.

Eventually I hope to get rid of tool chain specific translation and
have each tool do the right thing, but for now this is the easiest way
to match gcc precisely (which is good for testing).

llvm-svn: 67676
2009-03-25 04:13:45 +00:00
Daniel Dunbar 0e0cf39a9e gcc 4.3 finds my use of ^ suspicious.
llvm-svn: 67673
2009-03-25 03:06:26 +00:00
Ted Kremenek 759d5d3fa7 Turn on -analyzer-eagerly-assume by default when using 'clang-cc' to perform
static analysis.

llvm-svn: 67665
2009-03-25 00:38:14 +00:00
Daniel Dunbar 1386495406 Driver: Handle -flto, -O4, and tweak -emit-llvm to match llvm-gcc.
- -emit-llvm no longer changes what compilation steps are done.

 - -emit-llvm and -emit-llvm -S write output files with .o and .s
    suffixes, respectively.

 - <rdar://problem/6714125> clang-driver should support -O4 and -flto,
   like llvm-gcc

llvm-svn: 67645
2009-03-24 20:17:30 +00:00
Daniel Dunbar 6b5244d600 Driver: Warn when 'clang' is used to compile a source file we could
conceivably handle, but are defaulting to not using clang for.

llvm-svn: 67641
2009-03-24 19:14:56 +00:00
Daniel Dunbar 88f356e16b Driver: Change default use of "clang" compiler.
- Don't default to using clang for C++ (use -ccc-clang-cxx to
   override).

 - Default to only using clang on i386 and x86_64 (use
   -ccc-clang-archs "" to override).

 - <rdar://problem/6712350> [driver] clang should not be used on
   powerpc by default
 - <rdar://problem/6705767> driver should default to -ccc-no-clang-cxx

I plan to add a warning that we are not using the clang compiler for
the given compilation so that users do not think clang is being used
in situations it isn't.

This change is motivated by the desire to be able to drop clang into a
build and have things "just work", even if it happens to get used to
compile C++ code or code for an architecture we don't support yet.

llvm-svn: 67640
2009-03-24 19:02:31 +00:00
Daniel Dunbar 8fa879d39f Move ToolChain::ShouldUseClangCompiler to
Driver::ShouldUseClangCompiler.
 - No functionality change.

llvm-svn: 67639
2009-03-24 18:57:02 +00:00
Daniel Dunbar 038f5d6ef0 Driver: Translate -fverbose-asm for LLVM backend.
- <rdar://problem/6715707> driver should translate -fverbose-asm into
   -asm-verbose

llvm-svn: 67634
2009-03-24 17:59:06 +00:00
Mike Stump 90a3707225 Really fix cmake style builds.
llvm-svn: 67633
2009-03-24 17:52:34 +00:00
Daniel Dunbar 827faf8f2b Driver: Result files shouldn't be removed on failure when -save-temps
is specified.
 - No easy way to make a safe test case for this (given where the
   driver is supposed to put temp files).

llvm-svn: 67632
2009-03-24 17:49:01 +00:00
Daniel Dunbar 9ea0e77572 Driver: ArgList::getLastArg was in fact returning the first matching arg.
- <rdar://problem/6715818> clang doesn't honor gcc semantic that last
    -O optimization option wins.

llvm-svn: 67628
2009-03-24 17:31:30 +00:00
Daniel Dunbar d7a1860eba Driver: Forward -MMD (not -MM) to clang-cc; this got lost in
translation, the former we support, the later we don't (yet).

llvm-svn: 67611
2009-03-24 07:20:59 +00:00
Daniel Dunbar 2dbe89af65 Install clang-cc to libexec/clang-cc (instead of bin/clang-cc).
- Updated ccc & driver to look in libexec/ for tools.

llvm-svn: 67607
2009-03-24 04:07:10 +00:00
Daniel Dunbar a45cf5b6b0 Rename clang to clang-cc.
Tests and drivers updated, still need to shuffle dirs.

llvm-svn: 67602
2009-03-24 02:24:46 +00:00
Daniel Dunbar 06686abfdc Driver: lipo wasn't being called correctly (translation failure from
ccc due to the different way we handle output arguments).

llvm-svn: 67583
2009-03-24 00:24:37 +00:00
Daniel Dunbar 95953ce31c Driver: Make argument parsing fast.
On a synthetic command line consisting of almost all defined options,
this drops wall time from .00494 to .00336 and user time from .00258
to .00105.

On the same benchmark, clang-driver is about 15% faster than the
primary gcc driver and almost twice as fast as the gcc driver driver.

llvm-svn: 67564
2009-03-23 21:50:40 +00:00
Daniel Dunbar ee4d1feb44 Driver: Fix off by one in computation of first searchable option.
llvm-svn: 67552
2009-03-23 19:19:19 +00:00
Daniel Dunbar 1773177a99 Driver: Add two special groups of "whitelisted" options which we know
clang doesn't support, and don't want to warn are unused. Eventually
these should disappear.

Here is a more readable list than is in the diff:

W options: -Wall, -Wcast-align, -Wchar-align, -Wchar-subscripts,
-Werror, -Wextra, -Winline, -Wint-to-pointer-cast, -Wmissing-braces,
-Wmost, -Wnested-externs, -Wno-format-y2k, -Wno-four-char-constants,
-Wno-missing-field-initializers, -Wno-trigraphs, -Wno-unknown-pragmas,
-Wno-unused-parameter, -Wparentheses, -Wpointer-arith,
-Wpointer-to-int-cast, -Wreturn-type, -Wshorten-64-to-32, -Wswitch,
-Wunused-function, -Wunused-label, -Wunused-value, -Wunused-variable,
-Wwrite-strings.

f options: -fasm-blocks, -fmessage-length=.

llvm-svn: 67549
2009-03-23 19:03:36 +00:00
Daniel Dunbar 453d79a2db Driver: Check that options are ordered properly (outside of
Release-Asserts mode).

Also, avoid searching through option groups (which will never match).

llvm-svn: 67548
2009-03-23 18:41:45 +00:00
Daniel Dunbar 76ce7416ae Driver: Setup file and program search paths in tool chains.
llvm-svn: 67529
2009-03-23 16:15:50 +00:00
Daniel Dunbar a0c89be9cc Driver: Drop code for checking bounds in SeparateArg::render, this
situation should never occur now that arguments are parsed correctly.

llvm-svn: 67493
2009-03-22 23:50:14 +00:00
Daniel Dunbar d8500f3b0f Driver: Implement 'missing argument' error.
llvm-svn: 67490
2009-03-22 23:26:43 +00:00
Nuno Lopes 34cef4c1c8 fix PR3859: crash with 'cc -V'
llvm-svn: 67472
2009-03-22 17:47:44 +00:00
Daniel Dunbar 1acb0eb24f Driver: Give Compilation::Execute total control over the Driver result
code; and don't return an error code when -### is present, even if
errors occur.

llvm-svn: 67425
2009-03-21 00:40:53 +00:00
Daniel Dunbar ea9f032613 ccc/Driver: .s defaults to 'assembler-with-cpp' on Darwin.
- <rdar://problem/6669441> ccc doesn't handle assembler-with-cpp
   semantics correctly (but clang supports it)

 - This is sad, because it requires a fairly useless target
   hook. C'est la vie.

llvm-svn: 67418
2009-03-20 23:39:23 +00:00
Daniel Dunbar 60196720eb Driver: Switch to using -include-pth.
llvm-svn: 67393
2009-03-20 19:38:56 +00:00
Daniel Dunbar 7f2600244c Driver: Parse Darwin version out of target triple.
llvm-svn: 67388
2009-03-20 18:21:51 +00:00
Daniel Dunbar be2208472c Driver: Add and use darwin::Assemble tool.
- Based on patch from Pieter de Bie; thanks!

llvm-svn: 67379
2009-03-20 16:06:39 +00:00
Daniel Dunbar e81cc832f6 Driver: Add two option overload for AddAllArgValues.
llvm-svn: 67377
2009-03-20 15:59:01 +00:00
Daniel Dunbar 0e75994e8b Driver: Add Arg::getAsString and use when dumping arguments to
diagnostics.
 - This ensures that the whole argument and values are printed,
   instead of just the option name.

llvm-svn: 67366
2009-03-20 06:14:23 +00:00
Chris Lattner 03b886e301 strictly evaluate SVN_REVISION so that svnversion is run once instead of 4 times.
llvm-svn: 67365
2009-03-20 05:23:53 +00:00
Daniel Dunbar d972e2247b Driver: Implement -print-search-dirs.
llvm-svn: 67362
2009-03-20 04:37:21 +00:00
Daniel Dunbar 03e0a4f324 Driver: Sketch Darwin tool chains.
llvm-svn: 67356
2009-03-20 00:57:52 +00:00
Daniel Dunbar 64ed5e3730 Driver: Add darwin::Lipo tool.
llvm-svn: 67355
2009-03-20 00:52:38 +00:00
Daniel Dunbar 59e5e880f3 Driver: Move tool chain implementations into ToolChains.cpp.
llvm-svn: 67350
2009-03-20 00:20:03 +00:00
Daniel Dunbar 1fc898c40a Driver: Temporary hack to allow -ccc-print-bindings to work (for
testing) even with -pipe on.

llvm-svn: 67348
2009-03-20 00:11:04 +00:00
Daniel Dunbar 403c468065 Driver/clang: -mattr strings were not comma separated.
- Apologies for commits w/o test cases; they are coming.

llvm-svn: 67310
2009-03-19 17:36:04 +00:00
Daniel Dunbar 8d6ab2afa6 Driver: Compilation::Execute wasn't returning result code correctly.
llvm-svn: 67296
2009-03-19 08:03:45 +00:00
Daniel Dunbar 1da82ae5bd Driver: Executing piped jobs with a single command is easy.
llvm-svn: 67295
2009-03-19 08:01:45 +00:00
Daniel Dunbar adc5c7c2fd Driver: Claim unused input arguments when emitting "input file unused"
diagnostic (to suppress more generic unused warning).

llvm-svn: 67294
2009-03-19 07:57:08 +00:00
Daniel Dunbar 2da027244d Driver: Claim -arch options when pipelining, and claim arguments that
are forwarded to GCC.
 - The later is unfortunate, as it prevents us from generally warning
   about anything interesting on platforms that use a generic
   toolchain. However, we can't do much better without significantly
   complicating things, and generally we should have proper tool chain
   definitions.

llvm-svn: 67293
2009-03-19 07:55:12 +00:00
Daniel Dunbar 5cdf3e0fb9 Driver: Handle "linker input" arguments.
- Make InputInfo a variant of filename, pipe, input argument,
   nothing.

 - Leave a FIXME in InputInfo that this should be revisited.

llvm-svn: 67292
2009-03-19 07:29:38 +00:00
Daniel Dunbar 0e227785cb Driver: Add Arg::renderAsInput; this is a messy area and something I
was hoping to clean up in the rewrite, but I don't see it yet.

llvm-svn: 67291
2009-03-19 07:22:40 +00:00
Daniel Dunbar 7ef5ed6c16 Driver: Fix bug in translating -O to clang, add clang-translation test
case.

llvm-svn: 67257
2009-03-18 23:39:35 +00:00
Daniel Dunbar 483693941c Driver: Resolve program path for "cp" (used as part of transparent gcc
PCH support).

llvm-svn: 67256
2009-03-18 23:34:15 +00:00
Daniel Dunbar c4acf9d516 Driver: Forcibly disable pipe support until we can execute them, the
driver is functional without them.

llvm-svn: 67254
2009-03-18 23:18:19 +00:00
Daniel Dunbar 18d69de523 Driver: Delete the temporary files llvm::sys::Path::makeUnique
sometimes leaves around.

llvm-svn: 67253
2009-03-18 23:08:52 +00:00
Mike Stump 1a0d5707af Make -j8 safe.
llvm-svn: 67252
2009-03-18 22:53:10 +00:00
Daniel Dunbar 64316c49a6 Driver: Execute jobs; no pipe support yet.
llvm-svn: 67250
2009-03-18 22:44:24 +00:00
Daniel Dunbar 6c17bfd99b Driver: Cleanup temporary/result files.
llvm-svn: 67248
2009-03-18 22:16:03 +00:00
Daniel Dunbar 6f66877ebf Driver: Lookup program names using llvm::sys::Program::FindProgramByName
if our usual methods fail. This isn't necessary for running the tool,
but improves the accuracy of logging output.

Also, have GCC tools lookup gcc program path.

llvm-svn: 67243
2009-03-18 21:34:08 +00:00
Mike Stump fc17674d6b The eventual name of this will be clang, might as well start now.
llvm-svn: 67241
2009-03-18 21:19:11 +00:00
Daniel Dunbar 68b01a03ba Driver: Support ToolChain specific path lists to search for files and
programs.

llvm-svn: 67229
2009-03-18 20:26:19 +00:00
Mike Stump 25d1dc2a20 Move generated file to ObjDir.
llvm-svn: 67225
2009-03-18 20:12:50 +00:00
Daniel Dunbar e627c1cc0f Driver: Construct temporary file names.
- This is still suboptimal, but should at least be workable.

llvm-svn: 67223
2009-03-18 19:34:39 +00:00
Mike Stump 1dca7c0061 Add revision information.
llvm-svn: 67220
2009-03-18 18:45:55 +00:00
Daniel Dunbar d175d9753b Driver: Don't warn about unused arguments if there are Driver errors
(brings code in line with diagnostic.

llvm-svn: 67217
2009-03-18 18:03:46 +00:00
Mike Stump 3b79d59be7 Fix URL trimming for version information.
llvm-svn: 67206
2009-03-18 15:19:35 +00:00
Mike Stump 02537142c1 Improve version number.
llvm-svn: 67204
2009-03-18 14:00:02 +00:00
Daniel Dunbar a2aedc6943 Driver: Port Clang argument translation.
llvm-svn: 67193
2009-03-18 10:01:51 +00:00
Daniel Dunbar e6c8319943 Driver: Bug fix, derived .gch names sometimes started with "/".
llvm-svn: 67192
2009-03-18 09:58:30 +00:00
Daniel Dunbar 7591f29f7c Driver: Add argument translation utilities to ArgList.
- Support things like telling which -ffoo -fno-foo option won, and
   forwarding all arguments matching a certain set of options to the
   tool.

llvm-svn: 67189
2009-03-18 09:29:36 +00:00
Daniel Dunbar a3246a0638 Driver: Lift out common GCC tool and implement generic GCC tool
argument translation.

Also, stub out clang tool implementation a bit more.

llvm-svn: 67185
2009-03-18 08:07:30 +00:00
Daniel Dunbar dcd05482bd Driver: Add assert and FIXME; arguments which act as linker inputs
(e.g., -filelist) are currently broken.

llvm-svn: 67183
2009-03-18 08:02:40 +00:00
Daniel Dunbar 8eba365d36 Driver: Provide Arg::render implementations.
llvm-svn: 67182
2009-03-18 08:01:48 +00:00
Daniel Dunbar 4b6058e33a Driver: Add "d" flag to Options.def for options which are completely
handled by driver. 
 - This is not very precise, we use it to drive the "forward-to-gcc"
   predicate, when trying to talk to a generic gcc tool.

 - Slightly better than what ccc was doing, and should be good
   enough. Platforms which want a robust driver should implement a
   proper tool chain.

llvm-svn: 67181
2009-03-18 08:01:15 +00:00
Daniel Dunbar 04c4c2c3db Driver: ConstructJob also needs to know the destination (where to put
its commands).

llvm-svn: 67179
2009-03-18 07:06:02 +00:00
Daniel Dunbar 3beceaf7f1 Driver: Print version on stderr to match [gc]cc.
llvm-svn: 67178
2009-03-18 06:51:03 +00:00
Daniel Dunbar 0928b3125c Driver: Implement -### (hard to tell, since we don't actually
construct any jobs).

llvm-svn: 67177
2009-03-18 06:49:39 +00:00
Daniel Dunbar 2b4bda8073 Driver: Claim inputs when we bind the InputAction.
llvm-svn: 67174
2009-03-18 06:21:12 +00:00
Daniel Dunbar e4197f6203 Driver: Rename Command::Argv to Command::Arguments to make it clearer
that this does not include the implicit first argument (the executable
name).

llvm-svn: 67172
2009-03-18 06:13:37 +00:00
Daniel Dunbar bcd775b436 Driver: Don't claim inputs when pipelining, a tool should eventually
claim these.

llvm-svn: 67171
2009-03-18 06:09:38 +00:00
Daniel Dunbar 0450e6dc4c Driver: Add a dash of const.
llvm-svn: 67170
2009-03-18 06:07:59 +00:00
Daniel Dunbar 1a093d2049 Driver: Stub out Tool::ConstructJob.
llvm-svn: 67169
2009-03-18 06:00:36 +00:00
Daniel Dunbar aabaac4743 Driver: Fix Compilation::getArgsForToolChain, local variable was
shadowing member.

llvm-svn: 67167
2009-03-18 05:58:45 +00:00
Daniel Dunbar 1197adcbf1 Driver: Add two normalizations for powerpc.
- PR3830

llvm-svn: 67166
2009-03-18 04:41:46 +00:00
Daniel Dunbar eb843bedf9 Driver: Ditch Driver::DefaultToolChain, this can vary between compilations.
llvm-svn: 67162
2009-03-18 03:13:20 +00:00
Daniel Dunbar 896cb66166 Driver: I was too hasty in free'ing Actions, we sometimes share
Actions so a simple tree traversal isn't quite good enough. Leaving a
FIXME for now.

llvm-svn: 67161
2009-03-18 03:02:22 +00:00
Daniel Dunbar 06d918c2f4 Driver: Initialize Arg::Claimed
llvm-svn: 67160
2009-03-18 02:57:50 +00:00
Daniel Dunbar f0eddb8510 Driver: Move actions into Compilation, and construct the compilation
earlier.

 - This gives us a simple ownership model, and allows clients access
   to more information should they ever want it.

 - We now free Actions correctly.

llvm-svn: 67158
2009-03-18 02:55:38 +00:00
Daniel Dunbar d00978bc0d Driver: Add test for binding of precompile; exposed bug due to my
flawed idea that llvm::sys::Path::getBasename was a version of
basename().

llvm-svn: 67153
2009-03-18 02:00:31 +00:00
Daniel Dunbar 338d74898c Driver: Implement JoinedAndSeparateArg::getValue and add parsing test
case.

llvm-svn: 67151
2009-03-18 01:48:37 +00:00
Daniel Dunbar 6965c2b113 Driver: UnknownHostInfo was always returning 0.
llvm-svn: 67150
2009-03-18 01:39:08 +00:00
Daniel Dunbar 2608c548b5 Driver: Use PrettyStackTrace.
llvm-svn: 67149
2009-03-18 01:38:48 +00:00
Daniel Dunbar 0160172228 Driver: Release Host, ToolChain, and Tool implementations.
llvm-svn: 67146
2009-03-18 01:09:40 +00:00
Daniel Dunbar 389fe1f563 Driver: Add test case for -ccc-clang-archs (which, it turns out, was
inverted).

llvm-svn: 67135
2009-03-18 00:12:31 +00:00
Daniel Dunbar b39cc52eda Driver: Add -ccc-print-bindings option (for testing); the Python
driver has no corresponding option.

llvm-svn: 67125
2009-03-17 22:47:06 +00:00
Daniel Dunbar 82116f8df4 Driver: Add name to Tool (for testing/debugging) and move GCC_* tools
into gcc:: namespace.

llvm-svn: 67120
2009-03-17 22:45:24 +00:00
Chris Lattner f568f8c889 GCC 4.0 isn't happy with VISIBILITY_HIDDEN on a namespace.
llvm-svn: 67112
2009-03-17 22:24:01 +00:00
Daniel Dunbar 15abb2ee0e Driver: GCC 4.0 isn't happy with VISIBILITY_HIDDEN on a namespace.
llvm-svn: 67110
2009-03-17 22:18:43 +00:00
Daniel Dunbar 5903d8c08a Driver: Stub out generic GCC tool selection (missed a file)
llvm-svn: 67109
2009-03-17 22:07:58 +00:00
Daniel Dunbar 04cb029e0b Driver: Stub out generic GCC tool selection.
llvm-svn: 67108
2009-03-17 22:07:31 +00:00
Daniel Dunbar 0a248bb5c2 Driver: Stub out generic GCC tool chain implementation.
llvm-svn: 67107
2009-03-17 21:38:00 +00:00
Daniel Dunbar 71bdee6ea1 Driver: Make sure to get the default arch name from the tool chain, not the
host; the toolchain may differ based on command line arguments.

llvm-svn: 67106
2009-03-17 21:29:52 +00:00
Daniel Dunbar 7a70c5ddbf Driver: Pass HostInfo reference into ToolChain.
llvm-svn: 67105
2009-03-17 21:21:26 +00:00
Daniel Dunbar 52e0c70868 Driver: Pass Driver reference down into Host info, which will need it
to pass to ToolChains, which may need Driver specific information (for
example, to form search paths).

llvm-svn: 67102
2009-03-17 20:45:45 +00:00
Daniel Dunbar 62ca7d23ce Driver: Fix typo ArgList destructor.
llvm-svn: 67101
2009-03-17 20:44:29 +00:00
Daniel Dunbar b42a26c0a5 Driver: Hide HostInfo implementations.
- Also, normalize arch names a tad and stub out getToolChain
   implementations.

llvm-svn: 67091
2009-03-17 19:00:50 +00:00
Daniel Dunbar c1b70b2039 Driver: Add two option form of ArgList::getLastArg.
llvm-svn: 67090
2009-03-17 18:51:42 +00:00
Daniel Dunbar 7a178a40a1 Driver: Add logic for computing where to put job outputs (pipe,
temporary file, user provided name, derived name).

llvm-svn: 67088
2009-03-17 17:53:55 +00:00
Daniel Dunbar 527e2b3f8c Add ArgList::MakeArgString and make ArgList::Make* const.
- Slightly strange, but the idea is that the ArgList data structure
   is primarily a list of arguments; we want to allow clients to still
   add argument strings to an ArgList to avoid worrying about string
   lifetimes (or unnecessary string copying).

llvm-svn: 67086
2009-03-17 17:51:18 +00:00
Daniel Dunbar 6865a9e975 Fix unused variable warning in -Asserts mode.
llvm-svn: 67073
2009-03-17 04:12:06 +00:00
Douglas Gregor 23d75bb326 Build system changes to use TableGen to generate the various
diagnostics. This builds on the patch that Sebastian committed and
then revert. Major differences are:

  - We don't remove or use the current ".def" files. Instead, for now,
    we just make sure that we're building the ".inc" files.
  - Fixed CMake makefiles to run TableGen and build the ".inc" files
    when needed. Tested with both the Xcode and Makefile generators
    provided by CMake, so it should be solid.
  - Fixed normal makefiles to handle out-of-source builds that involve
    the ".inc" files.

I'll send a separate patch to the list with Sebastian's changes that
eliminate the use of the .def files.

llvm-svn: 67058
2009-03-16 23:06:59 +00:00
Daniel Dunbar e75d834c7c Driver: Implement majority tool binding logic.
- Still need code for determining proper output location.

 - Doesn't work yet, of course, as the host isn't providing real
   tool chains.

 - Interface still has a few warts, but has gotten a nice bit of
   polish during the rewrite.

llvm-svn: 67038
2009-03-16 06:56:51 +00:00
Daniel Dunbar 3ce436d229 Driver: Migrate some data into the Compilation; after pipelining
access to most data should go through the current Compilation, not the
Driver (which shouldn't be specialized on variables for a single
compilation).

llvm-svn: 67037
2009-03-16 06:42:30 +00:00
Daniel Dunbar 9e2136d930 Driver: Sketch Tool and ToolChain classes.
llvm-svn: 67036
2009-03-16 05:25:36 +00:00
Daniel Dunbar 02ae54c549 Driver: claim input arguments when building phases.
llvm-svn: 67016
2009-03-15 01:40:22 +00:00
Daniel Dunbar adc91e6597 Driver: Start warning about unused arguments.
- This has a number of current flaws, enabling now to flush out
   problems while bringing up other parts.

llvm-svn: 67015
2009-03-15 01:38:15 +00:00
Daniel Dunbar ae0e55eb7f Driver: Update ArgList::{hasArg,getLastArg} to optionally claim the
arguments if they exist.

llvm-svn: 67014
2009-03-15 00:48:16 +00:00
Daniel Dunbar 1bb3b2ccf3 Driver: Add types::{isAcceptedByClang,isCXX} predicates.
llvm-svn: 66986
2009-03-13 23:46:19 +00:00
Daniel Dunbar 313c291269 Driver: Add simple Job classes, simple wrappers for information about
what processes to execute during a compilation.

llvm-svn: 66985
2009-03-13 23:36:33 +00:00
Daniel Dunbar 438ff8dbe7 Driver: Action vtables were still hungry.
llvm-svn: 66980
2009-03-13 23:17:57 +00:00
Daniel Dunbar 3f261ff66b Driver: Provide food and shelter for Action vtables.
llvm-svn: 66978
2009-03-13 23:08:03 +00:00
Daniel Dunbar 95e6b191cb Driver: Sprinkle some consts in, stub out BuildJobs method.
llvm-svn: 66968
2009-03-13 22:12:33 +00:00
Daniel Dunbar e5dc48233f Driver: For universal builds, handle archs in the order they were seen.
llvm-svn: 66939
2009-03-13 20:33:35 +00:00
Daniel Dunbar c5a5ac5015 Driver: Fix '-x none' handling.
- Enough stuff works now we can test argument parsing & pipelining.

llvm-svn: 66913
2009-03-13 17:57:10 +00:00
Daniel Dunbar 7326ad57a4 ccc/Driver: Normalize phase spelling in -ccc-print-phases.
llvm-svn: 66912
2009-03-13 17:52:07 +00:00
Daniel Dunbar e2ca3bddde Driver: Some minor bug fixes.
- language recognition was recognizing prefixes incorrectly.
 - -x none wasn't working.
 - test for "can lipo" was backwords.
 - missed a '"' in -ccc-print-phases

llvm-svn: 66911
2009-03-13 17:46:02 +00:00
Daniel Dunbar dfab7abdea Driver: Fix think in ArgList::MakeIndex.
llvm-svn: 66908
2009-03-13 17:25:24 +00:00
Daniel Dunbar 3efedddcf9 Driver: Return 0 from BuildCompilation on -ccc-print-phases,
-ccc-print-options.

llvm-svn: 66907
2009-03-13 17:24:34 +00:00
Daniel Dunbar ed50f6c356 Driver: Print -ccc-print-phases on stderr.
llvm-svn: 66906
2009-03-13 17:20:20 +00:00
Daniel Dunbar 0a180f1499 Driver: Fix thinko in Darwin host identification.
llvm-svn: 66889
2009-03-13 12:23:29 +00:00
Daniel Dunbar aaf1ea6386 Driver: Support -ccc-print-phases.
llvm-svn: 66888
2009-03-13 12:19:02 +00:00
Daniel Dunbar 80665fb0c5 Driver: Add cast<> support for Action, and some other accessors.
llvm-svn: 66887
2009-03-13 12:17:08 +00:00
Daniel Dunbar 6522933d7a Driver: Complete "pipelining" (building the list of abstract actions
to perform). Still doesn't do anything interesting.
 - This code came out much cleaner than in ccc with the reworked
   phases & mapping of types to lists of compilation steps (phases) to
   perform.

llvm-svn: 66885
2009-03-13 11:38:42 +00:00
Gabor Greif aa033f9570 support cmake
llvm-svn: 66884
2009-03-13 11:37:39 +00:00
Daniel Dunbar 286c39a993 Driver: Make phase names nouns not verbs.
llvm-svn: 66883
2009-03-13 11:36:01 +00:00
Daniel Dunbar e71b9640ad Driver: Add types::getNumCompilationPhases, getCompilationPhase to
provide information about what steps should be done for a particular
file type.

llvm-svn: 66881
2009-03-13 11:28:30 +00:00
Daniel Dunbar 58cac7ca68 Driver: Pull Phase info into separate file.
llvm-svn: 66880
2009-03-13 11:27:05 +00:00
Daniel Dunbar 0f35a026a9 Driver: Ignore empty arguments.
llvm-svn: 66858
2009-03-13 01:01:44 +00:00
Daniel Dunbar 5e0f6af190 Driver: Handle "immediate" options.
Also, add some FIXMEs, improve doxygen & comments.

llvm-svn: 66857
2009-03-13 00:51:18 +00:00
Daniel Dunbar 34c4187152 ccc/Driver: Mark {dump{machine,specs,version},
print-{multi-{directory,lib,os-directory}, search-dirs} as unsupported
instead of handling separately.

llvm-svn: 66848
2009-03-13 00:17:48 +00:00
Daniel Dunbar bfeec7443f Driver: Determine which compilation stages to run.
llvm-svn: 66844
2009-03-12 23:55:14 +00:00
Daniel Dunbar 92c2af76c4 Driver: Value initialization is nicer than memset.
- Who wouldn't want correctness to hang critically on two easily
   ignored characters?

Thanks Doug!

llvm-svn: 66819
2009-03-12 18:42:02 +00:00
Daniel Dunbar f479c1293e Driver: Add majority of driver-driver implementation.
- Compare to driverdriver.c if bored; not completely fair since the
   driver gets a bit more code in other places to handle binding archs
   (for Xarch) but not completely unfair either.

Fear not, extra Action classes will have a happy home for their
vtables soon.

llvm-svn: 66817
2009-03-12 18:40:18 +00:00
Daniel Dunbar 57fc0194a8 Driver: Drop some unnecessary uses of clang namespace.
llvm-svn: 66813
2009-03-12 18:31:08 +00:00
Daniel Dunbar 446f684332 Driver: Introduce ActionList typedef, tweak some constness.
llvm-svn: 66809
2009-03-12 18:24:49 +00:00
Daniel Dunbar 208f0269e7 Driver: Add types::canLipoType helper method.
llvm-svn: 66807
2009-03-12 18:21:41 +00:00
Daniel Dunbar 7c8d653a2c Driver: Add ArgList support for synthesizing arguments.
llvm-svn: 66805
2009-03-12 18:20:18 +00:00
Daniel Dunbar 7586bb9de8 Driver: Add ArgList::getLastArg.
llvm-svn: 66794
2009-03-12 16:03:38 +00:00
Daniel Dunbar 5cd1e419b7 Driver: Tweak diag names to be more consistent.
llvm-svn: 66787
2009-03-12 09:13:48 +00:00
Daniel Dunbar c0b3e95a1a Driver: Use standard Diagnostic interface for diagnostics.
llvm-svn: 66786
2009-03-12 08:55:43 +00:00
Daniel Dunbar 33699689ed Driver: Fix thinko in Arg::hasArg.
llvm-svn: 66785
2009-03-12 08:45:11 +00:00
Daniel Dunbar d971762d5a Driver: '-' is parsed as an input.
llvm-svn: 66784
2009-03-12 08:44:47 +00:00
Daniel Dunbar 1688f1a7e0 Driver: Start sketching construction of abstract built actions.
llvm-svn: 66783
2009-03-12 07:58:46 +00:00
Daniel Dunbar 1a8738935c Driver: Add information on Driver input/temporary types.
llvm-svn: 66781
2009-03-12 07:40:41 +00:00
Daniel Dunbar 6d3d46bbeb Driver: Add Option flags.
llvm-svn: 66774
2009-03-12 05:46:32 +00:00
Daniel Dunbar c727e9310d Driver: Tweak option naming/def:
- Use OPT_ prefix for ids.

 - Reference groups and aliases by shortend id (on the theory that
   this is more readable).

 - Rename the special option ids to more protected names.

llvm-svn: 66767
2009-03-12 03:42:54 +00:00
Daniel Dunbar 71dc375142 Driver: Reorder arguments in Options.def so option name is first.
llvm-svn: 66759
2009-03-12 01:46:53 +00:00
Daniel Dunbar 2c3939cb5d Driver: Add ArgList::hasArg, for testing for the presence of an
argument matching some Option::ID.

llvm-svn: 66758
2009-03-12 01:36:44 +00:00
Daniel Dunbar 8fa943436b Driver: Add Option::getId and Option::matches taking an option
identifier; we will want to use the latter in situations where we just
want to check for a match, but not load options unnecessarily.

llvm-svn: 66757
2009-03-12 01:34:20 +00:00
Daniel Dunbar 4cb4e1d72b Driver: Add host info (add new files).
llvm-svn: 66603
2009-03-10 23:50:49 +00:00
Daniel Dunbar 4dff6a4973 Driver: Add host info.
- Replace assorted -ccc-host-* options by -ccc-host-triple which is
   more sane.

llvm-svn: 66600
2009-03-10 23:41:59 +00:00
Daniel Dunbar ee66cf2249 Driver: Handle magic -ccc- options.
- Follows ccc currently, but this functionality should eventually be
   outside the Driver lib.

llvm-svn: 66575
2009-03-10 20:52:46 +00:00
Daniel Dunbar 4095d89532 Remove some now-unneeded calls to llvm::errs().flush().
llvm-svn: 66555
2009-03-10 18:00:19 +00:00
Mike Stump 82d8d559bb Fix warnings in build on clang-x86_64-freebsd buildbot.
llvm-svn: 66344
2009-03-07 18:35:41 +00:00
Daniel Dunbar d02cb1dc2b Driver: Basic argument parsing.
- Add Driver::ParseArgStrings.
 - Store values directly in CommaJoinedArg to support simple access.
 - Add FlagArg class.

llvm-svn: 66142
2009-03-05 06:38:47 +00:00
Daniel Dunbar 458b6982d4 Driver: Implement Option::accept methods.
llvm-svn: 66106
2009-03-04 23:22:02 +00:00
Daniel Dunbar b7396f10b9 Driver: Fix off by one in ParseOneArg; this code is ugly but will be
replaced anyway.

llvm-svn: 66101
2009-03-04 23:03:35 +00:00
Daniel Dunbar 135837e046 Driver: Add Arg::dump and SeparateArg stubs.
llvm-svn: 66100
2009-03-04 23:02:50 +00:00
Daniel Dunbar d9621da5ae Driver: Add OptTable::ParseOneArg.
llvm-svn: 66090
2009-03-04 22:41:37 +00:00
Daniel Dunbar 16b9fd447a Driver: Add ArgList::{append, getArgString}
llvm-svn: 66089
2009-03-04 22:40:08 +00:00
Daniel Dunbar 9333fc656d Driver: Stub out Arg implementations.
llvm-svn: 66088
2009-03-04 22:37:52 +00:00
Daniel Dunbar a59194cd10 Driver: Option's need to know their ID.
- Also, add Input and Unknown opts to OptTable.

llvm-svn: 66079
2009-03-04 21:53:04 +00:00
Daniel Dunbar f49bc318ed Driver: Add Option flags.
llvm-svn: 66067
2009-03-04 21:05:23 +00:00
Daniel Dunbar 53bbc31ebd Driver: Tweak Option::accept interface.
llvm-svn: 66066
2009-03-04 20:53:00 +00:00
Daniel Dunbar b2cd66bf4d Driver: Sink Driver/Compilation into clang::driver namespace.
- Add OptTable instance to Driver.

llvm-svn: 66063
2009-03-04 20:49:20 +00:00
Daniel Dunbar 3e2cbc3161 Driver: Add ArgList implementation.
llvm-svn: 66037
2009-03-04 17:10:42 +00:00
Daniel Dunbar 5637208a88 Driver: More Option implementation.
- Add Options.def file, collects option information.

 - Actual option instantiation is handled lazily by OptTable to allow
   the driver to not need to instantiate all options.

 - cast<> support for Option, other minor tweaks.

llvm-svn: 66028
2009-03-04 08:33:23 +00:00
Daniel Dunbar b2da933989 Sketch Driver Option classes.
llvm-svn: 65933
2009-03-03 05:55:11 +00:00
Daniel Dunbar 544ecd14b6 Stub out some structure for C++ driver.
llvm-svn: 65867
2009-03-02 19:59:07 +00:00
Daniel Dunbar 51adf5824e Rename lib/Driver (etc) to lib/Frontend in prep for the *actual*
driver taking lib/Driver.

llvm-svn: 65811
2009-03-02 06:16:29 +00:00
Douglas Gregor 87f95b0a6a Introduce code modification hints into the diagnostics system. When we
know how to recover from an error, we can attach a hint to the
diagnostic that states how to modify the code, which can be one of:

  - Insert some new code (a text string) at a particular source
    location
  - Remove the code within a given range
  - Replace the code within a given range with some new code (a text
    string)

Right now, we use these hints to annotate diagnostic information. For
example, if one uses the '>>' in a template argument in C++98, as in
this code:

  template<int I> class B { };
  B<1000 >> 2> *b1;

we'll warn that the behavior will change in C++0x. The fix is to
insert parenthese, so we use code insertion annotations to illustrate
where the parentheses go:

test.cpp:10:10: warning: use of right-shift operator ('>>') in template
argument will require parentheses in C++0x
  B<1000 >> 2> *b1;
         ^
    (        )


Use of these annotations is partially implemented for HTML
diagnostics, but it's not (yet) producing valid HTML, which may be
related to PR2386, so it has been #if 0'd out.

In this future, we could consider hooking this mechanism up to the
rewriter to actually try to fix these problems during compilation (or,
after a compilation whose only errors have fixes). For now, however, I
suggest that we use these code modification hints whenever we can, so
that we get better diagnostics now and will have better coverage when
we find better ways to use this information.

This also fixes PR3410 by placing the complaint about missing tokens
just after the previous token (rather than at the location of the next
token).

llvm-svn: 65570
2009-02-26 21:00:50 +00:00
Chris Lattner d92f1bfa11 add c++ search path for GCC 4.2, PR3668, patch by Pawel Worach!
llvm-svn: 65462
2009-02-25 18:06:37 +00:00
Chris Lattner 464ceb4ec8 map source ranges through macro expansions. Before:
t.m:5:2: error: invalid operands to binary expression ('typeof(P)' (aka 'struct mystruct') and 'typeof(F)' (aka 'float'))
 MAX(P, F);
 ^~~~~~~~~
t.m:1:78: note: instantiated from:
#define MAX(A,B)    ({ __typeof__(A) __a = (A); __typeof__(B) __b = (B); __a < __b ? __b : __a; })
                                                                             ^

(no ranges on the second diagnostics)

After:

t.m:5:2: error: invalid operands to binary expression ('typeof(P)' (aka 'struct mystruct') and 'typeof(F)' (aka 'float'))
 MAX(P, F);
 ^~~~~~~~~
t.m:1:78: note: instantiated from:
#define MAX(A,B)    ({ __typeof__(A) __a = (A); __typeof__(B) __b = (B); __a < __b ? __b : __a; })
                                                                         ~~~ ^ ~~~

(ranges!)

llvm-svn: 65090
2009-02-20 00:25:28 +00:00
Chris Lattner 1973d84625 refactor, pass ranges down instead of the whole
DiagnosticInfo.

llvm-svn: 65088
2009-02-20 00:18:51 +00:00
Chris Lattner 06ef388a61 fix a bug introduced in my previous patch: moving clang headers to the
"after" group instead of the system group makes it so #include <limits.h>
picks up the *system* limits.h file before clang's.  This causes a failure
on linux and is definitely not what we want.

llvm-svn: 65026
2009-02-19 06:48:28 +00:00
Chris Lattner 45d26bd00d PR3614: "ignoring nonexistent directory" should print the -isysroot
mapped path, not the requested path.

llvm-svn: 65009
2009-02-19 04:48:57 +00:00
Ted Kremenek ea3a9e270c HTMLDiagnostics: Always display diagnostics *below* the line in question.
llvm-svn: 64959
2009-02-18 22:10:00 +00:00
Chris Lattner 24eb28bcf8 tidy up
llvm-svn: 64934
2009-02-18 18:50:45 +00:00
Chris Lattner 970f245439 stop searching GCC install directories for standard C headers (but
keep searching for C++ headers when in C++ mode).  In theory clang
should be able to find all of its own headers now.  If not, the
CPATH or C_INCLUDE_PATH environment variables can be specified to
add a include path.

llvm-svn: 64862
2009-02-18 00:25:15 +00:00
Ben Laurie 54a06ce437 Handle fatal errors.
llvm-svn: 64770
2009-02-17 17:32:22 +00:00
Chris Lattner 7b60a164b1 As an experimental hack, emit "instantiated from" information in
diagnostics.  I'm not sure I want to keep this, but hey, it's easy
and could be useful or something, even if guarded by a 
-fshow-me-tons-of-details option.  A silly example is:

#define A B
#define C A
#define D C

int y = D;

We now emit:

t.c:11:9: error: use of undeclared identifier 'B'
int y = D;
        ^
t.c:9:11: note: instantiated from:
#define D C
          ^
t.c:8:11: note: instantiated from:
#define C A
          ^
t.c:7:11: note: instantiated from:
#define A B
          ^

A more useful example is from tgmath:

t.c:4:9: error: no matching function for call to '__tg_acos'
 return acos(x);
        ^~~~~~~
/Users/sabre/llvm/Debug/Headers/tgmath-sofar.h:51:17: note: instantiated from:
#define acos(x) __tg_acos(x)
                ^
... candidate set follows ...

This does not yet print ranges in instantiation info, (e.g. highlighting the
range "__tg_acos(x)" in the last example), but that could be added if we 
decide this is a good idea :).

Thoughts and bug reports welcome!

llvm-svn: 64761
2009-02-17 08:44:50 +00:00
Chris Lattner 5abfe97bf1 sink a call to getInstantiationLoc to eliminate an assertion.
llvm-svn: 64755
2009-02-17 07:54:55 +00:00
Chris Lattner d22603cef0 break down EmitCaretDiagnostic to use more primitive calls.
llvm-svn: 64754
2009-02-17 07:51:53 +00:00
Chris Lattner 2cf68c1e96 split caret diagnostic printing out into its own function.
llvm-svn: 64751
2009-02-17 07:38:37 +00:00
Chris Lattner 11a2a433b2 simplify some code.
llvm-svn: 64750
2009-02-17 07:34:34 +00:00
Chris Lattner b42700f555 If a source range comes through a function-like macro expansion,
highlight the arguments to the macro as well as the identifier.

Before:

t.c:3:9: error: no matching function for call to '__tg_acos'; candidates are:
 return acos(x);
        ^~~~

after:

t.c:3:9: error: no matching function for call to '__tg_acos'; candidates are:
 return acos(x);
        ^~~~~~~

llvm-svn: 64743
2009-02-17 05:19:10 +00:00
Chris Lattner 24c911e25a use some references to simplify code.
llvm-svn: 64063
2009-02-08 01:00:10 +00:00
Chris Lattner bf20a9a57d Genericize the existing logic for removing duplicate header dirs to apply
the "system dirs win over user dirs" logic to framework and headermap
search locations as well as normal directories.  This means that
clang t.m -F/System/Library/Frameworks  will treat /System/Library/Frameworks
as a system directory not a user directory.  If you use -v, the difference is:

Before:
ignoring nonexistent directory "/usr/libdata/gcc41"
ignoring duplicate framework "/System/Library/Frameworks"
#include "..." search starts here:
#include <...> search starts here:

After:
ignoring nonexistent directory "/usr/libdata/gcc41"
ignoring duplicate directory "/System/Library/Frameworks"
  as it is a non-system directory that duplicates a system directory
#include "..." search starts here:
#include <...> search starts here:

This fixes rdar://6566429.

llvm-svn: 64060
2009-02-08 00:55:22 +00:00
Chris Lattner b05f49e7fd handle fatal errors, rely on warnings to point out missing cases.
llvm-svn: 63913
2009-02-06 03:57:44 +00:00
Torok Edwin c6853c1531 Add Debian gcc 4.3 header search directories.
llvm-svn: 63872
2009-02-05 18:12:45 +00:00
Chris Lattner 88ea93e6b4 lower the interface to getLineNumber like we did for
getColumnNumber.  This fixes a FIXME in 
SourceManager::getPresumedLoc because we now just decompose
the sloc once.

llvm-svn: 63701
2009-02-04 01:06:56 +00:00