Commit Graph

8422 Commits

Author SHA1 Message Date
Fariborz Jahanian 0196a1cd2b This patch fixes the code gen failures which was a fallout from
not merging protocol properties into the classes which
use those protocols. With this patch, all my exceutable
test pass again.

llvm-svn: 62030
2009-01-10 21:06:09 +00:00
Fariborz Jahanian 8630b2d992 Explicit declaration of property setters over-ride
prohibition of 'readonly' properties in an assignment.

llvm-svn: 62028
2009-01-10 18:43:55 +00:00
Zhongxing Xu 776b2fa1ea add a bunch of castToDeclContext/castFromDeclContext methods.
llvm-svn: 62027
2009-01-10 14:38:38 +00:00
Zhongxing Xu 1857139755 add castToDeclContext/castFromDeclContext methods to RecordDecl.
llvm-svn: 62026
2009-01-10 14:14:16 +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
Douglas Gregor b37080a969 Allow multiple Microsoft calling-convention keywords. Fixes rdar://problem/6486133
llvm-svn: 62018
2009-01-10 00:48:18 +00:00
Fariborz Jahanian d9c238dc9f assert if attempting to code gen. a property setter/getter
coming from a protocol.

llvm-svn: 62017
2009-01-10 00:13:01 +00:00
Douglas Gregor 498b58ceb1 Don't bother setting NextDeclarator for EnumConstantDecls. It isn't used
llvm-svn: 62016
2009-01-09 23:23:35 +00:00
Douglas Gregor 658b9550bb When we see a reference to a struct, class, or union like "struct X"
that is neither a definition nor a forward declaration and where X has
not yet been declared as a tag, introduce a declaration
into the appropriate scope (which is likely *not* to be the current
scope). The rules for the placement of the declaration differ slightly
in C and C++, so we implement both and test the various corner
cases. This implementation isn't 100% correct due to some lingering
issues with the function prototype scope (for a function parameter
list) not being the same scope as the scope of the function
definition. Testcase is FIXME'd; this probably isn't an important issue.

Addresses <rdar://problem/6484805>.

llvm-svn: 62014
2009-01-09 22:42:13 +00:00
Daniel Dunbar 60e734782f Add utils/SummarizeErrors.
- Little script for scanning a compile log and summarizing warnings,
   errors, assertions, and crashes.
 - Is very slow, and stack trace regexs probably only work on Darwin.

llvm-svn: 62013
2009-01-09 22:39:43 +00:00
Sebastian Redl 6138f2b4d8 Add some comments to the virtual work. Thanks to Doug Gregor for the review.
llvm-svn: 62012
2009-01-09 22:29:03 +00:00
Daniel Dunbar 61f97e290a ccc: Get host information via Driver methods.
llvm-svn: 62011
2009-01-09 22:21:24 +00:00
Ted Kremenek 890d44eb7f Dead stores checker: Don't flag dead stores for self-assignments (common escape hatch for 'unused variable' warnings).
llvm-svn: 62010
2009-01-09 22:15:01 +00:00
Ted Kremenek 47b8cf6deb Enhance PTH 'getSpelling' caching:
- Refactor caching logic into a helper class PTHSpellingSearch
- Allow "random accesses" in the spelling cache, thus catching the remaining
  cases where 'getSpelling' wasn't hitting the PTH cache
  
For -Eonly, PTH, Cocoa.h:
- This reduces wall time by 3% (user time unchanged, sys time reduced)
- This reduces the amount of paged source by 1112K.
  The remaining 1112K still being paged in is from somewhere else
  (investigating).

llvm-svn: 62009
2009-01-09 22:05:30 +00:00
Sebastian Redl 020cddcfee Prevent a segfault for vaarg expressions on unsupported architectures.
llvm-svn: 62008
2009-01-09 21:09:38 +00:00
Fariborz Jahanian 519976c4e9 This patch removes mergeProperties and does the property lookup
in designated protocols lazily.

