Граф коммитов

1433 Коммитов

Автор SHA1 Сообщение Дата
Daniel Dunbar b488c1dac8 Driver: Lift out common GCC tool and implement generic GCC tool
argument translation.

Also, stub out clang tool implementation a bit more.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67185 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-18 08:07:30 +00:00
Daniel Dunbar d09986a6fb Driver: Add assert and FIXME; arguments which act as linker inputs
(e.g., -filelist) are currently broken.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67183 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-18 08:02:40 +00:00
Daniel Dunbar 21fd6ac7ae Driver: Provide Arg::render implementations.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67182 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-18 08:01:48 +00:00
Daniel Dunbar 6d954d7889 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67181 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-18 08:01:15 +00:00
Daniel Dunbar 871adcf4e4 Driver: ConstructJob also needs to know the destination (where to put
its commands).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67179 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-18 07:06:02 +00:00
Daniel Dunbar aa469f62f2 Driver: Print version on stderr to match [gc]cc.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67178 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-18 06:51:03 +00:00
Daniel Dunbar 24b5560b6e Driver: Implement -### (hard to tell, since we don't actually
construct any jobs).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67177 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-18 06:49:39 +00:00
Daniel Dunbar 5ab483b2c8 Driver: Claim inputs when we bind the InputAction.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67174 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-18 06:21:12 +00:00
Daniel Dunbar d57ac5990d Driver: Rename Command::Argv to Command::Arguments to make it clearer
that this does not include the implicit first argument (the executable
name).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67172 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-18 06:13:37 +00:00
Daniel Dunbar 028801c66f Driver: Don't claim inputs when pipelining, a tool should eventually
claim these.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67171 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-18 06:09:38 +00:00
Daniel Dunbar 62cf601812 Driver: Add a dash of const.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67170 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-18 06:07:59 +00:00
Daniel Dunbar 47ac7d27c4 Driver: Stub out Tool::ConstructJob.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67169 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-18 06:00:36 +00:00
Daniel Dunbar aa3e0d2920 Driver: Fix Compilation::getArgsForToolChain, local variable was
shadowing member.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67167 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-18 05:58:45 +00:00
Daniel Dunbar c811b6c5e3 Driver: Add two normalizations for powerpc.
- PR3830


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67166 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-18 04:41:46 +00:00
Daniel Dunbar 10ffa9a488 Driver: Ditch Driver::DefaultToolChain, this can vary between compilations.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67162 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-18 03:13:20 +00:00
Daniel Dunbar e29cd6f246 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67161 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-18 03:02:22 +00:00
Daniel Dunbar 6d91b04c14 Driver: Initialize Arg::Claimed
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67160 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-18 02:57:50 +00:00
Daniel Dunbar 21549237f1 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67158 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-18 02:55:38 +00:00
Daniel Dunbar 5796bf4913 Driver: Add test for binding of precompile; exposed bug due to my
flawed idea that llvm::sys::Path::getBasename was a version of
basename().


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67153 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-18 02:00:31 +00:00
Daniel Dunbar ec29d3635b Driver: Implement JoinedAndSeparateArg::getValue and add parsing test
case.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67151 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-18 01:48:37 +00:00
Daniel Dunbar b25c7c1f83 Driver: UnknownHostInfo was always returning 0.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67150 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-18 01:39:08 +00:00
Daniel Dunbar 8f25c79e59 Driver: Use PrettyStackTrace.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67149 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-18 01:38:48 +00:00
Daniel Dunbar 7e4534d9c1 Driver: Release Host, ToolChain, and Tool implementations.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67146 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-18 01:09:40 +00:00
Daniel Dunbar d46f0acef5 Driver: Add test case for -ccc-clang-archs (which, it turns out, was
inverted).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67135 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-18 00:12:31 +00:00
Daniel Dunbar 5c3c1d7b49 Driver: Add -ccc-print-bindings option (for testing); the Python
driver has no corresponding option.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67125 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-17 22:47:06 +00:00
Daniel Dunbar 31b1e5437e Driver: Add name to Tool (for testing/debugging) and move GCC_* tools
into gcc:: namespace.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67120 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-17 22:45:24 +00:00
Chris Lattner aae82f1a91 GCC 4.0 isn't happy with VISIBILITY_HIDDEN on a namespace.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67112 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-17 22:24:01 +00:00
Daniel Dunbar 985b825eea Driver: GCC 4.0 isn't happy with VISIBILITY_HIDDEN on a namespace.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67110 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-17 22:18:43 +00:00
Daniel Dunbar 9c073ff462 Driver: Stub out generic GCC tool selection (missed a file)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67109 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-17 22:07:58 +00:00
Daniel Dunbar 670b7f4fe6 Driver: Stub out generic GCC tool selection.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67108 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-17 22:07:31 +00:00
Daniel Dunbar 83b08eb6d2 Driver: Stub out generic GCC tool chain implementation.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67107 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-17 21:38:00 +00:00
Daniel Dunbar baf07759bc 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67106 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-17 21:29:52 +00:00
Daniel Dunbar fa0cda430f Driver: Pass HostInfo reference into ToolChain.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67105 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-17 21:21:26 +00:00
Daniel Dunbar e504952bc8 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).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67102 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-17 20:45:45 +00:00
Daniel Dunbar ec504fdfef Driver: Fix typo ArgList destructor.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67101 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-17 20:44:29 +00:00
Daniel Dunbar 1fd6c4b8ab Driver: Hide HostInfo implementations.
- Also, normalize arch names a tad and stub out getToolChain
   implementations.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67091 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-17 19:00:50 +00:00
