Commit Graph

1213 Commits

Author SHA1 Message Date
Chris Lattner e007de3b9a Rejigger how -pedantic and -pedantic-errors work and their interaction
with other diagnostic mapping.  In the new scheme, -Wfoo or -Wno-foo or 
-Werror=foo all override the -pedantic options, and __extension__ 
robustly silences all extension diagnostics in their scope.

An added bonus of this change is that MAP_DEFAULT goes away, meaning that
per-diagnostic mapping information can now be stored in 2 bits, doubling
the density of the Diagnostic::DiagMapping array.  This also 
substantially simplifies Diagnostic::getDiagnosticLevel.

OTOH, this temporarily introduces some "macro intensive" code in 
Diagnostic.cpp.  This will be addressed in a later patch.

llvm-svn: 69154
2009-04-15 07:01:18 +00:00
Chris Lattner ce682d9ea5 remove some commented out -Wstrict-selector-match stuff.
llvm-svn: 69148
2009-04-15 04:57:48 +00:00
Chris Lattner 8a1dc20756 clean up error messages.
llvm-svn: 69142
2009-04-15 04:51:48 +00:00
Chris Lattner 384a59cac1 Add support for -Werror=foo and -Wno-error=foo
llvm-svn: 69138
2009-04-15 04:37:12 +00:00
Chris Lattner 4c73b67efb refactor a bunch of the warning parsing stuff to simplify it. This removes the
-Wfoo=ignore syntax.  GCC supports -Wno-foo, no need to invent our own stuff.

llvm-svn: 69136
2009-04-15 04:27:38 +00:00
Douglas Gregor f0b575f79d Add PCH support for ImplicitCastExprs. This is the first expression
kind PCH handles that has an expression as an operand, so most of this
work is in the infrastructure to rebuild expression trees from the
serialized representation. We now store expressions in post-order
(e.g., Reverse Polish Notation), so that we can easily rebuild the
appropriate expression tree.

llvm-svn: 69101
2009-04-14 23:32:43 +00:00
Chris Lattner 184e65d363 Change Lexer::MeasureTokenLength to take a LangOptions reference.
This allows it to accurately measure tokens, so that we get:

t.cpp:8:13: error: unknown type name 'X'
static foo::X  P;
       ~~~~~^

instead of the woefully inferior:

t.cpp:8:13: error: unknown type name 'X'
static foo::X  P;
       ~~~~ ^

Most of this is just plumbing to push the reference around.

llvm-svn: 69099
2009-04-14 23:22:57 +00:00
Chris Lattner b874dbd478 add support for -W[no-]extra-tokens
llvm-svn: 69071
2009-04-14 20:36:01 +00:00
Douglas Gregor 54feb84489 When building a PCH file, don't perform end-of-translation-unit
wrap-up (e.g., turning tentative definitions into definitions). Also,
very that, when we actually use the PCH file, we get the ride code
generation for tentative definitions and definitions that show up in
the PCH file.

llvm-svn: 69043
2009-04-14 16:27:31 +00:00
Daniel Dunbar f5f359fb73 Clean up handling of visibility.
llvm-svn: 69027
2009-04-14 06:00:08 +00:00
Daniel Dunbar a431deb03c Reapply 68936, turned out to that clang's better debug info exposed a
codegenerator bug.

llvm-svn: 68983
2009-04-13 20:46:33 +00:00
Daniel Dunbar f3d0dccfff Revert 68936, LLVM still isn't ready to handle debug info + optimization.
llvm-svn: 68972
2009-04-13 18:03:39 +00:00
Chris Lattner 1050b99f8c the driver caught up. This makes -msse3 correctly set __SSE3__ etc.
llvm-svn: 68943
2009-04-13 06:33:49 +00:00
Devang Patel e8f66b3ed0 Enable debug info generation while optimizing.
llvm-svn: 68936
2009-04-13 04:22:59 +00:00
Chris Lattner cac63f359e Implement support for GCC's -dD mode, which dumps -E output *and*
macro definitions.

llvm-svn: 68884
2009-04-12 01:56:53 +00:00
Chris Lattner 225dd6c830 add some #includes for better compatibility with gcc 4.4,
thanks to Tobias Stadler for pointing this out.

llvm-svn: 68868
2009-04-11 18:40:46 +00:00
Douglas Gregor 92863e475e Compare the predefines buffer in the PCH file with the predefines
buffer generated for the current translation unit. If they are
different, complain and then ignore the PCH file. This effectively
checks for all compilation options that somehow would affect
preprocessor state (-D, -U, -include, the dreaded -imacros, etc.).

When we do accept the PCH file, throw away the contents of the
predefines buffer rather than parsing them, since all of the results
of that parsing are already stored in the PCH file. This eliminates
the ugliness with the redefinition of __builtin_va_list, among other
things.

llvm-svn: 68838
2009-04-10 23:10:45 +00:00
Chris Lattner d959d753bc do a dance with predefines, and finally enable reading of macros from
PCH.  This works now, except for limitations not being able to do things
with identifiers.  The basic example in the testcase works though.

llvm-svn: 68832
2009-04-10 22:13:17 +00:00
Chris Lattner 3c68407868 move a bunch of code for initializing the predefines buffer out of Preprocessor.cpp
into clang-cc.cpp.  This makes it so clang-cc constructs the *entire* predefines 
buffer, not just half of it.  A bonus of this is that we get to kill a copy
of DefineBuiltinMacro.

llvm-svn: 68830
2009-04-10 21:58:23 +00:00
Fariborz Jahanian 40458ec7ef Reject compiles for x86_64 target for MacOS versions which
do not support it.

llvm-svn: 68819
2009-04-10 20:33:45 +00:00
Daniel Dunbar 497ff13243 Support -miphoneos-version-min in clang-cc.
- Patch by Shantonu Sen (with a minor tweak to split out
   getDarwin{OSX,IPhoneOS}Defines)!

 - <rdar://problem/6776277> Need clang-cc/ccc-analyzer support for
   -miphoneos-version-min

llvm-svn: 68815
2009-04-10 19:52:24 +00:00
Daniel Dunbar 8b723e299c Driver: CCC_ADD_ARGS could end up using dangling pointers.
llvm-svn: 68805
2009-04-10 18:32:59 +00:00
Chris Lattner 2199f5b4e5 emit tokens, constify the Preprocessor passed down into PCH writer.
llvm-svn: 68798
2009-04-10 18:08:30 +00:00
Douglas Gregor df47d734c2 Add PCH sources to CMake build files
llvm-svn: 68794
2009-04-10 17:28:42 +00:00
Chris Lattner eeffaef7b9 Arrange for the preprocessor to be passed down into the PCH writer.
llvm-svn: 68790
2009-04-10 17:15:23 +00:00
Douglas Gregor a7f71a91c5 PCH serialization/deserialization of the source manager. With this
improvement, source locations read from the PCH file will properly
resolve to the source files that were used to build the PCH file
itself.

Once we have the preprocessor state stored in the PCH file, source
locations that refer to macro instantiations that occur in the PCH
file should have the appropriate instantiation information.

llvm-svn: 68758
2009-04-10 03:52:48 +00:00
Douglas Gregor ef84c4b434 Implementation of pre-compiled headers (PCH) based on lazy
de-serialization of abstract syntax trees.

PCH support serializes the contents of the abstract syntax tree (AST)
to a bitstream. When the PCH file is read, declarations are serialized
as-needed. For example, a declaration of a variable "x" will be
deserialized only when its VarDecl can be found by a client, e.g.,
based on name lookup for "x" or traversing the entire contents of the
owner of "x".

This commit provides the framework for serialization and (lazy)
deserialization, along with support for variable and typedef
declarations (along with several kinds of types). More
declarations/types, along with important auxiliary structures (source
manager, preprocessor, etc.), will follow.

llvm-svn: 68732
2009-04-09 22:27:44 +00:00
Douglas Gregor bcced4ec31 Propagate the ASTContext to various AST traversal and lookup functions.
No functionality change (really).

llvm-svn: 68726
2009-04-09 21:40:53 +00:00
Daniel Dunbar f67829ac6a Make -include, -imacros paths absolute in Frontend.
- Otherwise paths will be resolved relative to the main input file,
   which is incorrect.

 - I don't know how to make a reasonable test case for this with our
   testing infrastructure.

 - PR3395

