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
Daniel Dunbar [Mon, 25 Aug 2008 09:51:32 +0000 (09:51 +0000)]
Do is-a-pointer checks in terms of LLVM types in
EmitScalarConversion().
- Important for allowing Obj-C void * to id<X> casts and so on.
- Not sure about this fix however, perhaps Type should understand
that id is effectively a pointer type.
Daniel Dunbar [Mon, 25 Aug 2008 08:19:24 +0000 (08:19 +0000)]
Fix Obj-C super sends inside class methods.
- NeXT loads the super class at runtime; this required changing the
runtime interface to pass more information down.
Daniel Dunbar [Mon, 25 Aug 2008 06:02:07 +0000 (06:02 +0000)]
NeXT: Emit symbols used to manage linking of Obj-C classes.
- This ensures that references to undefined classes cause link
errors.
- NOTE: This relies on platform specific asm directives currently,
this should be factored out.
Also, don't emit a SYMBOLS metadata entry if there are no symbols.
Chris Lattner [Sat, 23 Aug 2008 22:23:37 +0000 (22:23 +0000)]
adjust to changes in various APIs from LLVM. We can't print
an APInt directly to an ostream now, so add some hacks. It would
be better to switch all of the bugreport (and friends) stuff over
to raw_ostream.
Daniel Dunbar [Sat, 23 Aug 2008 22:15:15 +0000 (22:15 +0000)]
Update ccc driver
- Use CCC_ECHO to control echoing behavior (default is on, set to ''
or unset to disable)
- Get 'clang','llc','as','cc','ld' executables from environment. 'cc'
and 'ld' are fetched through CCC_CC and CCC_LD respectively -- to
support make CC=ccc -- the others are through their upcased
versions.
- Add CCC_NATIVE mode.
o This uses llc and as to generate native object files; allowing
more drop-in replacement of gcc.
o Disabled by default, but should eventually be default.
o Allow --emit-llvm in CCC_NATIVE mode to override. Essentially
this makes ccc more like a drop in replacement for llvm-gcc.
- Prevent explicit -x <language> options from annoying clang.
Update several places to emit more precise ErrorUnsupported warnings
for currently unimplemented Obj-C features (main missing chunks are
property references, Obj-C exception handling, and the for ... in
syntax).
Daniel Dunbar [Sat, 23 Aug 2008 08:43:39 +0000 (08:43 +0000)]
Add TargetInfo::useNeXTRuntimeAsDefault
- Used to autoselect runtime when neither -fnext-runtime nor
-fgnu-runtime is specified.
- Default impl is false, all darwin targets set it to true.
Daniel Dunbar [Sat, 23 Aug 2008 03:46:30 +0000 (03:46 +0000)]
Trim CGObjCRuntime::GenerateMessageSend[Super]
- Returns an RValue.
- Reduced to only taking the CodeGenFunction, Expr, and Receiver.
- Becomes responsible for emitting the arguments.
Add CodeGenFunction::EmitCallExprExt
- Takes optional extra arguments to insert at the head of the call.
- This allows the Obj-C runtimes to call into this and isolates the
argument and call instruction generation code to one place. Upshot
is that we now pass structures (more) correctly.
Also, fix one aspect of generating methods which take structure
arguments (for NeXT). This probably needs to be merged with the
SetFunctionAttributes code in CodeGenModule.cpp
Chris Lattner [Sat, 23 Aug 2008 01:48:03 +0000 (01:48 +0000)]
Fix a FIXME by not creating an invalid AST on erroneous input. Also
make diagnostic output in some other malformed cases significantly
more useful. This fixes PR2708
Add support for C++'s "type-specifier ( expression-list )" expression:
-The Parser calls a new "ActOnCXXTypeConstructExpr" action.
-Sema, depending on the type and expressions number:
-If the type is a class, it will treat it as a class constructor. [TODO]
-If there's only one expression (i.e. "int(0.5)" ), creates a new "CXXFunctionalCastExpr" Expr node
-If there are no expressions (i.e "int()" ), creates a new "CXXZeroInitValueExpr" Expr node.
Eli Friedman [Fri, 22 Aug 2008 00:56:42 +0000 (00:56 +0000)]
Rewrite type compatibility testing to do type merging rather than just
testing compatibility. This is necessary for some constructs, like merging
redeclarations.
Also, there are some ObjC changes to make sure that
typesAreCompatible(a,b) == typesAreCompatible(b,a). I don't have any
ObjC code beyond the testsuite, so please tell me if there are any cases
where this doesn't behave as expected.
Eli Friedman [Fri, 22 Aug 2008 00:06:13 +0000 (00:06 +0000)]
Initial implementation of floats in Expr::tryEvaluate; this doesn't
implement some things, like unary operators and casts, but it's enough
to fix PR2703 as filed.