Daniel Dunbar cd4e186cdc Driver: Add two option form of ArgList::getLastArg.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67090 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-17 18:51:42 +00:00
Daniel Dunbar 441d060838 Driver: Add logic for computing where to put job outputs (pipe,
temporary file, user provided name, derived name).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67088 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-17 17:53:55 +00:00
Daniel Dunbar 3494bb1e01 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).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67086 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-17 17:51:18 +00:00
Daniel Dunbar 70c168488b Fix unused variable warning in -Asserts mode.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67073 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-17 04:12:06 +00:00
Douglas Gregor a393e9eedc 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67058 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-16 23:06:59 +00:00
Daniel Dunbar f353c8cc2e 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67038 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-16 06:56:51 +00:00
Daniel Dunbar 586dc233bb 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).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67037 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-16 06:42:30 +00:00
Daniel Dunbar 2ba38ba9a1 Driver: Sketch Tool and ToolChain classes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67036 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-16 05:25:36 +00:00
Daniel Dunbar 411f2e42f5 Driver: claim input arguments when building phases.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67016 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-15 01:40:22 +00:00
Daniel Dunbar 8d2554a2c3 Driver: Start warning about unused arguments.
- This has a number of current flaws, enabling now to flush out
   problems while bringing up other parts.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67015 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-15 01:38:15 +00:00