llvm-svn: 68665
2009-04-09 00:51:16 +00:00
Chris Lattner 2632dda471 add support for -Wtrigraphs and -Wno-trigraphs.
llvm-svn: 68649
2009-04-08 22:37:15 +00:00
Chris Lattner e01d82b81f finish the implementation of -imacros. The driver still needs to be hooked up.
llvm-svn: 68640
2009-04-08 20:53:24 +00:00
Chris Lattner 94f4248086 According to the GCC man page, all -imacros are included before any -include's.
llvm-svn: 68633
2009-04-08 20:15:42 +00:00
Chris Lattner 21f47dd8ac properly escape filenames when generating implicit #includes, this handles
things like " in paths etc.  Found by inspection.

llvm-svn: 68632
2009-04-08 20:10:57 +00:00
Chris Lattner 14a7f39733 Add initial support for -imacros. Right now it has the same semantics as
-include, but that will be fixed soon.

llvm-svn: 68625
2009-04-08 18:24:34 +00:00
Daniel Dunbar 17ddaa677e More fixes to builtin preprocessor defines.
- Add -static-define option driver can use when __STATIC__ should be
   defined (instead of __DYNAMIC__).

 - Don't set __OPTIMIZE_SIZE__ on Os, __OPTIMIZE_SIZE__ is tied to Oz.

 - Set __NO_INLINE__ following GCC 4.2.

 - Set __GNU_GNU_INLINE__ or __GNU_STDC_INLINE__ following GCC 4.2.

 - Set __EXCEPTIONS for Objective-C NonFragile ABI.

 - Set __STRICT_ANSI__ for standard conforming modes.

 - I added a clang style test case in utils for this, but its not
   particularly portable and I don't think it belongs in the test
   suite.

llvm-svn: 68621
2009-04-08 18:03:55 +00:00
Daniel Dunbar 3b358a3d83 Make debug info work when using -save-temps.
- This is pretty ugly, but the most obvious solution. Chime in if you
   have a nicer one.

 - The problem is that with -save-temps, clang-cc has no idea what the
   name of the original input file is. However, the user expects to be
   able to set breakpoints based on the input file name.

 - We support this by providing a new option -main-file-name (similar
   to -dumpbase used by gcc) which allows the driver to pass in the
   original file name.

 - <rdar://problem/6753383> building with clang using --save-temps
   gets the compile unit name from the .i file...

llvm-svn: 68595
2009-04-08 05:11:16 +00:00
Chris Lattner 4720840d7e fix typo, noticed by Gabor
llvm-svn: 68587
2009-04-08 03:36:03 +00:00
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 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 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
Chris Lattner 84d573f256 add a warning for this crazy case, as suggested by Eli.
llvm-svn: 68524
2009-04-07 18:18:09 +00:00
Chris Lattner 0f98a286a3 implement rdar://6762183. I'm not sure if it is more insane that
GCC ignores macro definitions after \n's or that real code depends
on this.

llvm-svn: 68511
2009-04-07 06:02:44 +00:00
Daniel Dunbar f247b30abb Remove a FIXME, the driver handles -O4.
llvm-svn: 68481
2009-04-07 00:38:22 +00:00
Anders Carlsson 65cb90efc1 Define __OPTIMIZE__ and __OPTIMIZE_SIZE__ if the -O[12] and -Os flags are passed to the compiler.
llvm-svn: 68450
2009-04-06 17:37:10 +00:00
Chris Lattner 8887072bce enable -std=c9x and -std=iso9899:199x, patch by Ed Schouten!
llvm-svn: 68449
2009-04-06 17:17:55 +00:00
Zhongxing Xu 01a5beb8cd Apply a patch which adds 'OriginalParmVar' to the DeclContextPrinter by Jon
Simons.

llvm-svn: 68436
2009-04-05 02:04:38 +00:00
Fariborz Jahanian befc9dfbff Implement -fvisibility.
llvm-svn: 68369
2009-04-03 03:28:57 +00:00
Douglas Gregor 97186b07e4 Rename GeneratePCH action to GeneratePTH
llvm-svn: 68348
2009-04-02 23:43:50 +00:00
Douglas Gregor 9c0d38a7a0 Add a new command-line option "-fixit-at=file:line:column" that only
applies fix-its to error messages that occur at that specific location
in the program. 

llvm-svn: 68342
2009-04-02 19:05:20 +00:00
Mike Stump d3e3885f2d Remove -ftrapu.
llvm-svn: 68330
2009-04-02 18:15:54 +00:00
Douglas Gregor a42bd8433d Provide FIX-IT notes to describe what fix-it is doing behind the
scenes, using the underlying diagnostic client to format the
messages.

llvm-svn: 68324
2009-04-02 17:13:00 +00:00
Douglas Gregor 578dae57ca Introduce a "-fixit" mode to clang-cc that applies code-modification hints.
llvm-svn: 68268
2009-04-02 01:08:08 +00:00
Mike Stump 40968598c7 Fixup -ftrapv to be more gcc compatible. -ftrapu (for want of a
better name) is the option that SmallTalk can use to intercept all
overflows, including unsigned.  I added some testcases so we don't
break anything.

Also included is another patch from David for += and friends.

llvm-svn: 68267
2009-04-02 01:03:55 +00:00
Mike Stump 0c61b7322a Add -ftrapv support, patch from David Chisnall; well all except the
clang option code that is and two bug fixes.

llvm-svn: 68240
2009-04-01 20:28:16 +00:00
Daniel Dunbar 35b0c52add Allow CCC_ADD_ARGS to add empty arguments
llvm-svn: 68235
2009-04-01 19:38:07 +00:00
Daniel Dunbar dae1d347df Support CCC_ADD_ARGS in new driver.
llvm-svn: 68231
2009-04-01 19:08:46 +00:00
Douglas Gregor b4b81d8ab1 Revert r68221, -ftrapv support, which causes several regressions in
Clang's test suite.

llvm-svn: 68230
2009-04-01 18:59:55 +00:00
Mike Stump fbc8c132ba Add -ftrapv support, patch from David Chisnall; well all except the
clang option code that is.

llvm-svn: 68221
2009-04-01 18:19:33 +00:00
Daniel Dunbar 386ef885bb Pull clang-cc code for generating PTH files based on the input type.
- <rdar://problem/6741594> [pth] don't abuse -x to drive pth
   generation

 - Simpler, and fixes PR3915.

Cleanup test cases for PTH:
 - Update to use -emit-pth

 - Removed PTH test of carbon.c and cocoa.mm; these didn't actually
   verify anything, and since PTH is token based the extra coverage
   (over cocoa.m) isn't particularly helpful.

 - Split PTH tests in cocoa.m to cocoa-pth.m, solely to increase
   available parallelism when running tests.

Ted, could you update the PTH test cases (include-pth.c and
cocoa-pth.m) to have some sort of positive check that the PTH is
getting used? "# of PTH cache hits" or "tokens read from PTH cache"
statistics would work great. :)

llvm-svn: 68189
2009-04-01 05:09:09 +00:00
Ted Kremenek 0df7051783 Add '-emit-pth' option to clang-cc as an alternate API for the high-level driver
to generate PTH files. Soon we will remove from clang-cc the GCC-style '-x
c-header' interface for generating PTH files and push this logic to 'clang'.

llvm-svn: 68164
2009-04-01 00:23:28 +00:00
Daniel Dunbar 4cb6715434 Add two FIXMEs
llvm-svn: 68138
2009-03-31 20:10:05 +00:00
Ted Kremenek 7b4df3c3e6 Rename clang.[cpp,h] to clang-cc.[cpp,h] to reflect the name change of the
low-level frontend driver.

llvm-svn: 68131
2009-03-31 18:58:14 +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
Douglas Gregor f1b876d5de Implement -Wmissing-prototypes. Fixes PR3911.
llvm-svn: 68110
2009-03-31 16:35:03 +00:00
Steve Naroff ea9a107ada Add support for -Wdeprecated-declarations.
This fixes <rdar://problem/6712496> Unable to disable deprecated warning.

llvm-svn: 68108
2009-03-31 15:00:11 +00:00
Eli Friedman 1a4029c5df Implement -Wno-pointer-sign.
llvm-svn: 68062
2009-03-30 21:19:48 +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
Chris Lattner 5bbb3c8ad9 Push DeclGroup much farther throughout the compiler. Now the various
productions (except the already broken ObjC cases like @class X,Y;) in 
the parser that can produce more than one Decl return a DeclGroup instead
of a Decl, etc.

