Daniel Dunbar [Wed, 3 Sep 2008 17:53:25 +0000 (17:53 +0000)]
Improve type-checking of ?: for Objective-C types.
- Allow any Objective-C object types to devolve to type id in a ?:
expression. This matches gcc behavior more closely.
Store: (static analyzer)
- Change definition of store::Region and store::Binding (once again) to make
them real classes that just wrap pointers. This makes them more strictly
typed, and allows specific implementations of Regions/Bindings to just
subclass them.
- minor renamings to RegionExtent and its subclasses
- added a bunch of doxygen comments
StoreManager: (static analyzer)
- added 'iterBindings', an iteration method for iterating over the bindings of a
store. It that takes a callback object (acting like a poor man's closure).
- added 'getRVal' version for store::Binding. Will potentially phase the other
versions of GetRVal in StoreManager out.
- reimplemented 'getBindings' to be non-virtual and to use 'iterBindings'
BasicStoreManager: (static analyzer)
- implemented 'iterBindings' for BasicStoreManager
Daniel Dunbar [Wed, 3 Sep 2008 01:05:41 +0000 (01:05 +0000)]
Restore Objective-C dot-syntax access of methods.
- Now also searches for correct setter method.
- There are still some issues regarding validation of the setter
method and access of read-only properties.
RecordDecl:
- Remove method 'isForwardDecl'; this functionality is already provided by
'isDefinition()'
- Move method definitions to be co-located with other RecordDecl methods.
RecordDecl:
- Added method 'isForwardDeclaration', a predicate method that returns true
if a RecordDecl represents a forward declaration.
- Added method 'getDefinitionDecl', a query method that returns a pointer to
the RecordDecl that provides the actual definition of a struct/union.
CXXRecordDecl and RecordDecl:
- Change constructor and create methods to accept a CXXRecordDecl* (RecordDecl*)
instead of a ScopedDecl* for PrevDecl. This causes the type checking
to be more tight and doesn't break any code.
RecordDecl:
- Don't use the NextDeclarator field in ScopedDecl to represent the previous
declaration. This is a conflated use of the NextDeclarator field, which will
be removed anyway when DeclGroups are fully implemented.
- Instead, represent (a soon to be implemented) chain of RecordDecls using a
NextDecl field. The last RecordDecl in the chain is always the 'defining'
RecordDecl that owns the FieldDecls. The other RecordDecls in the chain
are forward declarations.
Steve Naroff [Tue, 2 Sep 2008 18:50:17 +0000 (18:50 +0000)]
- Implement __block.
- Replace FIXME in Preprocessor::HandleIdentifier() with a check that avoids diagnosing extension tokens that originate from macro definitions.
Eli Friedman [Tue, 2 Sep 2008 05:29:22 +0000 (05:29 +0000)]
Fix for PR2750; don't check for an 'e' in the trash after the token.
Note that this isn't really a complete fix; I think there are other
potential overrun situations. I don't really know what the best
systematic fix is, though.
Eli Friedman [Tue, 2 Sep 2008 05:19:23 +0000 (05:19 +0000)]
An extremely hacky version of transparent_union support; it isn't
anywhere near correct in terms of missing cases and missing
diagnostics, but it's good enough to handle the uses in the
Linux system headers, which are currently a constant pain for compiling
applications on Linux.
Eli Friedman [Tue, 2 Sep 2008 05:09:35 +0000 (05:09 +0000)]
Make sure to take the unqualified versions of the canonical types for
type-checking pointer subtraction; if the canonical types aren't used,
the qualifiers won't always get stripped off correctly.
Tidy up sema processing of attribute "nonull":
- warn about nonnull being applied to functions with no pointer arguments
- continue processing argument list in the attribute when we encounter a non-pointer parameter being marked as nonnull
- when no argument list is specified, only mark pointers as nonnull. This fixes PR 2732 and radar 6188814.
Daniel Dunbar [Sat, 30 Aug 2008 05:35:15 +0000 (05:35 +0000)]
Add Objective-C property setter support.
- Change Obj-C runtime message API, drop the ObjCMessageExpr arg in
favor of just result type and selector. Necessary so it can be
reused in situations where we don't want to cons up an
ObjCMessageExpr.
- Update aggregate binary assignment to know about special property
ref lvalues.
- Add CodeGenFunction::EmitCallArg overload which takes an already
emitted rvalue.
Add CodeGenFunction::StoreComplexIntoAddr.
Disabled logic in Sema for parsing Objective-C dot-syntax that
accesses methods. This code does not search in the correct order and
the AST node has no way of properly representing its results.
Updated StmtDumper to print a bit more information about
ObjCPropertyRefExprs.
Daniel Dunbar [Sat, 30 Aug 2008 03:02:31 +0000 (03:02 +0000)]
Refactor handling of calls:
- Added CodeGenFunction::EmitCall which just takes the callee, return
type, and a list of (Value*,QualType) pairs.
- Added CodeGenFunction::EmitCallArg which handles emitting code for
a call argument and turning it into an appropriate
(Value*,QualType) pair.
- Changed Objective-C runtime interface so that the actual emission
of arguments for message sends is (once again) done in the code to
emit a message send.
No intended functionality change, this is prep work for better ABI
support and for Objective-C property setter support.
Daniel Dunbar [Fri, 29 Aug 2008 21:03:27 +0000 (21:03 +0000)]
Improve ccc:
- Support environment variable CCC_LANGUAGES to control which
languages clang is invoked on. If unset clang is invoked for all
languages, otherwise CCC_LANGUAGES should be a comma separated list
of the languages (as accepted by -x) for which clang should be
invoked. Useful for only building C and Objective-C parts of a
project with clang, for example.
- Add environment variable CCC_FALLBACK. If set and non-empty then
ccc will try and compile using the regular compiler if compilation
with clang fails.
- A few other tweaks to add options, flush stdout, recognize .mm as
objective-c++, and infer languages for compile+link style
invocations.
Daniel Dunbar [Fri, 29 Aug 2008 08:11:39 +0000 (08:11 +0000)]
Add special "property reference" CodeGen::LValue type for emitting
Objective-C property references.
- This handles property references "more correctly" but setters still
don't work.
Ted Kremenek [Fri, 29 Aug 2008 00:47:32 +0000 (00:47 +0000)]
Added "getBindings" and "BindingAsString" to GRStateManager and StoreManager.
Migrated CFRefCount.cpp to use getBindings and BindingsAsString instead of
making assumptions about the Store (removed dependence on GRState::vb_iterator).
Ted Kremenek [Thu, 28 Aug 2008 23:31:31 +0000 (23:31 +0000)]
Make store "Regions" and "Bindings" more abstract instead of concrete variants.
Their precise semantics will be implemented by a specific StoreManager.
Use function pointer to create the StoreManager in GRStateManager. This matches how we create ConstraintsManager.
Steve Naroff [Thu, 28 Aug 2008 19:20:44 +0000 (19:20 +0000)]
Add parser/action support for block literal expressions.
Parser support for blocks is almost complete...just need to add support for the __block() storage class qualifier.
Daniel Dunbar [Wed, 27 Aug 2008 05:40:03 +0000 (05:40 +0000)]
Add synthesized property methods to protocols and categories in Sema.
- It is not clear that this is the right approach, but this is at
least consistent with how interfaces are handled.
- This means NeXT now emits the correct metadata for properties in
protocols.
- This currently introduces a spurious warning involving inherited
properties in protocols or categories; however, it also fixes some
situations where we were failing to emit a warning. I will scrub
this code tomorrow and fix this issue as well as number of other
missed warnings / error situations that appear to exist.