Ted Kremenek [Mon, 12 Jan 2009 21:45:02 +0000 (21:45 +0000)]
retain/release checker:
- Refactor a bunch of logic in the retain/release checker, making it more
condense and easier to read.
- Add support for "Create" methods in the DiskArbitration framework
retain/release tests:
- Rename CFDate.m to retain-release.m, and move test from CFString.c to
retain-release.m
- Add DiskArbitration framework tests cases.
- Add/refine and few more retain/release GC test cases.
Patch to supprt case of readonly property being
assigned to when it has user declared setter method
defined in the class implementation (but no declaration in
the class itself).
There is still some work to do in Objective-C++, but this requires
that each of the Objective-C entities (interfaces, implementations,
etc.) to be introduced into the context stack with
PushDeclContext/PopDeclContext. This will be a separate fix, later.
Nuno Lopes [Sun, 11 Jan 2009 23:22:37 +0000 (23:22 +0000)]
make ScalarExprEmitter::EmitCompare() emit the expression with the correct type instead of always zext it to an int
this fixes codegen of simple exprs in C++ like 'if (x != 0)'
Daniel Dunbar [Sun, 11 Jan 2009 23:13:15 +0000 (23:13 +0000)]
ccc: Add fairly complete argument translation for Darwin link step.
- Some things are still hardcoded, and macosx-version-min comparison
isn't implemented, but otherwise this very closely matches gcc.
- The one exception is that arguments (like -framework or -Wl,) which are
treated as linker inputs instead of options are not being
forwarded yet.
Chris Lattner [Sun, 11 Jan 2009 19:48:19 +0000 (19:48 +0000)]
make paste avoidance avoid pasting digraphs and :: only when digraphs or c++ is enabled
respectively. Inspired by a patch by Dan Villiom Podlaski Christiansen.
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."
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).
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.
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.
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.
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.
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).
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.
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).
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.
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.
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).
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.
Place warning about 'readonly' property attributes which
are related to setter syntax under -Wreadonly-setter-attrs
to prevent warnings in projects built with gcc.
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.
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
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.
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)
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.