Daniel Dunbar 8022fd46d4 Driver: Update ArgList::{hasArg,getLastArg} to optionally claim the
arguments if they exist.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67014 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-15 00:48:16 +00:00
Daniel Dunbar 4db938ceb7 Driver: Add types::{isAcceptedByClang,isCXX} predicates.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66986 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-13 23:46:19 +00:00
Daniel Dunbar 789e220d48 Driver: Add simple Job classes, simple wrappers for information about
what processes to execute during a compilation.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66985 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-13 23:36:33 +00:00
Daniel Dunbar 0c3f599bca Driver: Action vtables were still hungry.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66980 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-13 23:17:57 +00:00
Daniel Dunbar f40ed17472 Driver: Provide food and shelter for Action vtables.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66978 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-13 23:08:03 +00:00
Daniel Dunbar 57b704d8d8 Driver: Sprinkle some consts in, stub out BuildJobs method.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66968 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-13 22:12:33 +00:00
Daniel Dunbar 1368954db9 Driver: For universal builds, handle archs in the order they were seen.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66939 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-13 20:33:35 +00:00
Daniel Dunbar 83dd21f6b4 Driver: Fix '-x none' handling.
- Enough stuff works now we can test argument parsing & pipelining.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66913 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-13 17:57:10 +00:00
Daniel Dunbar 209333506a ccc/Driver: Normalize phase spelling in -ccc-print-phases.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66912 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-13 17:52:07 +00:00
Daniel Dunbar 3dbd6c51bc 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


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66911 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-13 17:46:02 +00:00
Daniel Dunbar c0dfd53634 Driver: Fix think in ArgList::MakeIndex.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66908 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-13 17:25:24 +00:00
Daniel Dunbar ab835430b4 Driver: Return 0 from BuildCompilation on -ccc-print-phases,
-ccc-print-options.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66907 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-13 17:24:34 +00:00
Daniel Dunbar b269c32596 Driver: Print -ccc-print-phases on stderr.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66906 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-13 17:20:20 +00:00
Daniel Dunbar a88162c1b3 Driver: Fix thinko in Darwin host identification.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66889 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-13 12:23:29 +00:00
Daniel Dunbar ba1021388e Driver: Support -ccc-print-phases.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66888 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-13 12:19:02 +00:00
Daniel Dunbar 85da0071a4 Driver: Add cast<> support for Action, and some other accessors.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66887 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-13 12:17:08 +00:00
Daniel Dunbar ad2a9af666 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66885 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-13 11:38:42 +00:00
Gabor Greif 3279575a37 support cmake
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66884 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-13 11:37:39 +00:00
Daniel Dunbar 3de1e7c577 Driver: Make phase names nouns not verbs.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66883 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-13 11:36:01 +00:00
Daniel Dunbar c1b5fa81a2 Driver: Add types::getNumCompilationPhases, getCompilationPhase to
provide information about what steps should be done for a particular
file type.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66881 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-13 11:28:30 +00:00
Daniel Dunbar b1efcd824c Driver: Pull Phase info into separate file.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66880 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-13 11:27:05 +00:00
Daniel Dunbar 4139340644 Driver: Ignore empty arguments.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66858 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-13 01:01:44 +00:00
Daniel Dunbar cb881672c2 Driver: Handle "immediate" options.
Also, add some FIXMEs, improve doxygen & comments.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66857 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-13 00:51:18 +00:00
Daniel Dunbar 8b1604ece7 ccc/Driver: Mark {dump{machine,specs,version},
print-{multi-{directory,lib,os-directory}, search-dirs} as unsupported
instead of handling separately.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66848 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-13 00:17:48 +00:00
Daniel Dunbar af61c71137 Driver: Determine which compilation stages to run.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66844 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-12 23:55:14 +00:00
Daniel Dunbar 9aecfabe3f Driver: Value initialization is nicer than memset.
- Who wouldn't want correctness to hang critically on two easily
   ignored characters?

Thanks Doug!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66819 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-12 18:42:02 +00:00
Daniel Dunbar 2fe63e6ada 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66817 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-12 18:40:18 +00:00
Daniel Dunbar ba7db7d8b4 Driver: Drop some unnecessary uses of clang namespace.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66813 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-12 18:31:08 +00:00
Daniel Dunbar d65bddcbe1 Driver: Introduce ActionList typedef, tweak some constness.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66809 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-12 18:24:49 +00:00
Daniel Dunbar 9f5ef9426f Driver: Add types::canLipoType helper method.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66807 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-12 18:21:41 +00:00
Daniel Dunbar bca58cb510 Driver: Add ArgList support for synthesizing arguments.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66805 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-12 18:20:18 +00:00
Daniel Dunbar 0c562a23a6 Driver: Add ArgList::getLastArg.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66794 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-12 16:03:38 +00:00
Daniel Dunbar b897f5d3eb Driver: Tweak diag names to be more consistent.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66787 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-12 09:13:48 +00:00
Daniel Dunbar 4ad4b3ebbe Driver: Use standard Diagnostic interface for diagnostics.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66786 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-12 08:55:43 +00:00
Daniel Dunbar e7fffa14dc Driver: Fix thinko in Arg::hasArg.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66785 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-12 08:45:11 +00:00
Daniel Dunbar a948045b43 Driver: '-' is parsed as an input.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66784 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-12 08:44:47 +00:00
Daniel Dunbar 53ec552150 Driver: Start sketching construction of abstract built actions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66783 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-12 07:58:46 +00:00
Daniel Dunbar e9fba573bd Driver: Add information on Driver input/temporary types.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66781 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-12 07:40:41 +00:00
Daniel Dunbar 644eade617 Driver: Add Option flags.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66774 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-12 05:46:32 +00:00
Daniel Dunbar b349fccc4a 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66767 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-12 03:42:54 +00:00
Daniel Dunbar e1495eced8 Driver: Reorder arguments in Options.def so option name is first.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66759 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-12 01:46:53 +00:00
Daniel Dunbar d8cadd4f25 Driver: Add ArgList::hasArg, for testing for the presence of an
argument matching some Option::ID.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66758 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-12 01:36:44 +00:00
Daniel Dunbar cf0dd156e7 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66757 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-12 01:34:20 +00:00
Daniel Dunbar e399564a23 Driver: Add host info (add new files).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66603 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-10 23:50:49 +00:00
Daniel Dunbar dd98e2cad1 Driver: Add host info.
- Replace assorted -ccc-host-* options by -ccc-host-triple which is
   more sane.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66600 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-10 23:41:59 +00:00
Daniel Dunbar 365c02f65b Driver: Handle magic -ccc- options.
- Follows ccc currently, but this functionality should eventually be
   outside the Driver lib.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66575 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-10 20:52:46 +00:00
Daniel Dunbar 4a77edb3f0 Remove some now-unneeded calls to llvm::errs().flush().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66555 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-10 18:00:19 +00:00
Mike Stump 2ace928d27 Fix warnings in build on clang-x86_64-freebsd buildbot.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66344 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-07 18:35:41 +00:00
Daniel Dunbar 0648262df7 Driver: Basic argument parsing.
- Add Driver::ParseArgStrings.
 - Store values directly in CommaJoinedArg to support simple access.
 - Add FlagArg class.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66142 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-05 06:38:47 +00:00
Daniel Dunbar bbf842bb27 Driver: Implement Option::accept methods.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66106 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-04 23:22:02 +00:00
Daniel Dunbar 5cc8c639cf Driver: Fix off by one in ParseOneArg; this code is ugly but will be
replaced anyway.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66101 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-04 23:03:35 +00:00
Daniel Dunbar f781c4192e Driver: Add Arg::dump and SeparateArg stubs.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66100 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-04 23:02:50 +00:00
Daniel Dunbar 70a0dbbfbd Driver: Add OptTable::ParseOneArg.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66090 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-04 22:41:37 +00:00
Daniel Dunbar 9358dc8d1e Driver: Add ArgList::{append, getArgString}
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66089 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-04 22:40:08 +00:00
Daniel Dunbar fb36caee24 Driver: Stub out Arg implementations.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66088 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-04 22:37:52 +00:00
Daniel Dunbar 30b055f553 Driver: Option's need to know their ID.
- Also, add Input and Unknown opts to OptTable.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66079 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-04 21:53:04 +00:00
Daniel Dunbar 0f9098e093 Driver: Add Option flags.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66067 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-04 21:05:23 +00:00
Daniel Dunbar 3c9cc6bfe9 Driver: Tweak Option::accept interface.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66066 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-04 20:53:00 +00:00
Daniel Dunbar 1b3bb6efc5 Driver: Sink Driver/Compilation into clang::driver namespace.
- Add OptTable instance to Driver.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66063 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-04 20:49:20 +00:00
Daniel Dunbar 6ac1e2252b Driver: Add ArgList implementation.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66037 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-04 17:10:42 +00:00
Daniel Dunbar 2c6f6f3c17 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66028 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-04 08:33:23 +00:00
Daniel Dunbar 1eb4e64eed Sketch Driver Option classes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65933 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-03 05:55:11 +00:00
Daniel Dunbar 3ede8d0a7d Stub out some structure for C++ driver.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65867 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-02 19:59:07 +00:00
Daniel Dunbar e1bd4e6d7c Rename lib/Driver (etc) to lib/Frontend in prep for the *actual*
driver taking lib/Driver.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65811 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-02 06:16:29 +00:00
Douglas Gregor 4b2d3f7bcc 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).




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65570 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-26 21:00:50 +00:00
Chris Lattner 01e4b5c3bf add c++ search path for GCC 4.2, PR3668, patch by Pawel Worach!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65462 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-25 18:06:37 +00:00
Chris Lattner 676f0242a8 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!)



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65090 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-20 00:25:28 +00:00
Chris Lattner ebbbb1b211 refactor, pass ranges down instead of the whole
DiagnosticInfo.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65088 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-20 00:18:51 +00:00
Chris Lattner 6858dd3fcc 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65026 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-19 06:48:28 +00:00
Chris Lattner 50b587d02f PR3614: "ignoring nonexistent directory" should print the -isysroot
mapped path, not the requested path.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65009 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-19 04:48:57 +00:00
Ted Kremenek 3f0b656248 HTMLDiagnostics: Always display diagnostics *below* the line in question.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64959 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-18 22:10:00 +00:00
Chris Lattner 609b3ab97b tidy up
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64934 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-18 18:50:45 +00:00
Chris Lattner 6f541026b6 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64862 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-18 00:25:15 +00:00
Ben Laurie 64ea69f3b5 Handle fatal errors.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64770 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-17 17:32:22 +00:00
Chris Lattner 55dcef0867 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!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64761 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-17 08:44:50 +00:00
Chris Lattner 49a48eb432 sink a call to getInstantiationLoc to eliminate an assertion.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64755 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-17 07:54:55 +00:00
Chris Lattner b88af81958 break down EmitCaretDiagnostic to use more primitive calls.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64754 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-17 07:51:53 +00:00
Chris Lattner 94f5578414 split caret diagnostic printing out into its own function.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64751 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-17 07:38:37 +00:00
Chris Lattner 8f7b396f49 simplify some code.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64750 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-17 07:34:34 +00:00
Chris Lattner 34837a5771 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);
        ^~~~~~~



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64743 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-17 05:19:10 +00:00
Chris Lattner 43eee07270 use some references to simplify code.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64063 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-08 01:00:10 +00:00
Chris Lattner 30f05b553d 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64060 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-08 00:55:22 +00:00
Chris Lattner 41327585e4 handle fatal errors, rely on warnings to point out missing cases.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63913 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-06 03:57:44 +00:00
Torok Edwin f7ea67a6ec Add Debian gcc 4.3 header search directories.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63872 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-05 18:12:45 +00:00
Chris Lattner 30fc933e5f 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63701 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-04 01:06:56 +00:00
Chris Lattner 7da5aea766 make SM::getColumnNumber take a predecomposed FileID/offset, which
makes it clear to clients that they have to pick an instantiation
or spelling location before calling it and allows optimization based
on that.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63698 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-04 00:55:58 +00:00
Ted Kremenek d671c5a616 Clean up indentation.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63551 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-02 21:45:32 +00:00
Chris Lattner b8bf65e342 " Attached is a patch for TextDiagnosticPrinter that adds an optional
parameter that allows users to omit the printing of the source
location on a diagnostic. So basically it would omit the "abc.c:5:1: "
at the beginning of the line."