This allows elimination of the Decl::NextDeclarator field, and exposes
various clients that should look at all decls in a group, but which were
only looking at one (such as the dumper, printer, etc).  These have been
fixed.

Still TODO:

1) there are some FIXME's in the code about potentially using
DeclGroup for better location info.
2) ParseObjCAtDirectives should return a DeclGroup due to @class etc.
3) I'm not sure what is going on with StmtIterator.cpp, or if it can
   be radically simplified now.
4) I put a truly horrible hack in ParseTemplate.cpp.

I plan to bring up #3/4 on the mailing list, but don't plan to tackle
#1/2 in the short term.

llvm-svn: 68002
2009-03-29 16:50:03 +00:00
Chris Lattner 83f095cc7e Introduce a new OpaquePtr<N> struct type, which is a simple POD wrapper for a
pointer.  Its purpose in life is to be a glorified void*, but which does not
implicitly convert to void* or other OpaquePtr's with a different UID.

Introduce Action::DeclPtrTy which is a typedef for OpaquePtr<0>.  Change the 
entire parser/sema interface to use DeclPtrTy instead of DeclTy*.  This
makes the C++ compiler enforce that these aren't convertible to other opaque
types.

We should also convert ExprTy, StmtTy, TypeTy, AttrTy, BaseTy, etc,
but I don't plan to do that in the short term.

The one outstanding known problem with this patch is that we lose the 
bitmangling optimization where ActionResult<DeclPtrTy> doesn't know how to
bitmangle the success bit into the low bit of DeclPtrTy.  I will rectify
this with a subsequent patch.

llvm-svn: 67952
2009-03-28 19:18:32 +00:00
Chris Lattner 529efc74ad rename some methods.
llvm-svn: 67923
2009-03-28 06:33:19 +00:00
Chris Lattner c0c3dffa3d reduce indentation, no functionality change.
llvm-svn: 67916
2009-03-28 05:44:17 +00:00
Chris Lattner 1ad4eeb9c7 remove TranslationUnit.
llvm-svn: 67914
2009-03-28 04:31:31 +00:00
Chris Lattner a5adead17b push more ASTContext goodness out through interfaces that use
TranslationUnit

llvm-svn: 67913
2009-03-28 04:27:18 +00:00
Chris Lattner 66918ee148 remove TranslationUnit from ParseAST.
llvm-svn: 67911
2009-03-28 04:13:34 +00:00
Chris Lattner cf16983179 change HandleTranslationUnit to take an ASTContext instead of TranslationUnit
llvm-svn: 67910
2009-03-28 04:11:33 +00:00
Chris Lattner 040d4570c7 remove dead ivar.
llvm-svn: 67907
2009-03-28 04:05:05 +00:00
Chris Lattner edf7eb77cf hoist TranslationUnit some more.
llvm-svn: 67905
2009-03-28 03:56:54 +00:00
Chris Lattner 96c339a661 eliminate some wrappers.
llvm-svn: 67904
2009-03-28 03:53:02 +00:00
Chris Lattner f7d9e2ba1c eliminate ReadASTBitcodeFile
llvm-svn: 67903
2009-03-28 03:49:26 +00:00
Chris Lattner d286851b57 move serialization logic from TranslationUnit to ASTContext.
llvm-svn: 67902
2009-03-28 03:45:20 +00:00
Chris Lattner a0b08dcd6b don't poke at TranslationUnit directly
llvm-svn: 67900
2009-03-28 03:29:40 +00:00
Chris Lattner 5cf49fe587 eliminate ASTConsumer::InitializeTU, all clients are
happy with just ASTContext, they don't need a TU.

llvm-svn: 67894
2009-03-28 02:18:25 +00:00
Chris Lattner 8671ca9d97 revert mike's patch which broke test/CodeGen/no-common.c.
llvm-svn: 67893
2009-03-28 02:12:08 +00:00
Chris Lattner a6f4ca2b6f remove TranslationUnit::OwnsDecls, which is only set, never read.
llvm-svn: 67891
2009-03-28 01:44:40 +00:00
Chris Lattner 84bcc4795e simplify ParseAST by sucking -disable-free handling logic up into
clang.cpp

llvm-svn: 67890
2009-03-28 01:37:17 +00:00
Chris Lattner 2b9e7efccd move StatListener out to top level.
llvm-svn: 67886
2009-03-28 00:55:35 +00:00
Chris Lattner a94d139a1f various cleanups, no functionality change
llvm-svn: 67883
2009-03-28 00:16:20 +00:00
Mike Stump e5fdfd5930 Fixup -fcommon and -fno-common to be more gcc compatible.
llvm-svn: 67863
2009-03-27 20:15:22 +00:00
Chris Lattner 839150e0d2 push line markers through -E mode.
llvm-svn: 67854
2009-03-27 17:13:49 +00:00
Chris Lattner 984fac5f5f most of this is plumbing to get CompileOptions down into
CodeGenModule.  Once there, add a new NoCommon option to
it and implement -fno-common.

llvm-svn: 67735
2009-03-26 05:00:52 +00:00
Douglas Gregor 6c2adff380 Pass access specifiers through to member classes and member enums.
llvm-svn: 67710
2009-03-25 22:00:53 +00:00
Ted Kremenek 7b7b3f0817 Turn on '-analyzer-eagerly-assume' by default in ccc for the static analyzer.
llvm-svn: 67663
2009-03-25 00:32:30 +00:00
Mike Stump 90a3707225 Really fix cmake style builds.
llvm-svn: 67633
2009-03-24 17:52:34 +00:00
Chris Lattner 02428f6aa6 -arch ppc should change the triple to powerpc-foo not to ppc-foo.
Similarly for ppc64.  This should probably move into the driver, along
with all the other target selection stuff other than -triple.

llvm-svn: 67621
2009-03-24 16:18:41 +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 36245c5a90 Rename clang-driver to clang.
Again, I tried to update cmake but it is untested.

llvm-svn: 67606
2009-03-24 03:07:05 +00:00
Daniel Dunbar e5a7ecc23a Move <root>/Driver into <root>/tools/clang-cc.
Again, I tried to update cmake but it is untested.

llvm-svn: 67605
2009-03-24 03:00:12 +00:00
Daniel Dunbar 3db73ab7f6 Add CMake files for tools/driver; I am just guessing here, can someone test/fix?
llvm-svn: 67604
2009-03-24 02:52:57 +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 d5f35ca0bf ccc: Have generic GCC tool chain search the driver directory for
executables (e.g., clang).
 - This matches the clang-driver behavior.

llvm-svn: 67590
2009-03-24 01:06:18 +00:00
Daniel Dunbar b5860facfd ccc/Driver: -r option doesn't take an argument.
llvm-svn: 67581
2009-03-24 00:20:13 +00:00
Daniel Dunbar fefce128c5 ccc: Forward -f[no-]builtin to clang.
llvm-svn: 67517
2009-03-23 14:57:31 +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 9b726f88a2 ccc: Use -include-pth.
llvm-svn: 67410
2009-03-20 22:13:54 +00:00
Daniel Dunbar da382a88bf Driver: Get executable path using llvm::sys::Path::GetMainExecutable.
llvm-svn: 67228
2009-03-18 20:25:53 +00:00
Daniel Dunbar d72468a61b ccc: Pass --relocation-model as separate arguments (to match Driver).
llvm-svn: 67190
2009-03-18 09:36:19 +00:00
Daniel Dunbar d9b80c2af8 Driver: Use custom diag printer to drop dependency on libFrontend and
libLex.

llvm-svn: 67155
2009-03-18 02:11:26 +00:00
Daniel Dunbar 2608c548b5 Driver: Use PrettyStackTrace.
llvm-svn: 67149
2009-03-18 01:38:48 +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 a493ff47bd Update test.
llvm-svn: 66967
2009-03-13 22:11:42 +00:00
Daniel Dunbar 427d6f1a95 ccc: Handle limited forms of -ccc-host-triple for testing
compatibility with C++ rewrite.