llvm-svn: 62007
2009-01-09 21:04:52 +00:00
Daniel Dunbar 8429dbc753 Implement EmitUnsupportedRValue to generate an appropriately typed RValue.
llvm-svn: 62004
2009-01-09 20:09:28 +00:00
Sebastian Redl 6079525591 Very basic support for pure virtual functions.
llvm-svn: 62003
2009-01-09 19:57:06 +00:00
Douglas Gregor 020713e308 Replace DeclContext's vector of ScopedDecl pointers with a linked list
of ScopedDecls (using the new ScopedDecl::NextDeclInScope
pointer). Performance-wise:

  - It's a net win in memory utilization, since DeclContext is now one
    pointer smaller than it used to be (std::vectors are typically 3
    pointers; we now use 2 pointers) and 
  - Parsing Cocoa.h with -fsyntax-only (with a Release-Asserts Clang)
    is about 1.9% faster than before, most likely because we no longer
    have the memory allocations and copying associated with the
    std::vector.

I'll re-enable serialization of DeclContexts once I've sorted out the
NextDeclarator/NextDeclInScope question.

llvm-svn: 62001
2009-01-09 19:42:16 +00:00
Douglas Gregor c72e645fd6 Make sure that ScopedDecls passed to DeclContext::addDecl are added into their lexical context
llvm-svn: 61998
2009-01-09 18:51:29 +00:00
Ted Kremenek feb260784b Always print out SourceManager stats with 'Stats' is true. This revealed that PTH always pulls in the source pages with -fsyntax-only (investigating further).
llvm-svn: 61996
2009-01-09 18:20:21 +00:00
Douglas Gregor ffca3a21f1 Provide a new kind of iterator, the specific_decl_iterator, that
filters the decls seen by decl_iterator with two criteria: the dynamic
type of the declaration and a run-time predicate described by a member
function. This simplifies EnumDecl, RecordDecl, and ObjCContainerDecl
considerably. It has no measurable performance impact.

llvm-svn: 61994
2009-01-09 17:18:27 +00:00
Daniel Dunbar 93215eca9b Emit more refined "unsupported" error for block expressions.
llvm-svn: 61993
2009-01-09 17:04:29 +00:00
Daniel Dunbar bb197e439d Give "unsupported" error on calls through block pointers instead of
crashes.

llvm-svn: 61992
2009-01-09 16:50:52 +00:00
Steve Naroff b3a8798253 Move property API's up to ObjCContainerDecl (removing a lot of duplicate code).
Add isa/cast/dyncast support for ObjCContainerDecl.
Renamed classprop_iterator/begin/end to prop_iterator/begin/end (the class prefix was confusing).
More simplifications to Sema::ActOnAtEnd()...
Added/changed some FIXME's as a result of the above work.

llvm-svn: 61988
2009-01-09 15:36:25 +00:00
Chris Lattner c7c9ab7947 Fix rdar://6480479 - [parser] infinite loop on invalid input
llvm-svn: 61975
2009-01-09 04:34:13 +00:00
Daniel Dunbar cc1b6e8fce Convert block types in IRgen. This is not the correct type, but
matches llvm-gcc (?).

llvm-svn: 61974
2009-01-09 02:48:46 +00:00
Daniel Dunbar 9b21e63251 Block pointer types are not aggregate types.
llvm-svn: 61973
2009-01-09 02:44:18 +00:00
Douglas Gregor 1e21c19be6 Don't crash when our FunctionDecl has a non-identifier name
llvm-svn: 61970
2009-01-09 01:47:02 +00:00
Daniel Dunbar f4c6616d9d Fix crash on null deference when searching for readwrite properties in
categories.
 - Also, simplify nesting via early return.

llvm-svn: 61968
2009-01-09 01:04:21 +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
Douglas Gregor c25d7a7fe0 Addressed the issue in <rdar://problem/6479085>, where we failed to
rewrite @class declarations that showed up within linkage
specifications because those @class declarations never made it any
place where the rewriter could find them.