Patch by Alexei Svitkine!




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63396 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-30 17:41:53 +00:00
Ted Kremenek 05f3957c20 Fix TextDiagnosticPrinter::HandleDiagnostic to handle invalid FullSourceLocs that do not have a SourceManager.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63230 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-28 20:47:47 +00:00
Chris Lattner b9c3f966b1 Introduce a new PresumedLoc class to represent the concept of a location
as reported to the user and as manipulated by #line.  This is what __FILE__,
__INCLUDE_LEVEL__, diagnostics and other things should follow (but not 
dependency generation!).  

This patch also includes several cleanups along the way: 

- SourceLocation now has a dump method, and several other places 
  that did similar things now use it.
- I cleaned up some code in AnalysisConsumer, but it should probably be
  simplified further now that NamedDecl is better.
- TextDiagnosticPrinter is now simplified and cleaned up a bit.

This patch is a prerequisite for #line, but does not actually provide 
any #line functionality.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63098 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-27 07:57:44 +00:00
Ted Kremenek a26ddabc0e PathDiagnostics:
- Add the distinction between the 'bug type' and the 'bug description'

HTMLDiagnostics:
- Output the bug type field as HTML comments

scan-build:
- Use the bug type field instead of the bug description for the HTML table.
- Radar filing now automatically picks up the bug description in the title (addresses <rdar://problem/6265970>)


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63084 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-27 01:53:39 +00:00
Ted Kremenek c472d79e3a When using -analyzer-output-plist always output a plist file even if it contains no error reports.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62871 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-23 20:06:20 +00:00
Ted Kremenek ddf32dabe7 Static Analyzer: When generating plists for errors reports, generate one plist file per translation unit that contains all of the diagnostics.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62647 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-21 00:42:24 +00:00
Chris Lattner a11d617933 Rename SourceManager::getCanonicalFileID -> getFileID. There is
no longer such thing as a non-canonical FileID.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62499 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-19 07:46:45 +00:00
Chris Lattner 3b4d5e955e Rename SourceLocation::getFileID to getChunkID, because it returns
the chunk ID not the file ID.  This exposes problems in 
TextDiagnosticPrinter where it should have been using the canonical
file ID but wasn't.  Fix these along the way.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62427 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-17 08:45:21 +00:00
Chris Lattner 2b2453a7d8 this massive patch introduces a simple new abstraction: it makes
"FileID" a concept that is now enforced by the compiler's type checker
instead of yet-another-random-unsigned floating around.

This is an important distinction from the "FileID" currently tracked by
SourceLocation.  *That* FileID may refer to the start of a file or to a
chunk within it.  The new FileID *only* refers to the file (and its 
#include stack and eventually #line data), it cannot refer to a chunk.

FileID is a completely opaque datatype to all clients, only SourceManager
is allowed to poke and prod it.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62407 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-17 06:22:33 +00:00
Chris Lattner 59ddeabc4c eliminate FullSourceLoc::getLocation() now that FullSourceLoc
*is* the location.  This eliminates some weird X.getLocation().getLocation()'s.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62376 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-16 23:06:35 +00:00
Chris Lattner 4abb87ef14 elimiante FullSourceLoc::getCanonicalFileID
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62374 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-16 22:59:51 +00:00
Chris Lattner f3e8fcd074 an instantiation loc is always a file loc.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62370 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-16 22:53:27 +00:00
Chris Lattner f7cf85b330 more SourceLocation lexicon change: instead of referring to the
"logical" location, refer to the "instantiation" location.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62316 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-16 07:36:28 +00:00
Zhongxing Xu 776caefc70 Add Fedora 10 GCC paths.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61429 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-25 09:28:01 +00:00
Nuno Lopes a3d783b11f add missing gentoo c++ include paths
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60655 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-07 12:11:37 +00:00
Eli Friedman 4310ff6d8b Minor update to CMake build system.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60269 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-30 01:46:21 +00:00
Zhongxing Xu 5abf03bbb9 Add license comments.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60144 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-27 02:19:10 +00:00
Zhongxing Xu 22438a8dfe Add support for pluggable components of static analyzer.
- Creator function pointers are saved in ManagerRegistry.
 - The Register* class is used to notify ManagerRegistry new module is 
   available.
 - AnalysisManager queries ManagerRegistry for configurable module. Then it
   passes them to GRExprEngine, in turn to GRStateManager.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60143 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-27 01:55:08 +00:00
Chris Lattner 32b939b51b remove a dead enum
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59879 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-22 20:47:38 +00:00
Chris Lattner a03a5b5a84 switch TextDiagnosticPrinter to raw_ostream.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59597 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-19 06:56:25 +00:00
Chris Lattner f4c8396577 rewrite FormatDiagnostic to be less gross and a lot more efficient.
This also makes it illegal to have bare '%'s in diagnostics.  If you
want a % in a diagnostic, use %%.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59596 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-19 06:51:40 +00:00
Chris Lattner 0a14eee528 This reworks some of the Diagnostic interfaces a bit to change how diagnostics
are formed.  In particular, a diagnostic with all its strings and ranges is now
packaged up and sent to DiagnosticClients as a DiagnosticInfo instead of as a 
ton of random stuff.  This has the benefit of simplifying the interface, making
it more extensible, and allowing us to do more checking for things like access
past the end of the various arrays passed in.

In addition to introducing DiagnosticInfo, this also substantially changes how 
Diagnostic::Report works.  Instead of being passed in all of the info required
to issue a diagnostic, Report now takes only the required info (a location and 
ID) and returns a fresh DiagnosticInfo *by value*.  The caller is then free to
stuff strings and ranges into the DiagnosticInfo with the << operator.  When
the dtor runs on the DiagnosticInfo object (which should happen at the end of
the statement), the diagnostic is actually emitted with all of the accumulated
information.  This is a somewhat tricky dance, but it means that the 
accumulated DiagnosticInfo is allowed to keep pointers to other expression 
temporaries without those pointers getting invalidated.

This is just the minimal change to get this stuff working, but this will allow
us to eliminate the zillions of variant "Diag" methods scattered throughout
(e.g.) sema.  For example, instead of calling:

  Diag(BuiltinLoc, diag::err_overload_no_match, typeNames,
       SourceRange(BuiltinLoc, RParenLoc));

We will soon be able to just do:

  Diag(BuiltinLoc, diag::err_overload_no_match)
      << typeNames << SourceRange(BuiltinLoc, RParenLoc));

This scales better to support arbitrary types being passed in (not just 
strings) in a type-safe way.  Go operator overloading?!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59502 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-18 07:04:44 +00:00
Chris Lattner 2383b7f6ae Change the diagnostics interface to take an array of pointers to
strings instead of array of strings.  This reduces string copying
in some not-very-important cases, but paves the way for future 
improvements.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59494 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-18 04:56:44 +00:00
Daniel Dunbar 26fb272713 [LLVM up] Update for raw_fd_ostream change. This fixes a FIXME that
the Backend output should be done in binary mode.
 - I'd appreciate it if someone who has a Windows build could verify
   this.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59221 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-13 05:09:21 +00:00
Cedric Venet e839b15d7d Update CMakeLists.txt
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58716 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-04 20:31:17 +00:00
Ted Kremenek 4fc82c8458 Hook up the Plist diagnostic client to the driver.
Fix Plist output.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58652 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-03 23:18:07 +00:00
Ted Kremenek 5d86625633 Add path diagnostics client for emitting path reports using Plists.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58647 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-03 22:33:57 +00:00
Ted Kremenek ad99dbfc1d Rename 'HTMLDiagnostics.h' to 'PathDiagnosticClients.h'
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58646 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-03 22:31:48 +00:00
Ted Kremenek 583e898efa Fixed a horrible bug in HTMLDiagnostics.cpp where bugs referencing source ranges that occur within macros would not be emitted at all.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58550 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-02 00:33:58 +00:00
Chris Lattner 9d72851fec Rename Characteristic_t to CharacteristicKind
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58224 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-27 01:19:25 +00:00
Oscar Fuentes d2f4e5ea6e CMake: Builds and installs clang binary and libs (no docs yet). It
must be under the `tools' subdirectory of the LLVM *source* tree.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58180 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-26 00:56:18 +00:00
Ted Kremenek f91ce77179 Expand bubble size by 50%.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58111 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-24 21:17:16 +00:00
Douglas Gregor 94b1dd2368 First non-embarrassing cut at checking for ambiguous derived-to-base
conversions.

Added PerformImplicitConversion, which follows an implicit conversion sequence
computed by TryCopyInitialization and actually performs the implicit
conversions, including the extra check for ambiguity mentioned above.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58071 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-24 04:54:22 +00:00
Daniel Dunbar bb95255e08 Bug fix, CPATH="" does not add '.' to search path.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57072 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-04 20:58:18 +00:00
Chris Lattner 0b9e736308 clean up a bunch of fixme's I added, by moving
DirectoryLookup::DirType into SourceManager.h


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56692 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-26 21:18:42 +00:00
Chris Lattner 7a73940198 emulate a bit of GCC path lookup weirdness: if a system
directory is shadowed by a user directory in the lookup
path, ignore the user directory not the system one.  Not
doing this can affect file lookup and the "is a system
header" bit on locations.  For example:
  clang -v -I/usr/include inc.c -E | & grep /usr/inc
now prints:

# 1 "/usr/include/i386/_types.h" 1 3 4
# 37 "/usr/include/i386/_types.h" 3 4
# 70 "/usr/include/i386/_types.h" 3 4

instead of:

# 1 "/usr/include/i386/_types.h" 1
# 37 "/usr/include/i386/_types.h"
# 70 "/usr/include/i386/_types.h"

This is part of rdar://6243860.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56669 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-26 17:46:45 +00:00
Ted Kremenek 778246ae47 Output "REPORTHEADER" and "REPORTSUMMARYEXTRA" tags for use with scan-view.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56440 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-22 17:33:32 +00:00
Ted Kremenek a6aa83e5c7 Added experimental "intelligent-sizing" of HTML message bubbles based on the contents of the message.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56400 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-21 18:52:59 +00:00
Ted Kremenek 8c036c7f77 Add "category" to BugTypes, allowing bugs to be grouped.
Changed casing of many bug names.  The convention will be to have bug names (mostly) lower cased, and categories use some capitalization.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56385 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-20 04:23:38 +00:00
Ted Kremenek a95d375044 Patch by Csaba Hruska!
"Here is a patch what replaces std::ostream with llvm::raw_ostream. This patch
covers the AST library, but ignores Analysis lib."


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56185 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-13 05:16:45 +00:00
Douglas Gregor 233f74b29b Add support for expected-note to Clang's -verify option
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56089 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-11 02:46:36 +00:00
Argyrios Kyrtzidis 121e3c2074 Set different header search paths for the Windows platform.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55832 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-05 09:41:20 +00:00
Argyrios Kyrtzidis bdbd4620b1 Add header search paths for Mingw32 (GCC version 4).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55830 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-05 09:03:53 +00:00
Zhongxing Xu 8148839c10 Moved HTMLDiagnostics to lib/Driver.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55274 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-24 02:33:36 +00:00
Chris Lattner 5654ffda8f Add header search paths for dragonfly, patch by Sascha Wildner!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55242 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-23 18:25:07 +00:00
Nico Weber 0fca022d77 Move most of HeaderSearch initialization to libDriver.
For example, adding the default system include paths in clients is now as
simple as

  InitHeaderSearch init(headers);
  init.AddDefaultSystemIncludePaths(langopts);
  init.Realize();



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55174 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-22 09:25:22 +00:00
Daniel Dunbar acc5f3e423 More #include cleaning
- Kill unnecessary #includes in .cpp files. This is an automatic
   sweep so some things removed are actually used, but happen to be
   included by a previous header. I tried to get rid of the obvious
   examples and this was the easiest way to trim the #includes in one
   fell swoop.
 - We now return to regularly scheduled development.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54632 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-11 06:23:49 +00:00
Nico Weber 7bfaaaecb3 * Remove isInSystemHeader() from DiagClient, move it to SourceManager
* Move FormatError() from TextDiagnostic up to DiagClient, remove now  
  empty class TextDiagnostic
* Make DiagClient optional for Diagnostic

This fixes the following problems:

* -html-diags (and probably others) does now output the same set of  
  warnings as console clang does
* nothing crashes if one forgets to call setHeaderSearch() on  
  TextDiagnostic
* some code duplication is removed




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54620 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-10 19:59:06 +00:00
Gordon Henriksen aad6953ca1 Expressive diagnostics-- worth their weight in gold?
(Fixing a spelling error.)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54591 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-09 19:58:22 +00:00
Nico Weber fd54ebcaaf add a libDriver, for now only move the text diangostics stuff from Driver to there
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54383 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-05 23:33:20 +00:00