llvm-svn: 66938
2009-03-13 20:33:09 +00:00
Daniel Dunbar 52183091f1 ccc/Driver: Forward -fheinous-gnu-extensions to clang.
llvm-svn: 66915
2009-03-13 18:12:01 +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 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 92d19016b5 ccc: Don't print the arch for every action when printing phases.
llvm-svn: 66886
2009-03-13 12:16:31 +00:00
Daniel Dunbar 5a3b818dea ccc/Driver: Forward -fprint-source-range-info to clang.
llvm-svn: 66879
2009-03-13 10:03:45 +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 f336cc279c ccc: Fix broken assertion.
llvm-svn: 66793
2009-03-12 15:59:34 +00:00
Daniel Dunbar 024882184b ccc: Fix -ccc-print-phases when doing a universal build.
llvm-svn: 66792
2009-03-12 15:57:47 +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 6f2650de80 ccc: Tweak some group names.
llvm-svn: 66772
2009-03-12 04:50:20 +00:00
Daniel Dunbar a27669f1d8 ccc: Cleanup arguments a bit; we don't need a separate group for
-fblocks, and there were some duplicate options scattered in.

llvm-svn: 66764
2009-03-12 03:28:55 +00:00
Daniel Dunbar d295bf1d46 ccc: -x assembler-with-cpp was broken for darwin, and it wasn't using
clang as the preprocessor even when it should.

llvm-svn: 66737
2009-03-11 23:07:54 +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 7ea58c355b Forward -ftemplate-depth-<N> to clang's -ftemplate-depth N.
llvm-svn: 66516
2009-03-10 00:35:30 +00:00
Daniel Dunbar 1e6efc0cf4 ccc: Parse -T{bss,data,text}, -iwithsysroot, -specs correctly.
Also, fix some test cases.

llvm-svn: 66425
2009-03-09 17:43:51 +00:00
Daniel Dunbar 13e9eff3f2 Fix thinko. *cough* ofcourseItestedit *cough*
llvm-svn: 66283
2009-03-06 18:35:43 +00:00
Daniel Dunbar 3a45e4fffb Tidy file removal cleanup & remove race condition on file existence.
llvm-svn: 66281
2009-03-06 18:32:01 +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 03f32e7638 ccc: Fix passing of -nozero-initialized-in-bss.
- PR3722.

llvm-svn: 66052
2009-03-04 19:17:10 +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
Ted Kremenek 32a59b2315 Do not automatically run the 'missing -dealloc' check until we have adequate time to make it much smarter (too much noise).
llvm-svn: 65474
2009-02-25 21:08:30 +00:00
Daniel Dunbar cdff38b1f6 ccc: Don't remove result files on error when -save-temps is present.
llvm-svn: 65349
2009-02-23 23:37:18 +00:00
Daniel Dunbar 9e5dfc6111 ccc: Remove unknown host warning, it was breaking gcc's configure.
llvm-svn: 65276
2009-02-22 08:15:14 +00:00
Daniel Dunbar f175ba1d17 ccc: Remove temporary files used in compilation, and remove
compilation results on failures.

llvm-svn: 65254
2009-02-22 01:23:52 +00:00
Daniel Dunbar e8f256c7f9 Unbreak Darwin PIC handling; my refactoring yesterday was bogus.
llvm-svn: 65154
2009-02-20 20:52:47 +00:00
Daniel Dunbar 6ef6a04dd6 Fix test case.
llvm-svn: 65139
2009-02-20 18:53:07 +00:00
Daniel Dunbar ba1c8f5a3c ccc: Spell mattr correctly.
llvm-svn: 65119
2009-02-20 07:47:48 +00:00
Daniel Dunbar e1889f935a ccc: Basic translation of gcc subtarget feature options to LLVM
options (i.e., -mno-red-zone, -msoft-float, -mno-sse, etc.)
 - Also, make sure unwind tables default to on Darwin/x86_64.
 - PR3604.

llvm-svn: 65118
2009-02-20 07:35:04 +00:00
Daniel Dunbar b9b440cde6 ccc: Use toolchain hook for default relocation model value.
llvm-svn: 65116
2009-02-20 06:48:26 +00:00
Daniel Dunbar 63e03cbe8c ccc: Use toolChain arch name instead of looking for arch command line
argument; the toolchain should always know the arch.
 - Fixes: <rdar://problem/6582911> -ccc-clang-archs doesn't work for excluding ppc

llvm-svn: 65104
2009-02-20 01:48:01 +00:00
Daniel Dunbar 1b84824f83 ccc: Store arch name in all toolchains.
- No functionality change.

llvm-svn: 65102
2009-02-20 01:36:35 +00:00
Daniel Dunbar 92cfae68e9 ccc: Give all tools access to the toolchain they are in.
- No functionality change.

llvm-svn: 65100
2009-02-20 01:30:38 +00:00
Daniel Dunbar 2a07da78c0 ccc: Give nicer error when spawning a subprocess fails.
llvm-svn: 65075
2009-02-19 22:59:57 +00:00
Daniel Dunbar a118a07157 ccc: Also look for .gch files when seeing if we should auto load a
token-cache for clang.

llvm-svn: 65069
2009-02-19 22:01:23 +00:00
Daniel Dunbar 5805c98526 ccc: Forward -ftime-report to clang.
llvm-svn: 64887
2009-02-18 05:01:43 +00:00
Daniel Dunbar 7b8b7492dd ccc: Pass -{MM,MMD,MF,MP,MT} to clang. Error on -{M,MM,MG,MQ} which
clang doesn't support yet.
 - See PR3603.

llvm-svn: 64783
2009-02-17 19:02:12 +00:00
Daniel Dunbar 89f908b883 ccc: Recognize -isystem.
llvm-svn: 64776
2009-02-17 18:10:48 +00:00
Daniel Dunbar ce96aea9ec ccc: Assume gcc will accept piped assembler input when using generic GCC toolchain.
llvm-svn: 64775
2009-02-17 18:10:15 +00:00
Daniel Dunbar 8ceb91f41b ccc: Fix a FIXME.
llvm-svn: 64774
2009-02-17 18:07:00 +00:00
Ted Kremenek b535181199 Static Analyzer driver/options (partial) cleanup:
- Move all analyzer options logic to AnalysisConsumer.cpp.
- Unified specification of stores/constraints/output to be:
   -analyzer-output=...
   -analyzer-store=...
   -analyzer-constraints=...
  instead of -analyzer-range-constraints, -analyzer-store-basic, etc.
- Updated drivers (ccc-analyzer, scan-builds, new ccc) to obey this new
  interface
- Updated test cases to conform to new driver options

llvm-svn: 64737
2009-02-17 04:27:41 +00:00
Daniel Dunbar 46414874a5 ccc: Pass -f[no-]math-errno to clang.
llvm-svn: 64709
2009-02-17 00:42:05 +00:00
Daniel Dunbar a1c37501ed ccc: @<filename> arguments are only treated specially if <filename>
exists, otherwise gcc just treats as an input.
 - PR3591

llvm-svn: 64640
2009-02-16 18:18:43 +00:00
Daniel Dunbar 87f7ba3541 ccc: Pass -P to clang.
llvm-svn: 64578
2009-02-15 05:59:37 +00:00
Douglas Gregor 69c7951c8e Add -ffreestanding to suppress the implicit declaration of library builtins like printf and malloc. Fixes PR3586
llvm-svn: 64566
2009-02-14 20:49:29 +00:00
Daniel Dunbar 72e90d7fb0 ccc: Suffix for PCH files is appended, not replaced. (Test case)
llvm-svn: 64467
2009-02-13 17:42:52 +00:00
Daniel Dunbar b903a072b1 ccc: Suffix for PCH files is appended, not replaced.
llvm-svn: 64466
2009-02-13 17:42:34 +00:00
Daniel Dunbar 7ae70391f0 ccc: Test case for transparent PTH support.
llvm-svn: 64420
2009-02-13 00:49:50 +00:00
Daniel Dunbar 391fc04b02 ccc: Stop patching output file name when using transparent PTH support.
<rdar://problem/6515236> [ccc] generate expected output files when used with PCH