Moved all of the ObjC*Decl nodes over to ScopedDecls, so that they can
live in the appropriate top-level or transparent DeclContext near the
top level, e.g., TranslationUnitDecl or LinkageSpecDecl. Objective-C
declarations now show up in a traversal of the declarations in a
DeclContext (they didn't before!). This way, the rewriter finds all
Objective-C declarations within linkage specifications.

llvm-svn: 61966
2009-01-09 00:49:46 +00:00
Ted Kremenek 339153d3be Re-enable PTH testing for Cocoa.h and Carbon.h (and include testing for Objective-C++).
llvm-svn: 61965
2009-01-09 00:41:48 +00:00
Fariborz Jahanian e84858ccf9 Adding support for ObjC methods which have c-style
parameter list. This is work in progress.

llvm-svn: 61964
2009-01-09 00:38:19 +00:00
Ted Kremenek b54c19a754 Enable support for '-x objective-c++-header'.
llvm-svn: 61963
2009-01-09 00:38:08 +00:00
Ted Kremenek 6697945069 Simpler solution to LiteralSupport compatibility: just add one whitespace character after each cached string.
llvm-svn: 61962
2009-01-09 00:37:37 +00:00
Ted Kremenek 8ae06625b5 Invert assertion condition.
llvm-svn: 61961
2009-01-09 00:36:11 +00:00
Ted Kremenek cb5a95f3a4 Temporarily revert r61956 and r61957 (PTH tests failing).
llvm-svn: 61960
2009-01-09 00:27:29 +00:00
Ted Kremenek 510b4da49d Enhance -fsyntax-only test of Carbon.h to also include testing for PTH.
llvm-svn: 61958
2009-01-08 23:42:56 +00:00
Ted Kremenek 8598addcd7 Enhance -fsyntax-only test of Cocoa.h to also include testing for PTH.
llvm-svn: 61957
2009-01-08 23:41:35 +00:00
Ted Kremenek d4a4fd99de PTH: For the cached spellings of literals, store one whitespace character after the spelling to accomodate sanity checking in LiteralSuppoert.cpp.
llvm-svn: 61956
2009-01-08 23:40:50 +00:00
Anders Carlsson bfd47a3c00 Add mm_malloc.h, patch by Sam Weinig.
llvm-svn: 61954
2009-01-08 23:30:09 +00:00
Fariborz Jahanian d11dc0b1d9 Place warning about 'readonly' property attributes which
are related to setter syntax under -Wreadonly-setter-attrs
to prevent warnings in projects built with gcc.

llvm-svn: 61953
2009-01-08 23:23:10 +00:00
Douglas Gregor e4b414c781 Revert my previous, failed attempt to pretty-print anonymous struct/union accesses well. Added a FIXME so we know to revisit this later
llvm-svn: 61951
2009-01-08 22:45:41 +00:00
Ted Kremenek 0667123ba1 Fix ObjCInterfaceDecl::Destroy and ObjCProtocolDecl::Destroy to iterate and destroy all contained ObjCMethodDecls in one sweep. This fixes a use-after-free error found by valgrind.
llvm-svn: 61943
2009-01-08 20:49:27 +00:00
Douglas Gregor c8938e09ca Remove double-insertion of EnumConstantDecls. Thanks to Zhongxing Xu for pointing this out
llvm-svn: 61942
2009-01-08 20:48:26 +00:00
Ted Kremenek 48ed48212d Added iterator mechanism to ObjCContainerDecl to iterate over both class and instance methods at the same time.
llvm-svn: 61941
2009-01-08 20:48:19 +00:00
Douglas Gregor 82ac25e4a7 Unify the code for defining tags in C and C++, so that we always
introduce a Scope for the body of a tag. This reduces the number of
semantic differences between C and C++ structs and unions, and will
help with other features (e.g., anonymous unions) in C. Some important
points:

  - Fields are now in the "member" namespace (IDNS_Member), to keep
    them separate from tags and ordinary names in C. See the new test
    in Sema/member-reference.c for an example of why this matters. In
    C++, ordinary and member name lookup will find members in both the
    ordinary and member namespace, so the difference between
    IDNS_Member and IDNS_Ordinary is erased by Sema::LookupDecl (but
    only in C++!). 
  - We always introduce a Scope and push a DeclContext when we're
    defining a tag, in both C and C++. Previously, we had different
    actions and different Scope/CurContext behavior for enums, C
    structs/unions, and C++ structs/unions/classes. Now, it's one pair
    of actions. (Yay!)

There's still some fuzziness in the handling of struct/union/enum
definitions within other struct/union/enum definitions in C. We'll
need to do some more cleanup to eliminate some reliance on CurContext
before we can solve this issue for real. What we want is for something
like this:

  struct X {
    struct T { int x; } t;
  };

to introduce T into translation unit scope (placing it at the
appropriate point in the IdentifierResolver chain, too), but it should
still have struct X as its lexical declaration
context. PushOnScopeChains isn't smart enough to do that yet, though,
so there's a FIXME test in nested-redef.c

llvm-svn: 61940
2009-01-08 20:45:30 +00:00