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.
Daniel Dunbar [Tue, 26 Aug 2008 08:29:31 +0000 (08:29 +0000)]
Objective-C @synthesize support.
- Only supports simple assignment and atomic semantics are ignored.
- Not quite usable yet because the methods do not actually get added
to the class metadata.
- Added ObjCPropertyDecl::getSetterKind (one of Assign, Copy, Retain).
- Rearrange CodeGenFunction so synthesis can reuse function prolog /
epilog code.
Daniel Dunbar [Tue, 26 Aug 2008 02:32:45 +0000 (02:32 +0000)]
Synthesize property setter method as we do for getter.
- Also, fix Parser to construct proper SetterName selector (should be
lifted out of parser though).
Daniel Dunbar [Tue, 26 Aug 2008 00:41:39 +0000 (00:41 +0000)]
In incompatible pointer-typed ?: expressions, add implicit conversion
of RHSs to id type instead of void* if either has Objective-C object
type.
- This ensures the result can still be used in normal places an
object can be used, like a message send.
Add implicit conversions for ?: applied to qualified id types to
ensure that the RHSs are compatible.
- This prevents a codegen crash (creating invalid PHI nodes).
- Again, this relates to the fact that qualified id types have no
canonical types.
- Note that the implicit type casted to is incorrect, however this
doesn't currently cause problems because of the flexibility of the
id type.
Eli Friedman [Mon, 25 Aug 2008 21:31:01 +0000 (21:31 +0000)]
Do typechecking and codegen for K&R-style function declarations
correctly. Not a regression, but made more obvious by my recent fix
which made function type compatibility checking a bit more strict.
Eli Friedman [Mon, 25 Aug 2008 20:46:57 +0000 (20:46 +0000)]
Fix for PR2720; be a little bit more permissive in initializers for
casting pointers to integers.
Eventually, we should check whether we can evaluate an expression
using Expr::tryEvaluate, and this codepath should be tightened to only
handle standard-compliant cases.
Daniel Dunbar [Mon, 25 Aug 2008 20:45:57 +0000 (20:45 +0000)]
Support __PRETTY_FUNCTION__ and friends in Obj-C methods.
Add CodeGenFunction::EmitUnsupportedLValue
- Gives error and returns undef value.
Swap some asserts() over to using EmitUnsupportedLValue
- Rumor has it users (and even some developers) prefer carat
diagnostics to backtraces.
- Works better in Release-Asserts to boot.
Ted Kremenek [Mon, 25 Aug 2008 20:45:07 +0000 (20:45 +0000)]
Use path information from .info files when computing common prefix information.
This partially implements PR 2705: http://llvm.org/bugs/show_bug.cgi?id=2705
Ted Kremenek [Mon, 25 Aug 2008 20:10:45 +0000 (20:10 +0000)]
ccc-analyzer now correctly reports the exit code from 'cc'.
scan-build now correctly reports the exit code from the build command. Fixes: <rdar://problem/6172224>
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55324 91177308-0d34-0410-b5e6-96231b3b80d8