llvm-svn: 64419
2009-02-13 00:49:01 +00:00
Daniel Dunbar e21993fa98 Always pass -disable-free to clang when compiling.
llvm-svn: 64416
2009-02-13 00:29:22 +00:00
Mike Stump f9cf4fa08c One more tweak to account for gluing together llvm and clang into one.
llvm-svn: 64276
2009-02-11 01:11:36 +00:00
Mike Stump 9d5d3b9de5 More version experimentation.
llvm-svn: 64271
2009-02-11 01:01:17 +00:00
Mike Stump 081e354f11 Run a little experiment with version numbers.
llvm-svn: 64268
2009-02-11 00:36:04 +00:00
Daniel Dunbar 8a1ca06456 ccc: -dM wasn't being passed to Darwin/CC1 correctly.
llvm-svn: 64169
2009-02-09 21:22:38 +00:00
Daniel Dunbar 1a5f04dc66 ccc: Forward -dM to clang.
llvm-svn: 63955
2009-02-06 19:26:48 +00:00
Daniel Dunbar 421d40c22b ccc/Darwin: Add a missing Darwin argument translation, -shared becomes
-dynamiclib. Re-audited translations to make sure I didn't miss
something else.

llvm-svn: 63953
2009-02-06 19:18:58 +00:00
Daniel Dunbar ba3325af7b ccc: Give explicit error on @ style argument lists (not yet supported).
llvm-svn: 63903
2009-02-06 01:28:59 +00:00
Daniel Dunbar 724167c280 ccc: Implement special language recognition handling for -.
- <rdar://problem/6551577> [ccc] require -x with -

llvm-svn: 63901
2009-02-05 23:44:44 +00:00
Daniel Dunbar e7dffe39ff ccc: Translate -O to -O1 for clang, and only pass last -O option.
llvm-svn: 63816
2009-02-05 02:43:38 +00:00
Daniel Dunbar ed9309ef46 ccc: Forward -femit-all-decls to clang and use an option group to
simplify handling of -f options clang recognizes.

llvm-svn: 63778
2009-02-04 21:21:08 +00:00
Daniel Dunbar 3ba943ed7a ccc: -ObjC and -ObjC++ change default language, but only for "source
files".

llvm-svn: 63727
2009-02-04 08:01:01 +00:00
Daniel Dunbar ed1ba4fc12 Use /usr/bin/env to run Python for increased portability. Patch by
David Chisnall.

llvm-svn: 63661
2009-02-03 21:25:26 +00:00
Mike Stump c99d003b25 Add -fno-blocks support. This fixes block-no-block-def.c.
llvm-svn: 63385
2009-01-30 08:22:07 +00:00
Daniel Dunbar 6d6d01f254 ccc: Forward -fobjc-nonfragile-abi to clang.
llvm-svn: 63378
2009-01-30 04:43:19 +00:00
Daniel Dunbar 3fc8ea64c9 ccc: Add -Xclang option, rename -WA, to -Xanalyzer.
- -Xclang always forwards to clang

 - -Xanalyzer replaces -WA,; it seems like the cleaner mechanism and
    is more readable.

llvm-svn: 63349
2009-01-30 00:24:16 +00:00
Daniel Dunbar b6e6a513c2 ccc: Mark -combine option as unsupported.
llvm-svn: 63348
2009-01-30 00:12:29 +00:00
Daniel Dunbar 711e882c1b ccc: Embrace destiny as a clang compiler driver.
This redoes the default mode that ccc runs in w.r.t. using clang. Now
ccc defaults to always using clang for any task clang can
handle. However, the following options exist to tweak this behavior:

 -ccc-no-clang: Don't use clang at all for compilation (still used for
  static analysis).
 
 -ccc-no-clang-cxx: Don't use clang for C++ and Objective-C++ inputs.

 -ccc-no-clang-cpp: Don't use clang as a preprocessor.

 -ccc-clang-archs <archs>: If present, only use clang for the given
  comma separated list of architectures. This only works on Darwin for
  now.

Note that all -ccc options must be first on the command line.

