]> granicus.if.org Git - clang/log
clang
16 years agoForgot to commit this
Anders Carlsson [Sun, 11 Jan 2009 19:40:10 +0000 (19:40 +0000)]
Forgot to commit this

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62042 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoUse a common function for emitting asm inputs and remove a FIXME
Anders Carlsson [Sun, 11 Jan 2009 19:32:54 +0000 (19:32 +0000)]
Use a common function for emitting asm inputs and remove a FIXME

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62041 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agothis patch "adds support for specifying multiple dependancy targets using ‘-MT’....
Chris Lattner [Sun, 11 Jan 2009 19:28:34 +0000 (19:28 +0000)]
this patch "adds support for specifying multiple dependancy targets using ‘-MT’. Using this patch, I was able to use ‘ccc’ as C compiler for the few C files in LLVM. In my brief testing, the output remains identical to that of GCC."

Patch by Dan Villiom Podlaski Christiansen!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62040 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFix operator precedence.
Sebastian Redl [Sun, 11 Jan 2009 13:39:06 +0000 (13:39 +0000)]
Fix operator precedence.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62038 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoConvert property implementation to DeclContext::addDecl().
Steve Naroff [Sun, 11 Jan 2009 12:47:58 +0000 (12:47 +0000)]
Convert property implementation to DeclContext::addDecl().
This completes the ObjCContainerDecl AST cleanup (for now).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62037 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoA few property related cleanups to ObjCContainerDecl AST.
Steve Naroff [Sun, 11 Jan 2009 01:06:09 +0000 (01:06 +0000)]
A few property related cleanups to ObjCContainerDecl AST.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62034 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoConvert some more actions to smart pointers.
Sebastian Redl [Sun, 11 Jan 2009 00:38:46 +0000 (00:38 +0000)]
Convert some more actions to smart pointers.
No performance regression in my basic test.
Also fixed a type error in ActOnFinishSwitchStmt's arguments (body is a stmt).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62032 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFix a misleading comment.
Steve Naroff [Sat, 10 Jan 2009 22:55:25 +0000 (22:55 +0000)]
Fix a misleading comment.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62031 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoThis patch fixes the code gen failures which was a fallout from
Fariborz Jahanian [Sat, 10 Jan 2009 21:06:09 +0000 (21:06 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62030 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoExplicit declaration of property setters over-ride
Fariborz Jahanian [Sat, 10 Jan 2009 18:43:55 +0000 (18:43 +0000)]
Explicit declaration of property setters over-ride
prohibition of 'readonly' properties in an assignment.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62028 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoadd a bunch of castToDeclContext/castFromDeclContext methods.
Zhongxing Xu [Sat, 10 Jan 2009 14:38:38 +0000 (14:38 +0000)]
add a bunch of castToDeclContext/castFromDeclContext methods.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62027 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoadd castToDeclContext/castFromDeclContext methods to RecordDecl.
Zhongxing Xu [Sat, 10 Jan 2009 14:14:16 +0000 (14:14 +0000)]
add castToDeclContext/castFromDeclContext methods to RecordDecl.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62026 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoccc: Introduce ToolChains for mapping Actions to Tools which can
Daniel Dunbar [Sat, 10 Jan 2009 02:07:54 +0000 (02:07 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62021 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoccc: Add generic assembler & linker tools which effectively shell out
Daniel Dunbar [Sat, 10 Jan 2009 02:00:04 +0000 (02:00 +0000)]
ccc: Add generic assembler & linker tools which effectively shell out
to gcc.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62020 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoccc: Add information about whether type can be user specified (a -x
Daniel Dunbar [Sat, 10 Jan 2009 01:50:42 +0000 (01:50 +0000)]
ccc: Add information about whether type can be user specified (a -x
argument) to InputType.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62019 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAllow multiple Microsoft calling-convention keywords. Fixes rdar://problem/6486133
Douglas Gregor [Sat, 10 Jan 2009 00:48:18 +0000 (00:48 +0000)]
Allow multiple Microsoft calling-convention keywords. Fixes rdar://problem/6486133

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62018 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoassert if attempting to code gen. a property setter/getter
Fariborz Jahanian [Sat, 10 Jan 2009 00:13:01 +0000 (00:13 +0000)]
assert if attempting to code gen. a property setter/getter
coming from a protocol.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62017 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoDon't bother setting NextDeclarator for EnumConstantDecls. It isn't used
Douglas Gregor [Fri, 9 Jan 2009 23:23:35 +0000 (23:23 +0000)]
Don't bother setting NextDeclarator for EnumConstantDecls. It isn't used

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62016 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoWhen we see a reference to a struct, class, or union like "struct X"
Douglas Gregor [Fri, 9 Jan 2009 22:42:13 +0000 (22:42 +0000)]
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>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62014 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdd utils/SummarizeErrors.
Daniel Dunbar [Fri, 9 Jan 2009 22:39:43 +0000 (22:39 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62013 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdd some comments to the virtual work. Thanks to Doug Gregor for the review.
Sebastian Redl [Fri, 9 Jan 2009 22:29:03 +0000 (22:29 +0000)]
Add some comments to the virtual work. Thanks to Doug Gregor for the review.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62012 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoccc: Get host information via Driver methods.
Daniel Dunbar [Fri, 9 Jan 2009 22:21:24 +0000 (22:21 +0000)]
ccc: Get host information via Driver methods.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62011 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoDead stores checker: Don't flag dead stores for self-assignments (common escape hatch...
Ted Kremenek [Fri, 9 Jan 2009 22:15:01 +0000 (22:15 +0000)]
Dead stores checker: Don't flag dead stores for self-assignments (common escape hatch for 'unused variable' warnings).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62010 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoEnhance PTH 'getSpelling' caching:
Ted Kremenek [Fri, 9 Jan 2009 22:05:30 +0000 (22:05 +0000)]
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).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62009 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoPrevent a segfault for vaarg expressions on unsupported architectures.
Sebastian Redl [Fri, 9 Jan 2009 21:09:38 +0000 (21:09 +0000)]
Prevent a segfault for vaarg expressions on unsupported architectures.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62008 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoThis patch removes mergeProperties and does the property lookup
Fariborz Jahanian [Fri, 9 Jan 2009 21:04:52 +0000 (21:04 +0000)]
This patch removes mergeProperties and does the property lookup
in designated protocols lazily.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62007 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoImplement EmitUnsupportedRValue to generate an appropriately typed RValue.
Daniel Dunbar [Fri, 9 Jan 2009 20:09:28 +0000 (20:09 +0000)]
Implement EmitUnsupportedRValue to generate an appropriately typed RValue.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62004 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoVery basic support for pure virtual functions.
Sebastian Redl [Fri, 9 Jan 2009 19:57:06 +0000 (19:57 +0000)]
Very basic support for pure virtual functions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62003 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoReplace DeclContext's vector of ScopedDecl pointers with a linked list
Douglas Gregor [Fri, 9 Jan 2009 19:42:16 +0000 (19:42 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62001 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoMake sure that ScopedDecls passed to DeclContext::addDecl are added into their lexica...
Douglas Gregor [Fri, 9 Jan 2009 18:51:29 +0000 (18:51 +0000)]
Make sure that ScopedDecls passed to DeclContext::addDecl are added into their lexical context

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61998 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAlways print out SourceManager stats with 'Stats' is true. This revealed that PTH...
Ted Kremenek [Fri, 9 Jan 2009 18:20:21 +0000 (18:20 +0000)]
Always print out SourceManager stats with 'Stats' is true.  This revealed that PTH always pulls in the source pages with -fsyntax-only (investigating further).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61996 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoProvide a new kind of iterator, the specific_decl_iterator, that
Douglas Gregor [Fri, 9 Jan 2009 17:18:27 +0000 (17:18 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61994 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoEmit more refined "unsupported" error for block expressions.
Daniel Dunbar [Fri, 9 Jan 2009 17:04:29 +0000 (17:04 +0000)]
Emit more refined "unsupported" error for block expressions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61993 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoGive "unsupported" error on calls through block pointers instead of
Daniel Dunbar [Fri, 9 Jan 2009 16:50:52 +0000 (16:50 +0000)]
Give "unsupported" error on calls through block pointers instead of
crashes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61992 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoMove property API's up to ObjCContainerDecl (removing a lot of duplicate code).
Steve Naroff [Fri, 9 Jan 2009 15:36:25 +0000 (15:36 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61988 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFix rdar://6480479 - [parser] infinite loop on invalid input
Chris Lattner [Fri, 9 Jan 2009 04:34:13 +0000 (04:34 +0000)]
Fix rdar://6480479 - [parser] infinite loop on invalid input

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61975 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoConvert block types in IRgen. This is not the correct type, but
Daniel Dunbar [Fri, 9 Jan 2009 02:48:46 +0000 (02:48 +0000)]
Convert block types in IRgen. This is not the correct type, but
matches llvm-gcc (?).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61974 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoBlock pointer types are not aggregate types.
Daniel Dunbar [Fri, 9 Jan 2009 02:44:18 +0000 (02:44 +0000)]
Block pointer types are not aggregate types.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61973 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoDon't crash when our FunctionDecl has a non-identifier name
Douglas Gregor [Fri, 9 Jan 2009 01:47:02 +0000 (01:47 +0000)]
Don't crash when our FunctionDecl has a non-identifier name

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61970 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFix crash on null deference when searching for readwrite properties in
Daniel Dunbar [Fri, 9 Jan 2009 01:04:21 +0000 (01:04 +0000)]
Fix crash on null deference when searching for readwrite properties in
categories.
 - Also, simplify nesting via early return.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61968 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoccc: Start defining host information.
Daniel Dunbar [Fri, 9 Jan 2009 01:00:40 +0000 (01:00 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61967 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAddressed the issue in <rdar://problem/6479085>, where we failed to
Douglas Gregor [Fri, 9 Jan 2009 00:49:46 +0000 (00:49 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61966 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoRe-enable PTH testing for Cocoa.h and Carbon.h (and include testing for Objective...
Ted Kremenek [Fri, 9 Jan 2009 00:41:48 +0000 (00:41 +0000)]
Re-enable PTH testing for Cocoa.h and Carbon.h (and include testing for Objective-C++).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61965 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdding support for ObjC methods which have c-style
Fariborz Jahanian [Fri, 9 Jan 2009 00:38:19 +0000 (00:38 +0000)]
Adding support for ObjC methods which have c-style
parameter list. This is work in progress.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61964 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoEnable support for '-x objective-c++-header'.
Ted Kremenek [Fri, 9 Jan 2009 00:38:08 +0000 (00:38 +0000)]
Enable support for '-x objective-c++-header'.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61963 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoSimpler solution to LiteralSupport compatibility: just add one whitespace character...
Ted Kremenek [Fri, 9 Jan 2009 00:37:37 +0000 (00:37 +0000)]
Simpler solution to LiteralSupport compatibility: just add one whitespace character after each cached string.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61962 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoInvert assertion condition.
Ted Kremenek [Fri, 9 Jan 2009 00:36:11 +0000 (00:36 +0000)]
Invert assertion condition.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61961 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoTemporarily revert r61956 and r61957 (PTH tests failing).
Ted Kremenek [Fri, 9 Jan 2009 00:27:29 +0000 (00:27 +0000)]
Temporarily revert r61956 and r61957 (PTH tests failing).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61960 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoEnhance -fsyntax-only test of Carbon.h to also include testing for PTH.
Ted Kremenek [Thu, 8 Jan 2009 23:42:56 +0000 (23:42 +0000)]
Enhance -fsyntax-only test of Carbon.h to also include testing for PTH.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61958 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoEnhance -fsyntax-only test of Cocoa.h to also include testing for PTH.
Ted Kremenek [Thu, 8 Jan 2009 23:41:35 +0000 (23:41 +0000)]
Enhance -fsyntax-only test of Cocoa.h to also include testing for PTH.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61957 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoPTH: For the cached spellings of literals, store one whitespace character after the...
Ted Kremenek [Thu, 8 Jan 2009 23:40:50 +0000 (23:40 +0000)]
PTH: For the cached spellings of literals, store one whitespace character after the spelling to accomodate sanity checking in LiteralSuppoert.cpp.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61956 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdd mm_malloc.h, patch by Sam Weinig.
Anders Carlsson [Thu, 8 Jan 2009 23:30:09 +0000 (23:30 +0000)]
Add mm_malloc.h, patch by Sam Weinig.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61954 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoPlace warning about 'readonly' property attributes which
Fariborz Jahanian [Thu, 8 Jan 2009 23:23:10 +0000 (23:23 +0000)]
Place warning about 'readonly' property attributes which
are related to setter syntax under -Wreadonly-setter-attrs
to prevent warnings in projects built with gcc.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61953 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoRevert my previous, failed attempt to pretty-print anonymous struct/union accesses...
Douglas Gregor [Thu, 8 Jan 2009 22:45:41 +0000 (22:45 +0000)]
Revert my previous, failed attempt to pretty-print anonymous struct/union accesses well. Added a FIXME so we know to revisit this later

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61951 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFix ObjCInterfaceDecl::Destroy and ObjCProtocolDecl::Destroy to iterate and destroy...
Ted Kremenek [Thu, 8 Jan 2009 20:49:27 +0000 (20:49 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61943 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoRemove double-insertion of EnumConstantDecls. Thanks to Zhongxing Xu for pointing...
Douglas Gregor [Thu, 8 Jan 2009 20:48:26 +0000 (20:48 +0000)]
Remove double-insertion of EnumConstantDecls. Thanks to Zhongxing Xu for pointing this out

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61942 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdded iterator mechanism to ObjCContainerDecl to iterate over both class and instance...
Ted Kremenek [Thu, 8 Jan 2009 20:48:19 +0000 (20:48 +0000)]
Added iterator mechanism to ObjCContainerDecl to iterate over both class and instance methods at the same time.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61941 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoUnify the code for defining tags in C and C++, so that we always
Douglas Gregor [Thu, 8 Jan 2009 20:45:30 +0000 (20:45 +0000)]
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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61940 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdd missing castToDeclContext/castFromDeclContext hooks.
Steve Naroff [Thu, 8 Jan 2009 20:35:58 +0000 (20:35 +0000)]
Add missing castToDeclContext/castFromDeclContext hooks.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61939 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoRemove a dead decl.
Steve Naroff [Thu, 8 Jan 2009 20:22:04 +0000 (20:22 +0000)]
Remove a dead decl.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61938 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoMove FIXME to a better location.
Steve Naroff [Thu, 8 Jan 2009 20:17:34 +0000 (20:17 +0000)]
Move FIXME to a better location.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61937 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoRemoved ObjCContainerDecl::getPropertyMethods()...doesn't belong in the AST.
Steve Naroff [Thu, 8 Jan 2009 20:15:03 +0000 (20:15 +0000)]
Removed ObjCContainerDecl::getPropertyMethods()...doesn't belong in the AST.
Moved logic to Sema::ProcessPropertyDecl().

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61936 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoRemove redundant method context (now that ObjCMethodDecl isa ScopedDecl).
Steve Naroff [Thu, 8 Jan 2009 19:41:02 +0000 (19:41 +0000)]
Remove redundant method context (now that ObjCMethodDecl isa ScopedDecl).
Convert clients to use the standard getDeclContext() API.

Doug, thanks for the review!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61935 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoInitialized member variable 'Implicit' in Decl's ctor.
Ted Kremenek [Thu, 8 Jan 2009 18:54:40 +0000 (18:54 +0000)]
Initialized member variable 'Implicit' in Decl's ctor.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61930 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoThis is a large/messy diff that unifies the ObjC AST's with DeclContext.
Steve Naroff [Thu, 8 Jan 2009 17:28:14 +0000 (17:28 +0000)]
This is a large/messy diff that unifies the ObjC AST's with DeclContext.

- ObjCContainerDecl's (ObjCInterfaceDecl/ObjCCategoryDecl/ObjCProtocolDecl), ObjCCategoryImpl, & ObjCImplementation are all DeclContexts.
- ObjCMethodDecl is now a ScopedDecl (so it can play nicely with DeclContext).
- ObjCContainerDecl now does iteration/lookup using DeclContext infrastructure (no more linear search:-)
- Removed ASTContext argument to DeclContext::lookup(). It wasn't being used and complicated it's use from an ObjC AST perspective.
- Added Sema::ProcessPropertyDecl() and removed Sema::diagnosePropertySetterGetterMismatch().
- Simplified Sema::ActOnAtEnd() considerably. Still more work to do.
- Fixed an incorrect casting assumption in Sema::getCurFunctionOrMethodDecl(), now that ObjCMethodDecl is a ScopedDecl.
- Removed addPropertyMethods from ObjCInterfaceDecl/ObjCCategoryDecl/ObjCProtocolDecl.

This passes all the tests on my machine. Since many of the changes are central to the way ObjC finds it's methods, I expect some fallout (and there are still a handful of FIXME's). Nevertheless, this should be a step in the right direction.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61929 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdd isSubRegionOf() method to SubRegion.
Zhongxing Xu [Thu, 8 Jan 2009 13:17:14 +0000 (13:17 +0000)]
Add isSubRegionOf() method to SubRegion.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61924 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFix comment because we could have arbitrary number of overloaded functions with
Zhongxing Xu [Thu, 8 Jan 2009 07:37:03 +0000 (07:37 +0000)]
Fix comment because we could have arbitrary number of overloaded functions with
the same name.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61920 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoPTH: Hook up getSpelling() caching in PTHLexer. This results in a nice
Ted Kremenek [Thu, 8 Jan 2009 04:30:32 +0000 (04:30 +0000)]
PTH: Hook up getSpelling() caching in PTHLexer. This results in a nice
performance gain. Here's what we see for -Eonly on Cocoa.h (using PTH):

- wall time decreases by 21% (26% speedup overall)
- system time decreases by 35%
- user time decreases by 6%

These reductions are due to not paging source files just to get spellings for
literals. The solution in place doesn't appear to be 100% yet, as we still see
some of the pages for source files getting mapped in. Using -print-stats, we see
that SourceManager maps in 7179K less bytes of source text (reduction of 75%).
Will investigate why the remaining 25% are getting paged in.

With these changes, here's how PTH compares to non-PTH on Cocoa.h:
  -Eonly: PTH takes 64% of the time as non-PTH (54% speedup)
  -fsyntax-only: PTH takes 89% of the time as non-PTH (11% speedup)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61913 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoPTH:
Ted Kremenek [Thu, 8 Jan 2009 02:47:16 +0000 (02:47 +0000)]
PTH:
- Added stub PTHLexer::getSpelling() that will be used for fetching cached
  spellings from the PTH file.  This doesn't do anything yet.
- Added a hook in Preprocessor::getSpelling() to call PTHLexer::getSpelling()
  when using a PTHLexer.
- Updated PTHLexer to read the offsets of spelling tables in the PTH file.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61911 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoRemove debugging variable I forgot to remove in my last commit.
Ted Kremenek [Thu, 8 Jan 2009 02:44:52 +0000 (02:44 +0000)]
Remove debugging variable I forgot to remove in my last commit.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61910 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoCache the "spellings" of string, character, and numeric literals in the PTH
Ted Kremenek [Thu, 8 Jan 2009 02:44:06 +0000 (02:44 +0000)]
Cache the "spellings" of string, character, and numeric literals in the PTH
file. For Cocoa.h, this enlarges the PTH file by 310K (4%).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61909 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoRefactor CacheTokens to use a PTHWriter class that creates and manages most of the...
Ted Kremenek [Thu, 8 Jan 2009 01:17:37 +0000 (01:17 +0000)]
Refactor CacheTokens to use a PTHWriter class that creates and manages most of the PTH generation data structures.  No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61902 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoObjc's compatibility-alias semantics and code
Fariborz Jahanian [Thu, 8 Jan 2009 01:10:55 +0000 (01:10 +0000)]
Objc's compatibility-alias semantics and code
gen issue fix.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61901 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoUpdate some doxygen comments to be more rich. Remove StoreManager::GetRegionSVal.
Ted Kremenek [Wed, 7 Jan 2009 22:56:17 +0000 (22:56 +0000)]
Update some doxygen comments to be more rich.  Remove StoreManager::GetRegionSVal.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61894 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoRefactor MemRegionManager instance variable into parent class. No functionality...
Ted Kremenek [Wed, 7 Jan 2009 22:18:50 +0000 (22:18 +0000)]
Refactor MemRegionManager instance variable into parent class.  No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61888 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFix PR clang/3291
Douglas Gregor [Wed, 7 Jan 2009 21:36:02 +0000 (21:36 +0000)]
Fix PR clang/3291

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61886 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFix printing of member references to avoid displaying implicitly-generated member...
Douglas Gregor [Wed, 7 Jan 2009 21:26:07 +0000 (21:26 +0000)]
Fix printing of member references to avoid displaying implicitly-generated member references, e.g., for anonymous struct/unions or implicit 'this' in member functions

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61885 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoDon't ICE when messaging on 'super' receiver when class
Fariborz Jahanian [Wed, 7 Jan 2009 21:01:41 +0000 (21:01 +0000)]
Don't ICE when messaging on 'super' receiver when class
of category implementation is undeclared. Issue error instead.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61882 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAnother nasty code gen. bug with trivial fix. Calling class
Fariborz Jahanian [Wed, 7 Jan 2009 20:11:22 +0000 (20:11 +0000)]
Another nasty code gen. bug with trivial fix. Calling class
method on 'super' receiver in a category implementation.
Other simpler cases were working by accident.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61880 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFinished semantic analysis of anonymous unions in C++.
Douglas Gregor [Wed, 7 Jan 2009 19:46:03 +0000 (19:46 +0000)]
Finished semantic analysis of anonymous unions in C++.

Duplicate-member checking within classes is still a little messy, and
anonymous unions are still completely broken in C. We'll need to unify
the handling of fields in C and C++ to make this code applicable in
both languages.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61878 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoccc: Make proper synthetic arguments in places we have to construct
Daniel Dunbar [Wed, 7 Jan 2009 18:54:26 +0000 (18:54 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61871 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoccc: Change Command to take list of strings for argv instead of Arg
Daniel Dunbar [Wed, 7 Jan 2009 18:40:45 +0000 (18:40 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61869 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoObjC AST cleanups/simplifications (phase 1).
Steve Naroff [Wed, 7 Jan 2009 17:57:40 +0000 (17:57 +0000)]
ObjC AST cleanups/simplifications (phase 1).
Add ObjCContainerDecl class and have ObjCInterfaceDecl/ObjCCategoryDecl/ObjCProtocolDecl inherit from it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61866 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoUse DeclContext::getLookupContext wherever necessary to ensure that we look through...
Douglas Gregor [Wed, 7 Jan 2009 16:34:42 +0000 (16:34 +0000)]
Use DeclContext::getLookupContext wherever necessary to ensure that we look through transparent contexts

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61861 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoTest case for anonymous unions in C++
Douglas Gregor [Wed, 7 Jan 2009 16:22:09 +0000 (16:22 +0000)]
Test case for anonymous unions in C++

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61860 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoWhen determining whether a variable is a file-scoped variable, check
Douglas Gregor [Wed, 7 Jan 2009 02:48:43 +0000 (02:48 +0000)]
When determining whether a variable is a file-scoped variable, check
out its lookup context (to see through linkage
specifications). Addresses <rdar://problem/6477142>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61848 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoccc: Extend ArgList to support indexing into a synthetic arg array
Daniel Dunbar [Wed, 7 Jan 2009 01:57:39 +0000 (01:57 +0000)]
ccc: Extend ArgList to support indexing into a synthetic arg array
(for killing off DerivedArg).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61846 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoccc: Refactor so that all accesses to actual input strings go through
Daniel Dunbar [Wed, 7 Jan 2009 01:29:28 +0000 (01:29 +0000)]
ccc: Refactor so that all accesses to actual input strings go through
the ArgList.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61844 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoUpdate checker build.
Ted Kremenek [Wed, 7 Jan 2009 01:10:24 +0000 (01:10 +0000)]
Update checker build.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61843 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoInitial implementation of anonymous unions (and, as a GNU extension,
Douglas Gregor [Wed, 7 Jan 2009 00:43:41 +0000 (00:43 +0000)]
Initial implementation of anonymous unions (and, as a GNU extension,
structures and classes) in C++. Covers name lookup and the synthesis
and member access for the unnamed objects/fields associated with
anonymous unions.

Some C++ semantic checks are still missing (anonymous unions can't
have function members, static data members, etc.), and there is no
support for anonymous structs or unions in C.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61840 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoThis commit reflects changes to the retain/release checker motivated by my
Ted Kremenek [Wed, 7 Jan 2009 00:39:56 +0000 (00:39 +0000)]
This commit reflects changes to the retain/release checker motivated by my
recent discussions with Thomas Clement and Ken Ferry concerning the "fundamental
rule" for Cocoa memory management
(http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/Tasks/MemoryManagementRules.html).

Here is the revised behavior of the checker concerning tracking retain/release
counts for objects returned from message expressions involving instance methods:

1) Track the returned object if the return type of the message expression is
id<..>, id, or a pointer to *any* object that subclasses NSObject. Such objects
are assumed to have a retain count. Previously the checker only tracked objects
when the receiver of the message expression was part of the standard Cocoa API
(i.e., had class names prefixed with 'NS'). This should significantly expand the
amount of checking performed.

2) Consider the object owned if the selector of the message expression contains
"alloc", "new", or "copy". Previously we also considered "create", but this
doesn't follow from the fundamental rule (discussions with the Cocoa folks
confirms this).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61837 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoccc (old): Pass -arch through to assembler if given.
Daniel Dunbar [Wed, 7 Jan 2009 00:03:20 +0000 (00:03 +0000)]
ccc (old): Pass -arch through to assembler if given.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61833 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAllow Objective-C entities to be declared within a transparent context
Douglas Gregor [Tue, 6 Jan 2009 23:51:29 +0000 (23:51 +0000)]
Allow Objective-C entities to be declared within a transparent context
nested in the translation unit. This fixes <rdar://problem/6476070>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61832 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoSourceManager: Implement "lazy" creation of MemBuffers for source files.
Ted Kremenek [Tue, 6 Jan 2009 22:43:04 +0000 (22:43 +0000)]
SourceManager: Implement "lazy" creation of MemBuffers for source files.

- Big Idea:
   Source files are now mmaped when ContentCache::getBuffer() is first called.
   While this doesn't change the functionality when lexing regular source files,
   it can result in source files not being paged in when using PTH.

- Performance change:
  - No observable difference (-fsyntax-only/-Eonly) on Cocoa.h when doing
    regular source lexing.
  - No observable time difference (-fsyntax-only/-Eonly) on Cocoa.h when using
    PTH. We do observe, however, a reduction of 279K in memory mapped source
    code (3% reduction). The majority of pages from Cocoa.h (and friends) are
    still being pulled in, however, because any literal will cause
    Preprocessor::getSpelling() to be called (causing the source for the file to
    get pulled in). The next possible optimization is to cache literal strings
    in the PTH file to avoid the need for the original header sources entirely.

- Right now there is a preprocessor directive to toggle between "lazy" and
  "eager" creation of MemBuffers. This is not permanent, and is there in the
  short term to just test additional optimizations.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61827 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoRemove redunant (and incorrect) call to SourceManager::PrintStats(). This would...
Ted Kremenek [Tue, 6 Jan 2009 22:16:26 +0000 (22:16 +0000)]
Remove redunant (and incorrect) call to SourceManager::PrintStats().  This would be called after a SourceManager was 'cleared', so it printed bogus results.  Moreover, these stats are already printed earlier in the code path.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61825 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAnother tweak to handle the MS extensions (<rdar://problem/5956221>).
Steve Naroff [Tue, 6 Jan 2009 19:34:12 +0000 (19:34 +0000)]
Another tweak to handle the MS extensions (<rdar://problem/5956221>).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61821 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoAdd whitespace to silence the following warning in a Release build: warning: suggest...
Ted Kremenek [Tue, 6 Jan 2009 19:17:58 +0000 (19:17 +0000)]
Add whitespace to silence the following warning in a Release build: warning: suggest a space before ';' or explicit braces around empty body in 'while' statement

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61820 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoReturn UnknownVal in RegionStoreManager::getSizeInElements() for unsupported regions...
Ted Kremenek [Tue, 6 Jan 2009 19:12:06 +0000 (19:12 +0000)]
Return UnknownVal in RegionStoreManager::getSizeInElements() for unsupported regions.  This silences a warning when compiling Release-Asserts builds.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61818 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoCouple of code gen. fixes in ObjC's colection-statement. Hard
Fariborz Jahanian [Tue, 6 Jan 2009 18:56:31 +0000 (18:56 +0000)]
Couple of code gen. fixes in ObjC's colection-statement. Hard
to track down, easy to fix. This is on going.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61817 91177308-0d34-0410-b5e6-96231b3b80d8

16 years agoFix <rdar://problem/5956221> clang ObjC rewriter: Microsoft-specific __fastcall keywo...
Steve Naroff [Tue, 6 Jan 2009 17:40:00 +0000 (17:40 +0000)]
Fix <rdar://problem/5956221> clang ObjC rewriter: Microsoft-specific __fastcall keyword unrecognized.

This fix is C++ specific.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61816 91177308-0d34-0410-b5e6-96231b3b80d8