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

298 Коммитов

Автор SHA1 Сообщение Дата
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