llvm-svn: 63346
2009-01-29 23:54:06 +00:00
Daniel Dunbar df49b7cf2f ccc: Honor -ccc-clang for generic GCC toolchain.
llvm-svn: 63277
2009-01-29 06:12:22 +00:00
Daniel Dunbar ad0d48d372 Fix test case (for -### printing version)
llvm-svn: 63223
2009-01-28 19:30:43 +00:00
Daniel Dunbar 36ccb30a35 ccc: Support -v; invent a version number for ccc for now, will be
shared with clang eventually.

llvm-svn: 63220
2009-01-28 19:26:20 +00:00
Daniel Dunbar f4a0cba545 ccc/Darwin/clang: Fix a mistranslation for the llvm-backend; llvm-gcc
doesn't set the relocation model when -mdynamic-no-pic is present.

llvm-svn: 63129
2009-01-27 20:42:58 +00:00
Daniel Dunbar 2ad3ff0bd6 ccc: Normalize machine name to i386 for platforms which report the
machine as x86_64.

llvm-svn: 63122
2009-01-27 19:29:51 +00:00
Daniel Dunbar a7ff032643 ccc: -o should not be automatically forwarded to generic gcc tools.
llvm-svn: 63015
2009-01-26 18:00:14 +00:00
Daniel Dunbar f3a06113c7 ccc: Recognize -emit-llvm [-S].
- Unlike llvm-gcc, this doesn't yet treat -emit-llvm output as a
   linker input.

llvm-svn: 63014
2009-01-26 17:09:15 +00:00
Daniel Dunbar 3d5d14ea15 ccc: Finish definition of long argument translations.
- However, these last ones do not actually work; the issue is that
   they translate to batches of options and need to be reparsed. For
   now we just give an unsupported error on them.

llvm-svn: 62872
2009-01-23 20:08:16 +00:00
Daniel Dunbar 505f751451 ccc: Another batch of long argument translations.
- Again turned up a few which don't do anything sensible.

llvm-svn: 62870
2009-01-23 19:40:54 +00:00
Daniel Dunbar 8fb96605f8 ccc: Implement long options which take joined & separate forms.
llvm-svn: 62841
2009-01-23 08:16:41 +00:00
Daniel Dunbar 8fa972a55b ccc: Support long ('--...') flag arguments.
- Curiously, a number of the current translations gcc does appear to
   be useless?

llvm-svn: 62831
2009-01-23 02:00:46 +00:00
Daniel Dunbar e2c430b317 ccc: Organize long options together.
llvm-svn: 62829
2009-01-23 01:31:44 +00:00
Daniel Dunbar eff67fa33b ccc: Add support for several more aliases (--ansi, --assemble,
--assert, --classpath).
 - Requires providing some option parameters to over-ride rendering in
   order to match gcc. There may be a cleaner way to do this (probably
   by introducing a new option type for long JoinedOrSeparate forms).

llvm-svn: 62825
2009-01-23 00:54:03 +00:00
Daniel Dunbar 58645d0285 ccc: Darwin/x86/link: Fix a few incompatibilities with gcc (missed
forwarding -s to linker, and was only taking last arg in some cases
when should have been taking all).

llvm-svn: 62824
2009-01-23 00:39:52 +00:00
Daniel Dunbar 4bb6a2fcd3 ccc: Add support for "alias" options.
- Unlike groups (which gather distinct but related options), aliases
   are for options like '--all-warnings' which are effectively treated
   like some other option ('-Wall') both in the driver logic and when
   passing to tools.

llvm-svn: 62820
2009-01-23 00:14:46 +00:00
Daniel Dunbar ccabd0f01a ccc: Fix typo; isn't dynamic typing fun!
llvm-svn: 62817
2009-01-23 00:04:43 +00:00
Daniel Dunbar 2e1cfd0267 ccc: Bug fix, driver logic was allowing child jobs to pipe output when
parent wasn't expecting it.

llvm-svn: 62811
2009-01-22 23:19:32 +00:00
Daniel Dunbar d89187696f ccc/clang: Mimic llvm-gcc initialization of LLVM backend based on gcc
options (for example, to set relocation model or enable unwind table generation).

llvm-svn: 62740
2009-01-22 01:55:46 +00:00
Daniel Dunbar d00bca3572 ccc: Handle a few long argument form (--) translations using option
groups, and fix misdeclaration of some -W options.

llvm-svn: 62702
2009-01-21 18:49:34 +00:00
Daniel Dunbar f2e3d81cb4 ccc: Add appropriate file search prefixes when on x86_64 Darwin, and
look for crt3.o appropriately.

llvm-svn: 62694
2009-01-21 17:18:19 +00:00
Daniel Dunbar a184754570 ccc: Implement file & path searching.
- Toolchain is responsible for providing list of prefixes to search.

 - Implement -print-file-name=xxx and -print-prog-name=xxx driver options.

llvm-svn: 62659
2009-01-21 02:03:52 +00:00
Daniel Dunbar 309052a84c ccc: Add --analyze test case.
llvm-svn: 62654
2009-01-21 01:22:37 +00:00
Daniel Dunbar 989ab477d2 ccc: Add --analyze driver mode (for running static analyzer).
- For now forces generation of plist files, need to think about the
   right interface.

 - Changed -fsyntax-only mode to be its own phase (more consistent).

 - Add -WA, for passing options verbatim to analyzer.

llvm-svn: 62649
2009-01-21 01:07:49 +00:00
Daniel Dunbar 47d16e53fe ccc: Unbreak -pipe handling broken in previous refactoring.
llvm-svn: 62637
2009-01-21 00:05:15 +00:00
Mike Stump c1b44ce610 Fix ccclib building when building in a separate build tree.
llvm-svn: 62621
2009-01-20 21:54:36 +00:00
Daniel Dunbar de46097847 ccc: Allow downstream tools to be aware of final output name.
- This is a hack to allow the Darwin linker to get -final_output when
   doing universal builds; the mechanism should be generalized.

 - Handle multiple redundant -arch arguments correctly.

 - Forward -arch_multiple and -final_output to gcc when necessary.

 - Simplified implementation of derived gcc tools.

llvm-svn: 62618
2009-01-20 21:29:14 +00:00
Daniel Dunbar 7966091399 ccc: Darwin/x86: Teach compile tool how to build .pch files. xcc is
now fully independent of the gcc driver when targetting Darwin/x86.

llvm-svn: 62570
2009-01-20 05:51:52 +00:00
Daniel Dunbar 8bc09f4085 ccc: PCH generation doesn't strip the path when generating a derived
filename from the input path.

llvm-svn: 62569
2009-01-20 05:49:32 +00:00
Daniel Dunbar 313e301574 ccc: Recognize that -M and -MM only run preprocessor.
- Clean up some placement of output args to match gcc more precisely
   (for testing).

llvm-svn: 62566
2009-01-20 01:53:54 +00:00
Daniel Dunbar 0c8d6c9d27 ccc: Darwin/x86: Add direct cpp support.
- Add Darwin_X86_CC1Tool which is shared by Darwin/x86/Compile and
   Darwin/x86/Preprocess tools.

 - Minor bug fixes (CmpDriver exit code, -x cpp-output handling, some
   linker argument translation).

llvm-svn: 62551
2009-01-20 00:47:24 +00:00
Daniel Dunbar 19e953acd9 Makefile isn't executable.
llvm-svn: 62523
2009-01-19 19:59:59 +00:00
Daniel Dunbar ababe7d47d ccc: Add missing file.
llvm-svn: 62520
2009-01-19 19:20:01 +00:00
Daniel Dunbar f6135630a8 ccc: Add installation of ccc; based on patch from Mike Stump.
- This doesn't follow normal installation procedure of python
   code, but no sense trying too hard since ccc will be moved to
   C++.

 - Entry point is now tools/ccc.

llvm-svn: 62517
2009-01-19 18:50:49 +00:00
Daniel Dunbar 6e2c6844c1 ccc: Bug fix, pch generation should not try to output on pipe and -E
should. This needs cleanup.

llvm-svn: 62473
2009-01-18 21:35:24 +00:00
Anders Carlsson c57acbc3af Fix a tyop
llvm-svn: 62453
2009-01-18 02:54:30 +00:00
Anders Carlsson d0e93db5ce Make CCC_ECHO output to stderr
llvm-svn: 62452
2009-01-18 02:54:17 +00:00
Anders Carlsson 178b767b9b Fix a runtime error I saw
llvm-svn: 62448
2009-01-18 02:19:54 +00:00
Daniel Dunbar 5f40dec258 ccc: Support running piped jobs (-pipe now works).
llvm-svn: 62396
2009-01-17 02:02:35 +00:00
Daniel Dunbar ee5a4a8cce ccc: Don't be pedantically compatible with -Z options, these are the
result of an internal implementation detail of gcc.

llvm-svn: 62389
2009-01-17 00:53:19 +00:00
Daniel Dunbar b3a633fc0c ccc: Clean up (user level) error handling.
- ccc now checks for existence of input files (more annoying to test,
   but matches gcc).
 - Fix some test cases.

llvm-svn: 62378
2009-01-16 23:12:12 +00:00
Daniel Dunbar c1a2043c5b ccc: Fix thinko, add gross but effective test of translation for Darwin/X86/cc1.
llvm-svn: 62360
2009-01-16 21:20:42 +00:00
Daniel Dunbar 245df5f4ac ccc: Darwin/X86: gcc compatibility, only add
'-feliminate-unused-debug-symbols' in reponse to '-g' (not '-g*').

llvm-svn: 62357
2009-01-16 21:07:21 +00:00
Daniel Dunbar 1e3677c907 ccc: Darwin/X86: Implement remainder of (non -Z...) generic argument
translation.
 - As is my general strategy, this is initially pedantically
   compatible with gcc and can be cleaned up later. So, for example,
   we still pass -static to collect2 4 times if you say '-mkernel
   -fapple-kext'. ;)

llvm-svn: 62353
2009-01-16 20:25:36 +00:00
Daniel Dunbar 87cb84e9f0 ccc: Implement support clang PTH using gcc PCH style interface.
This requires some hackery, as gcc's PCH mechanism changes behavior,
whereas while PTH is simply a cache. Notably:

 - Automatically cause clang to load a .pth file if we find one that
   matches a command line -include argument (similar to how gcc
   looks for .gch files).

 - When generating precompiled headers, translate the suffix from .gch
   to .pth (so we do not conflict with actual gcc PCH files).

 - When generating precompiled headers, copy the input header to the
   same location as the output PTH file. This is necessary because gcc
   supports -include xxx.h even if xxx.h doesn't exist, but for clang
   we need to actually have the contents of this file available.

llvm-svn: 62246
2009-01-14 23:26:40 +00:00
Daniel Dunbar fec2f2950a ccc: Finish main clang compiler argument translation.
- Still missing some odds and ends like -M.

 - Also, we still need to do some translation and forwarding of
   codegen options.

llvm-svn: 62241
2009-01-14 19:42:31 +00:00
Daniel Dunbar 3b8678fd60 ccc: Darwin/Compiler: Improve gcc compat in use of -auxbase-strip.
llvm-svn: 62213
2009-01-14 03:31:16 +00:00
Daniel Dunbar a06af2ba07 ccc: Implement argument translation for clang.
- This is what ccc (old) currently handles.

 - Clang accepts some more things that aren't getting forwarded...

llvm-svn: 62210
2009-01-14 01:50:15 +00:00
Daniel Dunbar 5cc2ba3617 ccc: Add hello.{cpp,m} tests.
- hello.cpp is XFAIL pending g++ emulation.

llvm-svn: 62208
2009-01-14 01:34:13 +00:00
Daniel Dunbar d80c653fe2 ccc: Add -ccc-echo special option, and support pulling CCC_CLANG,
CCC_ECHO, and CCC_FALLBACK from environment as ccc (old) did.

llvm-svn: 62207
2009-01-14 01:32:05 +00:00
Daniel Dunbar 65928570c0 ccc: Use Clang/Compile for Objective-C files as well.
llvm-svn: 62206
2009-01-14 01:30:55 +00:00
Daniel Dunbar a63b7f396a ccc: Add dummy Clang/Compile tool and use on Darwin/X86 for C files.
llvm-svn: 62204
2009-01-14 01:03:36 +00:00
Daniel Dunbar e725ff1263 ccc: Darwin/Compile: Define __private_extern__ when building c++.
llvm-svn: 62200
2009-01-14 00:06:14 +00:00
Daniel Dunbar d064502da3 ccc: Fix a test case.
llvm-svn: 62183
2009-01-13 21:11:28 +00:00
Daniel Dunbar 3ff18a5119 ccc: Darwin: Implement some important general argument translations
for the Darwin tool chain.
 - Ideally we would localize these to tool specific argument
   processing but for now this matches gcc closely.

llvm-svn: 62181
2009-01-13 21:07:43 +00:00
Daniel Dunbar 28cffd3dbc ccc: Allow internal tool chain specific argument translation.
- Pulled -Xarch processing into this.

 - Get rid of manual creation of forwarding arg array.

 - Use Darwin/CC1 instead of generic GCC cc1 on X86.

llvm-svn: 62172
2009-01-13 18:51:26 +00:00
Daniel Dunbar 70ff972e52 ccc: Bug fix, '-f...' should be part of the '-f' group.
llvm-svn: 62157
2009-01-13 07:39:45 +00:00
Daniel Dunbar eb83389b30 ccc: Darwin/Link also runs dsymutil in one very particular situation.
llvm-svn: 62154
2009-01-13 06:44:28 +00:00
Daniel Dunbar fc8d8effb6 ccc: Bug fix and gcc compatibility tweak.
- --gstabs only goes to Darwin/Assembler when dealing with an
     assembly file from the command line.

 - Relative placement of -o option for cc1 moves depending on
   -fsyntax-only/-S, how quaint.

llvm-svn: 62152
2009-01-13 06:25:31 +00:00
Daniel Dunbar 34bafa4a40 ccc: Add option groups.
- Simple mechanism for group together sets of options so the driver
   can efficiently deal with them as a group (i.e., for forwarding -i*
   to cc1).

 - Use to finish off the major missing pieces of Darwin/CC1 support.

llvm-svn: 62149
2009-01-13 05:54:38 +00:00
Daniel Dunbar fab583b7c6 ccc: Darwin/CC1: Hardcode (for now) some -m options to match gcc.
llvm-svn: 62146
2009-01-13 04:51:51 +00:00
Daniel Dunbar 8af0d3447e ccc: Allow host to over-ride default arch based on command line
arguments (e.g., -m32 and -m64).

llvm-svn: 62145
2009-01-13 04:05:40 +00:00
Daniel Dunbar 260c84657f ccc: Darwin/CC1: Be bug compatible with gcc in a corner case.
llvm-svn: 62131
2009-01-13 01:04:40 +00:00
Daniel Dunbar dd0efa8aad ccc: Bug fix, output can be NULL.
llvm-svn: 62108
2009-01-12 22:19:59 +00:00
Daniel Dunbar f538cfa254 ccc: Even more Darwin/cc1 argument translation support.
llvm-svn: 62105
2009-01-12 21:44:10 +00:00
Daniel Dunbar df5598444a ccc: Add leading space in -### output to match gcc.
llvm-svn: 62097
2009-01-12 19:36:35 +00:00
Daniel Dunbar b1a40a6a58 ccc: (Darwin) More argument translation for Darwin/Compile tool.
llvm-svn: 62093
2009-01-12 18:51:02 +00:00
Daniel Dunbar d0b0eca12a ccc: (Darwin) More argument translation for Darwin/Compile tool.
llvm-svn: 62089
2009-01-12 17:53:19 +00:00
Daniel Dunbar 999c85542a ccc: (Darwin) Start implementing argument translation for
Darwin/Compile tool.

llvm-svn: 62085
2009-01-12 09:23:15 +00:00
Daniel Dunbar f12e40736a ccc: When constructing a named output, only use base name (not full
path).

llvm-svn: 62083
2009-01-12 07:48:07 +00:00
Daniel Dunbar e42e520a57 ccc: (Darwin) Move path resolution into ToolChain.
llvm-svn: 62082
2009-01-12 07:45:49 +00:00
Daniel Dunbar 17bbcfd5a0 ccc: Implement the rest of Darwin/Assembler argument translation.
llvm-svn: 62081
2009-01-12 07:40:25 +00:00
Daniel Dunbar c11d8d4a09 ccc: Implement macosx-version-min conditions (including a bug fix).
llvm-svn: 62079
2009-01-12 05:02:38 +00:00
Daniel Dunbar e84d6ed8f8 ccc: Generalize Darwin/Link tool based on Darwin version.
llvm-svn: 62078
2009-01-12 04:21:12 +00:00
Daniel Dunbar 02cd7e4070 ccc: Support arguments which behave like linker inputs.
- Support comma joined options which magically turn into multiple
   value arguments (e.g., -Wl,)

 - Split out separate Arg::render routine for when an argument is
   being rendered as an input (as opposed to in its original form).

 - Add option flag for options which should be rendered without the
   option when they are used as an input (e.g., -Xlinker or -o).

 - Support -weak-l..., -weak_framework, and -weak_library.

llvm-svn: 62075
2009-01-12 03:33:58 +00:00
Daniel Dunbar 027c5fbb6d ccc: (Darwin) Pass -ObjC to linker if -ObjC, -ObjC++ or -fobjc is
present.

llvm-svn: 62070
2009-01-12 02:24:21 +00:00
Daniel Dunbar fd22768b08 ccc: Add fairly complete argument translation for Darwin link step.
- Some things are still hardcoded, and macosx-version-min comparison
   isn't implemented, but otherwise this very closely matches gcc.

 - The one exception is that arguments (like -framework or -Wl,) which are
   treated as linker inputs instead of options are not being
   forwarded yet.

llvm-svn: 62059
2009-01-11 23:13:15 +00:00
Daniel Dunbar 3b43cf6169 ccc: Add several convenience methods for argument translation.
llvm-svn: 62057
2009-01-11 22:42:24 +00:00
Daniel Dunbar 39a5c22c40 ccc: Add and name a host of arguments.
- Also, fix bug in MultipleValuesOption which was accepting joined
   arguments.

 - Add ArgList::getArgs, provides iterator over all arg instances for a
   given option.
 
 - Option definition is very much in need of cleaning...

llvm-svn: 62054
2009-01-11 22:12:37 +00:00
Daniel Dunbar adf3e5bdbc ccc: Give the Host an opportunity to switch ToolChains when binding
archs (as a driver driver).

llvm-svn: 62053
2009-01-11 22:06:22 +00:00
Daniel Dunbar 10d5adf031 ccc: Print -### output on stderr to match gcc.
llvm-svn: 62052
2009-01-11 22:03:55 +00:00
Daniel Dunbar cb8d7e131c ccc: Introduce ToolChains for mapping Actions to Tools which can
perform them.

 - A ToolChain is a coherent set of tools use in a compilation
   process. The idea is that a ToolChain holds roughly the information
   (specs, search paths, etc.) that is in a single gcc binary.

 - The default ToolChain is selected by the host and will generally
   correspond to what the default system compiler would do. However,
   this can be over-riden for a variety of purposes, for example the
   by the driver driver or for testing.

llvm-svn: 62021
2009-01-10 02:07:54 +00:00
Daniel Dunbar eacf5b174d ccc: Add generic assembler & linker tools which effectively shell out
to gcc.

llvm-svn: 62020
2009-01-10 02:00:04 +00:00
Daniel Dunbar 96977ae536 ccc: Add information about whether type can be user specified (a -x
argument) to InputType.

llvm-svn: 62019
2009-01-10 01:50:42 +00:00
Daniel Dunbar 61f97e290a ccc: Get host information via Driver methods.
llvm-svn: 62011
2009-01-09 22:21:24 +00:00
Daniel Dunbar a3491665a6 ccc: Start defining host information.
- For use by the driver in places where the host alters driver
   behavior (for example, running as a driver driver on darwin).

 - Allow user override for testing purposes.

llvm-svn: 61967
2009-01-09 01:00:40 +00:00
Daniel Dunbar f8b5992b80 ccc: Make proper synthetic arguments in places we have to construct
"fake" options, allowing Tools to be oblivious to whether an argument
is real or synthetic. This kills off DerivedArg & a number of FIXMEs.

llvm-svn: 61871
2009-01-07 18:54:26 +00:00
Daniel Dunbar 7792e90f83 ccc: Change Command to take list of strings for argv instead of Arg
instances; this just complicated things and doesn't seem to provide
any benefit.

llvm-svn: 61869
2009-01-07 18:40:45 +00:00
Daniel Dunbar de482c408c ccc: Extend ArgList to support indexing into a synthetic arg array
(for killing off DerivedArg).

llvm-svn: 61846
2009-01-07 01:57:39 +00:00
Daniel Dunbar d315a274aa ccc: Refactor so that all accesses to actual input strings go through
the ArgList.

llvm-svn: 61844
2009-01-07 01:29:28 +00:00
Daniel Dunbar 697867dadd ccc: Remove ValueArg::setValue, this is no longer used.
llvm-svn: 61794
2009-01-06 06:32:49 +00:00
Daniel Dunbar 85a868f8cc ccc: Track last actual argument instance for each option & change
driver to lookup this way instead of manually scanning arguments in
multiple places.

llvm-svn: 61793
2009-01-06 06:12:13 +00:00
Daniel Dunbar e5e454e199 ccc: Use dummy InputOption and UnknownOption classes instead of
InputArg and UnknownArg.
 - Every argument now always corresponds to some option, which
   simplifies other code.

llvm-svn: 61783
2009-01-06 02:30:10 +00:00
Daniel Dunbar e31bfdd7c7 ccc: Introduce ArgList for keeping input argv & parsed Args together.
llvm-svn: 61780
2009-01-06 01:35:44 +00:00
Daniel Dunbar 6e01600398 Add prototype ccc rewrite.
- Entry point is tools/ccc/xcc until we are a functional replacement
   for ccc.

This is highly experimental (FIXME/LOC ratio of 3.4%), quite crufty,
and barely usable (and then only on my specific Darwin). However, many
of the right ideas are present, and it already fixes a number of
things gcc gets wrong.

The major missing component is argument translation for tools
(translating driver arguments into cc1/ld/as/etc. arguments). This is
a large part of the driver functionality and will probably double the
LOC, but my hope is that the current architecture is relatively
stable.

Documentation & motivation to follow soon...

llvm-svn: 61739
2009-01-05 19:53:30 +00:00
Ted Kremenek 1e0d95e17e "missing ivar release" is a performance bug.
llvm-svn: 58436
2008-10-30 17:29:54 +00:00
Ted Kremenek 4bc52fdd75 Generalize searching for the keyword "leak" in a bug type.
llvm-svn: 58115
2008-10-24 21:23:51 +00:00
Ted Kremenek 049ba7fbb1 For Radar reporting, null dereferences should be default classified as "Crash/Hang/Data loss" <rdar://problem/6315624>
llvm-svn: 58045
2008-10-23 21:36:52 +00:00
Ted Kremenek 7a93cd8ac6 Set reproducibility back to "Always"
llvm-svn: 56891
2008-09-30 23:23:58 +00:00
Daniel Dunbar 9e3b917965 scan-view: Remove some debugging prints.
llvm-svn: 56864
2008-09-30 17:54:44 +00:00
Ted Kremenek 05f3ccda24 Default reproducibility to "Not applicable"
llvm-svn: 56860
2008-09-30 17:28:54 +00:00
Ted Kremenek 9f403161d7 Make "Performance" the default Radar classification for leaks. "Other" for all others (for now).
llvm-svn: 56858
2008-09-30 17:12:32 +00:00
Ted Kremenek fb0fef9157 Make a separate parameter class for "Radar classifications".
Do not save the radar classification to the config file.

llvm-svn: 56856
2008-09-30 17:00:30 +00:00
Ted Kremenek b166299f2b Add "SelectionParameter" class to represent drop-down boxes.
Added "Classification" field to Radar filing.
Modified FileRadar.scpt to take the classification as an argument.

llvm-svn: 56854
2008-09-30 16:37:50 +00:00
Ted Kremenek fef3c4092d Conditionally load/save default parameter value from config file.
llvm-svn: 56852
2008-09-30 16:11:33 +00:00
Ted Kremenek 094ff0b061 Use objects to represent form parameters. This allows us to abstract away some
of the details of HTML rendering of form parameters, and also us with the
ability to delegate other actions (such as in the filling in of default values)
to specific parameter objects.

llvm-svn: 56851
2008-09-30 16:08:13 +00:00
Ted Kremenek a930b56252 Tabs -> Spaces.
llvm-svn: 56833
2008-09-30 05:45:59 +00:00
Daniel Dunbar 068f7f7092 Fix braindead bug, ID number was hardcoded.
llvm-svn: 56789
2008-09-29 16:06:43 +00:00
Daniel Dunbar 08971bf2c4 Change Radar reproducibility to "Always".
llvm-svn: 56644
2008-09-26 05:00:28 +00:00
Daniel Dunbar 8e519d0d48 Disable report crashes link for the time being.
llvm-svn: 56617
2008-09-25 19:59:17 +00:00
Daniel Dunbar 0dbad4670c Add link to report analyzer failures (parse errors, asserts, etc).
llvm-svn: 56606
2008-09-25 06:05:31 +00:00
Daniel Dunbar d8d1fec6bd Add scan-view '--allow-all-hosts' option, by default access is now
restricted to 127.0.0.1.

llvm-svn: 56563
2008-09-24 17:59:41 +00:00
Daniel Dunbar fd462af19e scan-view: Add header and "report bug" links to report pages.
llvm-svn: 56470
2008-09-22 21:43:43 +00:00
Daniel Dunbar d3b096bd5a scan-view: Add links to open files using default file handler.
llvm-svn: 56454
2008-09-22 18:44:46 +00:00
Daniel Dunbar 6c9bf7d92a scan-view: Update for "button" class change, drop magic resolution of
"scanview.css", start action for opening files.

llvm-svn: 56448
2008-09-22 18:05:49 +00:00
Ted Kremenek 2c4a8f414b Removed scan-view's version of scanview.css.
llvm-svn: 56446
2008-09-22 17:55:14 +00:00
Nuno Lopes 47e46ed3da not executable
llvm-svn: 56439
2008-09-22 17:26:14 +00:00
Daniel Dunbar ed4e3210da scan-view: Add links from bug reporting forms to report & summary pages.
llvm-svn: 56427
2008-09-22 03:08:32 +00:00
Daniel Dunbar 2ef3142b92 scan-view: Search for available port if default is unavailable.
llvm-svn: 56426
2008-09-22 02:53:12 +00:00
Daniel Dunbar 34525a91fa scan-view: Store bug reporter defaults in ~/.scanview.cfg
llvm-svn: 56424
2008-09-22 02:27:45 +00:00
Daniel Dunbar 4aed7dede7 scan-view tweak
- Require index.html in provided results directory.

llvm-svn: 56423
2008-09-22 01:42:08 +00:00
Daniel Dunbar 8d139d3d40 scan-view tweaks
- Use more correct HTTP error codes on (unexpected) errors.

 - Use onLoad to set ensure bug submission method gets set correctly.

llvm-svn: 56422
2008-09-22 01:40:14 +00:00
Daniel Dunbar 553fdc6bc7 Improve scan-view report bug (submitted) interface.
Give more meaningful error messages / fail gracefully on bad form
input or SMTP errors.

Use button for Report Bug link (where available).

llvm-svn: 56420
2008-09-22 01:21:30 +00:00
Daniel Dunbar 49351e7eb9 Improve scan-view report bug interface.
- Pulled css out into Resources/scanview.css

llvm-svn: 56416
2008-09-22 00:11:51 +00:00
Daniel Dunbar 19af4ea47b scan-view tweaks:
- Add simple favicon
 - Allow resolving source file paths (should be rethought)

llvm-svn: 56414
2008-09-21 23:02:25 +00:00
Daniel Dunbar daa26f879e scan-view tweaks:
- Update for scan-build table change.
 - Add --auto-reload option (for development, avoids need to restart
   server).
 - Always send Last-Modified, with a reasonable value for dynamic content.

llvm-svn: 56409
2008-09-21 20:34:58 +00:00
Daniel Dunbar b9c42108d9 scan-view: Add more information to default bug description and use
iframe to embed bug view (for easy reference).

llvm-svn: 56406
2008-09-21 19:08:54 +00:00
Daniel Dunbar a00b7a8240 Don't add Bugzilla reporter (not yet implemented)
llvm-svn: 56404
2008-09-21 19:06:51 +00:00
Ted Kremenek ebb4245b84 Have ScanView.py generate a "<td></td>" pair in the output HTML instead of having scan-build output an empty (and possibly unused) <td>.
llvm-svn: 56393
2008-09-21 03:55:51 +00:00
Daniel Dunbar 025b48dd6e Make scan-view more robust / friendly when bug reporting fails.
llvm-svn: 56382
2008-09-20 01:43:16 +00:00
Daniel Dunbar d4c2337ef5 Add initial implementation of scan-view
- Web based interface to static analyzer.

llvm-svn: 56375
2008-09-19 23:32:11 +00:00