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.
Steve Naroff [Thu, 21 Aug 2008 13:03:03 +0000 (13:03 +0000)]
RewriteObjC::RewriteObjCSynchronizedStmt(): Make sure the sync expr is cast to "id".
This fixes <rdar://problem/6163088> clang ObjC rewriter: @synchronized ([foo class]) {} does not cast properly.
Daniel Dunbar [Thu, 21 Aug 2008 04:36:09 +0000 (04:36 +0000)]
Preliminary support for Obj-C classes in NeXT runtime.
- Functional for simple cases but there are some glaring omissions
(protocols, properties, and other language extensions).
- The code needs a fair bit of cleaning.
Daniel Dunbar [Thu, 21 Aug 2008 03:03:44 +0000 (03:03 +0000)]
Reorder the PATH used during testing so $(ToolDir) and the LLVM
scripts dir appear before the user path.
- This is an attempt to pick up the right executables. We should
probably be substituting the exact things we want for clang a la
the LLVM test script.
Daniel Dunbar [Thu, 21 Aug 2008 02:51:29 +0000 (02:51 +0000)]
Update a number of CodeGen tests to not create .ll files in the test
directory.
- Removed .ll from the svn:ignore lists to try and prevent this.
- Added svn:ignore on test/Misc/Output
Eli Friedman [Thu, 21 Aug 2008 01:40:19 +0000 (01:40 +0000)]
Initial implementation of Windows x86 target; at the moment, the only
difference from generic x86 is the defines. The rest is non-trivial to
implement.
I'm not planning on adding any more targets myself; if there are any
targets anyone is currently using that are missing, feel free to add
them, or ask me to add them.
This concludes the work I'm planning for the TargetInfo
implementations at the moment; all the other issues with TargetInfo require
some API changes, and I haven't really thought it through. Some of the
remaining issues: allowing targets to define size_t and wchar_t properly,
adding some sort of __builtin_type_info intrinsic so we can finish clang's
limits.h and float.h and get rid of a massive number of macro
definitions, allowing target-specific command-line options, allowing
target-specific defaults for certain command-line options like
-fms-extensions, exposing vector alignment outside of the description
string, exposing endianness outside of the description string, allowing
targets to expose special bit-field layout requirements, exposing some
sort of custom hook for call generation in CodeGen, and adding CPU
selection to control defines like __SSE__.
Eli Friedman [Thu, 21 Aug 2008 00:13:15 +0000 (00:13 +0000)]
First cut at OS detection, taking advantage of the new generic targets.
This approach allows adding OS-specific targets/defines/etc. without
completely breaking unknown subtargets. No new subtargets yet, although
I plan to add x86-Linux soon. Others can add targets that they use as
needed; adding a new subtarget takes very little code.
Also does some fixups for description strings; a lot of them were
unspecified. I think all the ones I added are correct, but
they're unverified; corrections are welcome.
Eli Friedman [Wed, 20 Aug 2008 07:28:14 +0000 (07:28 +0000)]
Class hierarchy reorg for Sparc architecture. While I was there, I
cleaned it up a bit, including fixing the definition of va_list; this
shouldn't break anything, but anyone using Sparc should watch for
regressions.
Daniel Dunbar [Wed, 20 Aug 2008 03:55:42 +0000 (03:55 +0000)]
Fix subtle bug introduced in r54852.
- UsualUnaryConversions takes an Expr *& and may modify its argument,
this broke when it was refactored into Sema::CheckCastTypes. This
meant that we were missing implicit casts in some places.
- Seems pretty sad that this got through our tests.
Ted Kremenek [Wed, 20 Aug 2008 03:26:33 +0000 (03:26 +0000)]
Added ObjCAtDefsFieldDecl to represent FieldDecls created by @defs.
This fixes an ownership issue where FieldDecls could be owned both by an ObjCInterfaceDecl and a RecordDecl.
Eli Friedman [Wed, 20 Aug 2008 02:34:37 +0000 (02:34 +0000)]
Reorganize the class hierarchy for x86 targets; shouldn't have any
visible effects, but this will significantly reduce the amount of
boilerplate code necessary to add subtargets.
If this looks okay, I'll do the rest of the processors (PPC, Sparc, ARM)
soon.
Daniel Dunbar [Wed, 20 Aug 2008 00:28:19 +0000 (00:28 +0000)]
Move all Obj-C runtime interaction into CodeGenFunction.
- Drop duplicate (and broken) code for sending messages.
- Add EmitObjCProtocolExpr to CodeGenFunction.
Eli Friedman [Wed, 20 Aug 2008 00:02:01 +0000 (00:02 +0000)]
Get rid of the bogus -depth +0 argument; I really have no clue what the
heck it does on Darwin, but it's not part of POSIX, and the GNU version
of find errors out on it.
On a side note, there are a couple of new failures due to tests
including OS X specific headers.
Ted Kremenek [Tue, 19 Aug 2008 16:51:45 +0000 (16:51 +0000)]
Patch by Zhongxing Xu!
This patch extends BasicStoreManager::getInitialStore() to include code that symbolicates input variables.
It also removes redundant handling of ImplicitParamDecl, since it is a subclass of VarDecl.
Steve Naroff [Tue, 19 Aug 2008 13:04:19 +0000 (13:04 +0000)]
Fix crasher in RewriteObjC::RewriteObjCSynchronizedStmt(). Can't depend on the source locations of the sync expression (since it may have been rewritten.
Fixes <rdar://problem/6156363> clang ObjC rewriter: rewriting attached file causes assertion failure: invalid FileID