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

489 Коммитов

Автор SHA1 Сообщение Дата
Douglas Gregor e778504010 Introduce the notion of a SemaConsumer, which is an ASTConsumer that
also gets access to the Sema object performing semantic analysis. This
will be used by the PCH writer to serialize Sema state.

No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69595 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-20 15:53:59 +00:00
Douglas Gregor 3432fa591c Make the on-disk hash table usable with non-file
raw_ostreams. Requires LLVM r69583.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69584 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-20 07:36:26 +00:00
Douglas Gregor 9378ba44b3 Move the on-disk hash table code into its own header. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69580 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-20 07:08:21 +00:00
Chris Lattner 3bc172bc6a move group twiddling options into Diagnostic.cpp instead of
Warnings.cpp.  Warnings.cpp now doesn't need to #include
tblgen produced output directly.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69559 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-19 22:34:23 +00:00
Chris Lattner 5b912d9832 Fix PR4007: clang doesn't know -Werror-foo is the same as -Werror=foo
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69557 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-19 22:07:21 +00:00
Chris Lattner aa5bf2e8dc implement compiler support for -fno-diagnostics-fixit-info,
rdar://6805442


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69525 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-19 07:44:08 +00:00
Chris Lattner aa269c2e9c invalid directives can occur in #if 0 code, just pass them
through like other directives PTH doesn't care about.  This
should fix rdar://6804029


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69524 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-19 07:32:03 +00:00
Chris Lattner 2135619d93 make PTH not crash on a null directive (# on its own line)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69523 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-19 07:25:40 +00:00
Chris Lattner d4b1446dfa use isNot instead of !is
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69522 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-19 07:15:51 +00:00
Chris Lattner 01638a619a fix -fdollars-in-identifiers to have a default that is overriden
by the command line option if present.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69521 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-19 07:06:52 +00:00
Chris Lattner f5db8f82d5 fix rdar://6804322 by wiring up -fdollars-in-identifiers
with assembler-with-cpp mode.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69520 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-19 07:00:02 +00:00
Douglas Gregor 7297134f12 FunctionDecl::getBody() is getting an ASTContext argument for use in
lazy PCH deserialization. Propagate that argument wherever it needs to
be. No functionality change, except that I've tightened up a few PCH
tests in preparation.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69406 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-18 00:02:19 +00:00
Chris Lattner 75a97cb319 implement a new clang-cc option -dump-build-information=filename which causes the
compiler to dump random stuff from the build into the file.  Right now this
amounts to dumping command line arguments and diagnostics to the file.

The idea is that you can set an envvar, do a world build of an OS, then grep 
through all the logs for interesting things or something.

Daniel, please wire the driver up to do something with this.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69386 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-17 21:05:01 +00:00
Chris Lattner 409d4e716a refactor htmldiags to be created up front like the other diag clients.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69379 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-17 20:40:01 +00:00
Chris Lattner 40469651a3 add a virtual method to DiagnosticClient to get rid of some fragile
casting in clang-cc.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69377 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-17 20:16:08 +00:00
Fariborz Jahanian 448f5e6c19 Added -print-ivar-layout option. No change in functionality
yet.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69346 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-17 03:04:15 +00:00
Daniel Dunbar ec9587d5be Support QA_OVERRIDE_GCC3_OPTIONS
- Cover your eyes...

 - This is a simple but effective way to allow developers to build a
   project with clang while manipulating the command line, without
   having to edit the project itself.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69342 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-17 01:54:00 +00:00
Chris Lattner d51d74a3e8 implement framework for -fdiagnostics-show-option, but tblgen isn't
passing down the right info yet.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69268 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-16 05:44:38 +00:00
Chris Lattner b54b276a92 move handling of -pedantic and -pedantic-errors into Diagnostics,
out of Warnings.cpp.  This simplifies warnings.cpp and makes it more
efficient.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69266 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-16 05:04:32 +00:00
Chris Lattner 2b07d8fe9e arrange for -Wno-error=foo warnings to be immune to -Werror as
they are supposed to be.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69265 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-16 04:32:54 +00:00
Chris Lattner 8ac3af96a1 when tblgen fills in all the subgroup info, clang is ready for it.
This depends on r69249 of llvm.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69250 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-16 00:53:55 +00:00
Chris Lattner 9a7e556470 make unknown warnings a warning, not an error.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69239 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-15 22:48:58 +00:00
Chris Lattner c83b60de5d add support for -Wextra and -W
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69236 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-15 22:38:06 +00:00
Chris Lattner d7492c4f91 use tablgen-generated warning groups.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69221 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-15 20:58:49 +00:00
Chris Lattner af008839f3 now that we've decoupled diagnostic classes from default mappings,
move the remaining default mapping exceptions from C++ code into
the .td files.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69183 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-15 17:20:11 +00:00
Chris Lattner 9dbbdbf637 rename variable in comment, not just in code :).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69166 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-15 14:42:02 +00:00
Chris Lattner 27ceb9d77d 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69154 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-15 07:01:18 +00:00
Chris Lattner e9e0cc7999 remove some commented out -Wstrict-selector-match stuff.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69148 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-15 04:57:48 +00:00
Chris Lattner 6280dbcb48 clean up error messages.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69142 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-15 04:51:48 +00:00
Chris Lattner 1d13a5d5ab Add support for -Werror=foo and -Wno-error=foo
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69138 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-15 04:37:12 +00:00
Chris Lattner 5147e8e018 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69136 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-15 04:27:38 +00:00
Douglas Gregor 087fd53680 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69101 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-14 23:32:43 +00:00
Chris Lattner 2c78b873f4 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69099 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-14 23:22:57 +00:00
Chris Lattner 7eba5c9df9 add support for -W[no-]extra-tokens
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69071 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-14 20:36:01 +00:00
Douglas Gregor f807fe0d1a 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69043 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-14 16:27:31 +00:00
Daniel Dunbar 04d4078425 Clean up handling of visibility.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69027 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-14 06:00:08 +00:00
Daniel Dunbar 1810790f12 Reapply 68936, turned out to that clang's better debug info exposed a
codegenerator bug.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68983 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-13 20:46:33 +00:00
Daniel Dunbar 5c71e59660 Revert 68936, LLVM still isn't ready to handle debug info + optimization.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68972 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-13 18:03:39 +00:00
Chris Lattner 4d41765acc the driver caught up. This makes -msse3 correctly set __SSE3__ etc.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68943 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-13 06:33:49 +00:00
Devang Patel 7486af8fc2 Enable debug info generation while optimizing.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68936 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-13 04:22:59 +00:00
Chris Lattner d82df3ad43 Implement support for GCC's -dD mode, which dumps -E output *and*
macro definitions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68884 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-12 01:56:53 +00:00
Chris Lattner 3c304bd9ec add some #includes for better compatibility with gcc 4.4,
thanks to Tobias Stadler for pointing this out.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68868 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-11 18:40:46 +00:00
Douglas Gregor e1d918e9fe 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68838 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-10 23:10:45 +00:00
Chris Lattner 531cc83556 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68832 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-10 22:13:17 +00:00
Chris Lattner 6bf0f4ce59 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68830 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-10 21:58:23 +00:00
Fariborz Jahanian 6a1284ac17 Reject compiles for x86_64 target for MacOS versions which
do not support it.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68819 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-10 20:33:45 +00:00
Daniel Dunbar 8d33cd77dc 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


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68815 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-10 19:52:24 +00:00
Daniel Dunbar a1e2fd9b58 Driver: CCC_ADD_ARGS could end up using dangling pointers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68805 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-10 18:32:59 +00:00
Chris Lattner df961c28f8 emit tokens, constify the Preprocessor passed down into PCH writer.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68798 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-10 18:08:30 +00:00
Douglas Gregor f1202511ee Add PCH sources to CMake build files
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68794 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-10 17:28:42 +00:00
Chris Lattner 0b1fb98801 Arrange for the preprocessor to be passed down into the PCH writer.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68790 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-10 17:15:23 +00:00
Douglas Gregor 14f79002e5 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68758 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-10 03:52:48 +00:00
Douglas Gregor 2cf2634ffd 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68732 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-09 22:27:44 +00:00
Douglas Gregor 6ab3524f72 Propagate the ASTContext to various AST traversal and lookup functions.
No functionality change (really).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68726 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-09 21:40:53 +00:00
Daniel Dunbar 95bf5d6a86 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


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68665 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-09 00:51:16 +00:00
Chris Lattner d613c3d050 add support for -Wtrigraphs and -Wno-trigraphs.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68649 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-08 22:37:15 +00:00
Chris Lattner fd10511b3e finish the implementation of -imacros. The driver still needs to be hooked up.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68640 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-08 20:53:24 +00:00
Chris Lattner b31ac22ed7 According to the GCC man page, all -imacros are included before any -include's.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68633 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-08 20:15:42 +00:00
Chris Lattner fbb2298815 properly escape filenames when generating implicit #includes, this handles
things like " in paths etc.  Found by inspection.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68632 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-08 20:10:57 +00:00
Chris Lattner b8e240ed8b Add initial support for -imacros. Right now it has the same semantics as
-include, but that will be fixed soon.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68625 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-08 18:24:34 +00:00
Daniel Dunbar 3bbc75302f 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68621 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-08 18:03:55 +00:00
Daniel Dunbar c9abc043af 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...


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68595 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-08 05:11:16 +00:00
Chris Lattner 56473d3a1b fix typo, noticed by Gabor
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68587 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-08 03:36:03 +00:00
Daniel Dunbar 9fd0b1f845 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).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68584 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-08 03:03:23 +00:00
Daniel Dunbar d573d26e1a Driver: Fix forwarding of -{std,ansi,trigraphs} when there are
multiple instances of an option.

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


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68558 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-07 22:13:21 +00:00
Daniel Dunbar 48d1ef782c 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68550 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-07 21:16:11 +00:00
Chris Lattner 3eb2fc820e add a warning for this crazy case, as suggested by Eli.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68524 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-07 18:18:09 +00:00
Chris Lattner 0b51415dcf 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68511 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-07 06:02:44 +00:00
Daniel Dunbar b1c71dfe3f Remove a FIXME, the driver handles -O4.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68481 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-07 00:38:22 +00:00
Anders Carlsson 4ca076fffd Define __OPTIMIZE__ and __OPTIMIZE_SIZE__ if the -O[12] and -Os flags are passed to the compiler.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68450 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-06 17:37:10 +00:00
Chris Lattner 50748f4362 enable -std=c9x and -std=iso9899:199x, patch by Ed Schouten!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68449 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-06 17:17:55 +00:00
Zhongxing Xu ba16be9d4f Apply a patch which adds 'OriginalParmVar' to the DeclContextPrinter by Jon
Simons.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68436 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-05 02:04:38 +00:00
Fariborz Jahanian 7cd2e93125 Implement -fvisibility.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68369 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-03 03:28:57 +00:00
Douglas Gregor bf1bd6eab1 Rename GeneratePCH action to GeneratePTH
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68348 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-02 23:43:50 +00:00
Douglas Gregor 26df2f0958 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. 



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68342 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-02 19:05:20 +00:00
Mike Stump 035cf8911c Remove -ftrapu.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68330 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-02 18:15:54 +00:00
Douglas Gregor de4bf6a632 Provide FIX-IT notes to describe what fix-it is doing behind the
scenes, using the underlying diagnostic client to format the
messages.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68324 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-02 17:13:00 +00:00
Douglas Gregor 558cb56caf Introduce a "-fixit" mode to clang-cc that applies code-modification hints.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68268 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-02 01:08:08 +00:00
Mike Stump 5d8b2cf9fd 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68267 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-02 01:03:55 +00:00
Mike Stump 2add47387d Add -ftrapv support, patch from David Chisnall; well all except the
clang option code that is and two bug fixes.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68240 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-01 20:28:16 +00:00
Daniel Dunbar 6b83f669b2 Allow CCC_ADD_ARGS to add empty arguments
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68235 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-01 19:38:07 +00:00
Daniel Dunbar e5be6dac24 Support CCC_ADD_ARGS in new driver.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68231 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-01 19:08:46 +00:00
Douglas Gregor 7e203b7f5d Revert r68221, -ftrapv support, which causes several regressions in
Clang's test suite.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68230 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-01 18:59:55 +00:00
Mike Stump 3fb07bdc32 Add -ftrapv support, patch from David Chisnall; well all except the
clang option code that is.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68221 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-01 18:19:33 +00:00
Daniel Dunbar 0b5b0da158 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. :)


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68189 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-01 05:09:09 +00:00
Ted Kremenek 08478eb8b2 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'.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68164 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-01 00:23:28 +00:00
Daniel Dunbar 64ffc1472e Add two FIXMEs
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68138 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-31 20:10:05 +00:00
Ted Kremenek c2542b62a2 Rename clang.[cpp,h] to clang-cc.[cpp,h] to reflect the name change of the
low-level frontend driver.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68131 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-31 18:58:14 +00:00
Daniel Dunbar af07f936b6 (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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68119 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-31 17:35:15 +00:00
Douglas Gregor 8499f3f5ff Implement -Wmissing-prototypes. Fixes PR3911.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68110 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-31 16:35:03 +00:00
Steve Naroff 17f689f7f8 Add support for -Wdeprecated-declarations.
This fixes <rdar://problem/6712496> Unable to disable deprecated warning.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68108 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-31 15:00:11 +00:00
Eli Friedman 757e0dd411 Implement -Wno-pointer-sign.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68062 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-30 21:19:48 +00:00
Daniel Dunbar cd8e4c44dd Driver: Support -M and -MM.
- Not particularly elegant, but my hand is forced by gcc.

Also, tweak -ccc-print-bindings output.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68027 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-30 06:36:42 +00:00
Daniel Dunbar a5a7bd0de7 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68022 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-30 00:34:04 +00:00
Chris Lattner 682bf92db4 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68002 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-29 16:50:03 +00:00
Chris Lattner b28317a8e5 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67952 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-28 19:18:32 +00:00
Chris Lattner 7e24e82a70 rename some methods.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67923 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-28 06:33:19 +00:00
Chris Lattner b23ff6b4eb reduce indentation, no functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67916 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-28 05:44:17 +00:00
Chris Lattner 1266eca868 remove TranslationUnit.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67914 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-28 04:31:31 +00:00
Chris Lattner 557c5b1717 push more ASTContext goodness out through interfaces that use
TranslationUnit


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67913 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-28 04:27:18 +00:00
Chris Lattner 3599dbe94e remove TranslationUnit from ParseAST.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67911 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-28 04:13:34 +00:00
Chris Lattner dacbc5d46a change HandleTranslationUnit to take an ASTContext instead of TranslationUnit
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67910 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-28 04:11:33 +00:00
Chris Lattner 678dc3bb1f remove dead ivar.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67907 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-28 04:05:05 +00:00
Chris Lattner d2fa67570b hoist TranslationUnit some more.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67905 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-28 03:56:54 +00:00
Chris Lattner 80a033358d eliminate some wrappers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67904 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-28 03:53:02 +00:00
Chris Lattner 5f737ccd38 eliminate ReadASTBitcodeFile
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67903 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-28 03:49:26 +00:00
Chris Lattner a9376d470c move serialization logic from TranslationUnit to ASTContext.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67902 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-28 03:45:20 +00:00
Chris Lattner e90778716b don't poke at TranslationUnit directly
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67900 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-28 03:29:40 +00:00
Chris Lattner 7bb0da001f eliminate ASTConsumer::InitializeTU, all clients are
happy with just ASTContext, they don't need a TU.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67894 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-28 02:18:25 +00:00
Chris Lattner 925a704e08 revert mike's patch which broke test/CodeGen/no-common.c.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67893 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-28 02:12:08 +00:00
Chris Lattner ed0e497efc remove TranslationUnit::OwnsDecls, which is only set, never read.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67891 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-28 01:44:40 +00:00
Chris Lattner 9ecd26ad19 simplify ParseAST by sucking -disable-free handling logic up into
clang.cpp


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67890 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-28 01:37:17 +00:00
Chris Lattner 52ba870eba move StatListener out to top level.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67886 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-28 00:55:35 +00:00
Chris Lattner f2390367a0 various cleanups, no functionality change
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67883 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-28 00:16:20 +00:00
Mike Stump 1c9b7422dc Fixup -fcommon and -fno-common to be more gcc compatible.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67863 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-27 20:15:22 +00:00
Chris Lattner 16629386f1 push line markers through -E mode.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67854 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-27 17:13:49 +00:00
Chris Lattner bd3606426d most of this is plumbing to get CompileOptions down into
CodeGenModule.  Once there, add a new NoCommon option to
it and implement -fno-common.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67735 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-26 05:00:52 +00:00
Douglas Gregor 06c0fecd19 Pass access specifiers through to member classes and member enums.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67710 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-25 22:00:53 +00:00
Ted Kremenek 90e4143ac2 Turn on '-analyzer-eagerly-assume' by default in ccc for the static analyzer.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67663 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-25 00:32:30 +00:00
Mike Stump a43a21ef14 Really fix cmake style builds.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67633 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-24 17:52:34 +00:00
Chris Lattner 37e217cf4d -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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67621 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-24 16:18:41 +00:00
Daniel Dunbar 82fa7c5b9d Install clang-cc to libexec/clang-cc (instead of bin/clang-cc).
- Updated ccc & driver to look in libexec/ for tools.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67607 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-24 04:07:10 +00:00
Daniel Dunbar 7ec3dafdda Rename clang-driver to clang.
Again, I tried to update cmake but it is untested.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67606 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-24 03:07:05 +00:00
Daniel Dunbar 073777f3ab Move <root>/Driver into <root>/tools/clang-cc.
Again, I tried to update cmake but it is untested.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67605 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-24 03:00:12 +00:00
Daniel Dunbar cbcd98bdb9 Add CMake files for tools/driver; I am just guessing here, can someone test/fix?
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67604 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-24 02:52:57 +00:00
Daniel Dunbar d7d5f0223b Rename clang to clang-cc.
Tests and drivers updated, still need to shuffle dirs.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67602 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-24 02:24:46 +00:00
Daniel Dunbar 2836c4aa02 ccc: Have generic GCC tool chain search the driver directory for
executables (e.g., clang).
 - This matches the clang-driver behavior.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67590 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-24 01:06:18 +00:00
Daniel Dunbar d3dfdb8d98 ccc/Driver: -r option doesn't take an argument.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67581 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-24 00:20:13 +00:00
Daniel Dunbar 6a15ff9d9a ccc: Forward -f[no-]builtin to clang.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67517 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-23 14:57:31 +00:00
Daniel Dunbar af96def468 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67425 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-21 00:40:53 +00:00
Daniel Dunbar e33bea4ef3 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67418 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-20 23:39:23 +00:00
Daniel Dunbar b238a8fec3 ccc: Use -include-pth.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67410 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-20 22:13:54 +00:00
Daniel Dunbar 734932c7dc Driver: Get executable path using llvm::sys::Path::GetMainExecutable.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67228 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-18 20:25:53 +00:00
Daniel Dunbar 5f635e6b76 ccc: Pass --relocation-model as separate arguments (to match Driver).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67190 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-18 09:36:19 +00:00
Daniel Dunbar 510d73200e Driver: Use custom diag printer to drop dependency on libFrontend and
libLex.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67155 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-18 02:11:26 +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
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 159715fbbe Update test.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66967 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-13 22:11:42 +00:00
Daniel Dunbar f1a624fcd4 ccc: Handle limited forms of -ccc-host-triple for testing
compatibility with C++ rewrite.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66938 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-13 20:33:09 +00:00
Daniel Dunbar 13135a6171 ccc/Driver: Forward -fheinous-gnu-extensions to clang.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66915 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-13 18:12:01 +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 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 26308bafd3 ccc: Don't print the arch for every action when printing phases.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66886 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-13 12:16:31 +00:00
Daniel Dunbar 3bf8224fa3 ccc/Driver: Forward -fprint-source-range-info to clang.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66879 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-13 10:03:45 +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 00171ffc8e ccc: Fix broken assertion.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66793 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-12 15:59:34 +00:00
Daniel Dunbar 5f22d7dc80 ccc: Fix -ccc-print-phases when doing a universal build.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66792 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-12 15:57:47 +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 008dd35220 ccc: Tweak some group names.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66772 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-12 04:50:20 +00:00
Daniel Dunbar d639b42fb1 ccc: Cleanup arguments a bit; we don't need a separate group for
-fblocks, and there were some duplicate options scattered in.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66764 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-12 03:28:55 +00:00
Daniel Dunbar 105e9d75d9 ccc: -x assembler-with-cpp was broken for darwin, and it wasn't using
clang as the preprocessor even when it should.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66737 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-11 23:07:54 +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 9db8f5d743 Forward -ftemplate-depth-<N> to clang's -ftemplate-depth N.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66516 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-10 00:35:30 +00:00
Daniel Dunbar cad3df8412 ccc: Parse -T{bss,data,text}, -iwithsysroot, -specs correctly.
Also, fix some test cases.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66425 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-09 17:43:51 +00:00
Daniel Dunbar 5ea766a6ac Fix thinko. *cough* ofcourseItestedit *cough*
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66283 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-06 18:35:43 +00:00
Daniel Dunbar 6370812b42 Tidy file removal cleanup & remove race condition on file existence.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66281 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-06 18:32:01 +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 3639b4d0d3 ccc: Fix passing of -nozero-initialized-in-bss.
- PR3722.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66052 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-04 19:17:10 +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
Ted Kremenek d76c6a38b8 Do not automatically run the 'missing -dealloc' check until we have adequate time to make it much smarter (too much noise).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65474 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-25 21:08:30 +00:00
Daniel Dunbar b89c106114 ccc: Don't remove result files on error when -save-temps is present.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65349 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-23 23:37:18 +00:00
Daniel Dunbar 8e111c77e4 ccc: Remove unknown host warning, it was breaking gcc's configure.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65276 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-22 08:15:14 +00:00
Daniel Dunbar 9ff1c0784c ccc: Remove temporary files used in compilation, and remove
compilation results on failures.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65254 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-22 01:23:52 +00:00
Daniel Dunbar 2b91d502a5 Unbreak Darwin PIC handling; my refactoring yesterday was bogus.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65154 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-20 20:52:47 +00:00
Daniel Dunbar 9876edc067 Fix test case.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65139 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-20 18:53:07 +00:00
Daniel Dunbar 3198be8ab5 ccc: Spell mattr correctly.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65119 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-20 07:47:48 +00:00
Daniel Dunbar 4311e4507a 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65118 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-20 07:35:04 +00:00
Daniel Dunbar c4556d1151 ccc: Use toolchain hook for default relocation model value.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65116 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-20 06:48:26 +00:00
Daniel Dunbar a805135a16 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


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65104 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-20 01:48:01 +00:00
Daniel Dunbar 15423b066d ccc: Store arch name in all toolchains.
- No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65102 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-20 01:36:35 +00:00
Daniel Dunbar 5e187a16f7 ccc: Give all tools access to the toolchain they are in.
- No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65100 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-20 01:30:38 +00:00
Daniel Dunbar eeb44ce483 ccc: Give nicer error when spawning a subprocess fails.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65075 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-19 22:59:57 +00:00
Daniel Dunbar f084663ed0 ccc: Also look for .gch files when seeing if we should auto load a
token-cache for clang.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65069 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-19 22:01:23 +00:00
Daniel Dunbar 00dbfde0d7 ccc: Forward -ftime-report to clang.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64887 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-18 05:01:43 +00:00
Daniel Dunbar d563e52c37 ccc: Pass -{MM,MMD,MF,MP,MT} to clang. Error on -{M,MM,MG,MQ} which
clang doesn't support yet.
 - See PR3603.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64783 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-17 19:02:12 +00:00
Daniel Dunbar 360c6ce217 ccc: Recognize -isystem.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64776 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-17 18:10:48 +00:00
Daniel Dunbar 48d0d61001 ccc: Assume gcc will accept piped assembler input when using generic GCC toolchain.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64775 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-17 18:10:15 +00:00
Daniel Dunbar 87a7b2833e ccc: Fix a FIXME.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64774 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-17 18:07:00 +00:00
Ted Kremenek be1fe1eb12 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


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64737 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-17 04:27:41 +00:00
Daniel Dunbar 27a02acd23 ccc: Pass -f[no-]math-errno to clang.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64709 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-17 00:42:05 +00:00
Daniel Dunbar 83d67909f9 ccc: @<filename> arguments are only treated specially if <filename>
exists, otherwise gcc just treats as an input.
 - PR3591


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64640 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-16 18:18:43 +00:00
Daniel Dunbar 41577f1130 ccc: Pass -P to clang.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64578 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-15 05:59:37 +00:00
Douglas Gregor 3573c0c0b4 Add -ffreestanding to suppress the implicit declaration of library builtins like printf and malloc. Fixes PR3586
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64566 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-14 20:49:29 +00:00
Daniel Dunbar 1ee821b0b9 ccc: Suffix for PCH files is appended, not replaced. (Test case)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64467 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-13 17:42:52 +00:00
Daniel Dunbar faa20c7f41 ccc: Suffix for PCH files is appended, not replaced.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64466 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-13 17:42:34 +00:00
Daniel Dunbar 501525eed4 ccc: Test case for transparent PTH support.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64420 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-13 00:49:50 +00:00
Daniel Dunbar 3d2b79020a ccc: Stop patching output file name when using transparent PTH support.
<rdar://problem/6515236> [ccc] generate expected output files when used with PCH


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64419 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-13 00:49:01 +00:00
Daniel Dunbar 0a3e3caa15 Always pass -disable-free to clang when compiling.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64416 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-13 00:29:22 +00:00
Mike Stump 77a60115e3 One more tweak to account for gluing together llvm and clang into one.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64276 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-11 01:11:36 +00:00
Mike Stump 84606bb63f More version experimentation.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64271 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-11 01:01:17 +00:00
Mike Stump e6c4f65bd4 Run a little experiment with version numbers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64268 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-11 00:36:04 +00:00
Daniel Dunbar 8aa6181260 ccc: -dM wasn't being passed to Darwin/CC1 correctly.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64169 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-09 21:22:38 +00:00
Daniel Dunbar 8425a0f7b5 ccc: Forward -dM to clang.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63955 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-06 19:26:48 +00:00
Daniel Dunbar 2ceb041eb3 ccc/Darwin: Add a missing Darwin argument translation, -shared becomes
-dynamiclib. Re-audited translations to make sure I didn't miss
something else.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63953 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-06 19:18:58 +00:00
Daniel Dunbar 5e83baaaaa ccc: Give explicit error on @ style argument lists (not yet supported).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63903 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-06 01:28:59 +00:00
Daniel Dunbar bbd34e6658 ccc: Implement special language recognition handling for -.
- <rdar://problem/6551577> [ccc] require -x with -


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63901 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-05 23:44:44 +00:00