Anders Carlsson
f94cd1ffe6
Generate code for static variables that don't have initializers. Also, report an error if a static initializer is not constant.
...
llvm-svn: 43058
2007-10-17 00:52:43 +00:00
Steve Naroff
32e44c0032
Move type compatibility predicates from Type to ASTContext. In addition, the predicates are now instance methods (they were previously static class methods on Type).
...
This allowed me to fix the following hack from this weekend...
// FIXME: Devise a way to do this without using strcmp.
// Would like to say..."return getAsStructureType() == IdStructType;", but
// we don't have a pointer to ASTContext.
bool Type::isObjcIdType() const {
if (const RecordType *RT = getAsStructureType())
return !strcmp(RT->getDecl()->getName(), "objc_object");
return false;
}
...which is now...
bool isObjcIdType(QualType T) const {
return T->getAsStructureType() == IdStructType;
}
Side notes:
- I had to remove a convenience function from the TypesCompatibleExpr class.
int typesAreCompatible() const {return Type::typesAreCompatible(Type1,Type2);}
Which required a couple clients get a little more verbose...
- Result = TCE->typesAreCompatible();
+ Result = Ctx.typesAreCompatible(TCE->getArgType1(), TCE->getArgType2());
Overall, I think this change also makes sense for a couple reasons...
1) Since ASTContext vends types, it makes sense for the type compatibility API to be there.
2) This allows the type compatibility predeciates to refer to data not strictly present in the AST (which I have found problematic on several occasions).
llvm-svn: 43009
2007-10-15 20:41:53 +00:00
Anders Carlsson
7e13ab88a2
Add code generation and sema checking for __builtin_va_arg.
...
llvm-svn: 43006
2007-10-15 20:28:48 +00:00
Anders Carlsson
d5f857f2e5
Fix an incorrect assertion.
...
llvm-svn: 42951
2007-10-13 05:52:34 +00:00
Anders Carlsson
24ebce6fca
Generate code for va_start and va_end.
...
llvm-svn: 42939
2007-10-12 23:56:29 +00:00
Devang Patel
152f18f671
Recognize while(1) and avoid extra blocks.
...
llvm-svn: 42811
2007-10-09 20:51:27 +00:00
Devang Patel
c1380400d5
Recognize "do {} while (0)" idiom and avoid extra basic blocks.
...
llvm-svn: 42808
2007-10-09 20:33:39 +00:00
Devang Patel
7ad0c2f1f9
Use LLVMFoldingBuilder
...
llvm-svn: 42807
2007-10-09 19:49:58 +00:00
Devang Patel
eac5948348
Use const& for RHS.
...
Use copy for LHS, because it is incremented using ++ operator.
llvm-svn: 42792
2007-10-09 17:10:59 +00:00
Devang Patel
49a44f3b52
Fix comment. Describe what it is, instead of how it is used.
...
llvm-svn: 42791
2007-10-09 17:08:50 +00:00
Fariborz Jahanian
da6c012ee7
Added a new class for Interfaces qualified by protocol list.
...
Protocols are now sorted and made unique in the list.
Enhanced pretty printer for @interface (So, I can see the protocol list).
llvm-svn: 42776
2007-10-08 23:06:41 +00:00
Chris Lattner
ba9dddb01e
Rename FileVariable -> FileVar for consistency with its class name,
...
likewise block and param. Reorder the layout of the Decl kind enum
so that the inheritance tree is reflected in the ordering. This allows
trivial range comparisons to determine whether something is an instance
of some abstract class, making classof faster.
llvm-svn: 42772
2007-10-08 21:37:32 +00:00
Devang Patel
1166312e8b
Code gen case statement ranges.
...
llvm-svn: 42766
2007-10-08 20:57:48 +00:00
Chris Lattner
ef6b136781
move IdentifierTable.h from liblex to libbasic.
...
llvm-svn: 42730
2007-10-07 08:58:51 +00:00
Devang Patel
64a9ca7c58
Support case statement ranges.
...
llvm-svn: 42648
2007-10-05 20:54:07 +00:00
Devang Patel
da5d6bbc40
switch statement code gen.
...
llvm-svn: 42616
2007-10-04 23:45:31 +00:00
Devang Patel
8ec4f837fa
Do not codegen dummy block.
...
Dummy block is an empty block with no predecessors.
llvm-svn: 42451
2007-09-28 21:49:18 +00:00
Chris Lattner
2dd003e807
further apfloat'ize the front-end, allowing codegen to pass
...
APFloat straight through to LLVM now.
llvm-svn: 42236
2007-09-22 18:47:25 +00:00
Chris Lattner
793d10ca38
fix some warnings, patch by Justin Handville
...
llvm-svn: 42010
2007-09-16 19:23:47 +00:00
Steve Naroff
a23cc79654
Move Decl::NextDeclarator (w/ setters/getters) down to ScopedDecl/FieldDecl.
...
Decl is now svelte:-)
llvm-svn: 41935
2007-09-13 23:52:58 +00:00
Steve Naroff
9def2b15c1
Phase 2 of making the Decl class more lightweight...
...
Move Identifier/Loc instance variables (and associated getters/setters) down from Decl to ScopedDecl/FieldDecl.
Objc AST's can now inherit from Decl without getting instance variables and types that are C specific. For now, I am keeping NextDeclarator, since I believe it may be useful to ObjC. If not, it can be moved later.
llvm-svn: 41934
2007-09-13 21:41:19 +00:00
Chris Lattner
d3d8aca074
update to match llvm mainline api
...
llvm-svn: 41926
2007-09-13 06:19:18 +00:00
Chris Lattner
6fb276d433
adjust to a change in the LLVM APIs, this is still very hackish until
...
the front-end adopts APFloat though. This fixes test/CodeGen/mandel.c
llvm-svn: 41908
2007-09-13 01:26:11 +00:00
Chris Lattner
69de3f4af6
When dumping out errors about unsupported stuff, emit loc info.
...
llvm-svn: 41907
2007-09-13 01:17:29 +00:00
Hartmut Kaiser
ec7531c9f6
Fixed compilation on Windows.
...
Silenced a couple of warnings.
Added *.vcproj file for new clangAnalysis library.
Renamed Basic to clangBasic projects.
llvm-svn: 41767
2007-09-07 14:34:20 +00:00
Ted Kremenek
c81587d240
Updated calls to CreateGEP to new interface in LLVM mainline.
...
llvm-svn: 41704
2007-09-04 17:20:08 +00:00
Chris Lattner
fb2eb6941a
eliminate some VC++ warnings, patch contributed by Hartmut Kaiser
...
llvm-svn: 41692
2007-09-04 02:34:27 +00:00
Chris Lattner
49e3bfa8a4
add stmtexpr support for aggregates
...
llvm-svn: 41662
2007-08-31 22:54:14 +00:00
Chris Lattner
1c3ad19714
add support for complex stmtexpr's
...
llvm-svn: 41661
2007-08-31 22:51:38 +00:00
Chris Lattner
4647a21825
Generalize RValue to handle complex better, generalize EmitCompoundStmt to
...
support any sort of expr, add a new EmitAnyExpr routine.
llvm-svn: 41660
2007-08-31 22:49:20 +00:00
Chris Lattner
04a913b958
implement code generation for scalar stmt expressions.
...
llvm-svn: 41656
2007-08-31 22:09:40 +00:00
Chris Lattner
9e47ead594
Implement codegen support for lowering "library builtins" like __builtin_isinf
...
to their corresponding library routines (e.g. isinf). This allows us to handle
all the stuff in macos math.h, and other stuff as it's added to *Builtins.def.
llvm-svn: 41634
2007-08-31 04:44:06 +00:00
Chris Lattner
1eec6601d9
add the ability to get the llvm function corresponding to a library builtin.
...
llvm-svn: 41633
2007-08-31 04:31:45 +00:00
Steve Naroff
5c13180a27
Fix the following redefinition errors submitted by Keith Bauer...
...
[dylan:~/llvm/tools/clang] admin% cat tentative_decls.c
// incorrectly generates redefinition error
extern int array[3];
int array[3];
// incorrectly generates a redefinition error
extern void nup(int a[3]);
void nup(int a[3]) {}
It turns out that this exposed a fairly major flaw in the type system,
array types were never getting uniqued! This is because all array types
contained an expression, which aren't unique.
To solve this, we now have 2 array types, ConstantArrayType and
VariableArrayType. ConstantArrayType's are unique, VAT's aren't.
This is a fairly extensive set of fundamental changes. Fortunately,
all the tests pass. Nevertheless, there may be some collateral damage:-)
If so, let me know!
llvm-svn: 41592
2007-08-30 01:06:46 +00:00
Chris Lattner
fb38f274ff
remove some ugly code now that implicit defs are being generated in this case, thanks Steve!
...
llvm-svn: 41560
2007-08-29 06:38:44 +00:00
Chris Lattner
1c1f932433
Change EnumDecl to store its corresponding integer type
...
directly in it. Remove TargetInfo::getEnumPolicy, as there is only
one policy that we support right now.
llvm-svn: 41548
2007-08-28 18:24:31 +00:00
Chris Lattner
304ff47b1a
teach codegen to lay out enum types.
...
llvm-svn: 41501
2007-08-27 17:44:34 +00:00
Chris Lattner
bda69f80bc
move EmitAggregateCopy into AggExprEmitter
...
llvm-svn: 41472
2007-08-26 23:13:56 +00:00
Chris Lattner
c1045b1a69
remove dead code
...
llvm-svn: 41470
2007-08-26 23:02:57 +00:00
Chris Lattner
1916b88723
remove dead protos
...
llvm-svn: 41469
2007-08-26 23:01:23 +00:00
Chris Lattner
6c555f96e8
eliminate EmitAnyExpr, inlining it and simplifying it into its only caller.
...
llvm-svn: 41468
2007-08-26 22:58:05 +00:00
Chris Lattner
a811da5fcd
eliminate use of EmitAnyExpr.
...
llvm-svn: 41467
2007-08-26 22:55:13 +00:00
Chris Lattner
a8d8b71680
implement a fixme
...
llvm-svn: 41466
2007-08-26 22:47:40 +00:00
Chris Lattner
e56d3e1a23
Implement compound assignment operators whose LHS is scalar but RHS is complex.
...
llvm-svn: 41464
2007-08-26 22:37:40 +00:00
Chris Lattner
624e6d0c68
implement codegen of compound assignment operators for complex.
...
llvm-svn: 41463
2007-08-26 22:09:01 +00:00
Chris Lattner
b633469e02
compound assignment operators are of type CompoundAssignOperator
...
llvm-svn: 41460
2007-08-26 21:41:21 +00:00
Chris Lattner
2c666fa40d
update fixme's
...
llvm-svn: 41458
2007-08-26 21:27:07 +00:00
Chris Lattner
6f672c150c
implement complex division
...
llvm-svn: 41457
2007-08-26 21:24:19 +00:00
Chris Lattner
2e928885b2
fix a typo noticed by Gordon Henriksen
...
llvm-svn: 41451
2007-08-26 17:25:57 +00:00
Chris Lattner
c3b3707536
llvmgcc is right :)
...
llvm-svn: 41450
2007-08-26 16:54:05 +00:00
Chris Lattner
183c231cf9
compound assignmetns work for scalars.
...
llvm-svn: 41449
2007-08-26 16:52:57 +00:00
Chris Lattner
c141c1b390
implement conversions of complex to bool.
...
llvm-svn: 41448
2007-08-26 16:52:28 +00:00
Chris Lattner
268fcce4f0
remove ConvertScalarValueToBool.
...
llvm-svn: 41447
2007-08-26 16:46:58 +00:00
Chris Lattner
e004438f4a
reimplement ConvertScalarValueToBool in CGExprScalar.cpp
...
llvm-svn: 41446
2007-08-26 16:42:57 +00:00
Chris Lattner
42e6b8150a
refactor some code to expose compex->scalar conversion to CGF
...
llvm-svn: 41445
2007-08-26 16:34:22 +00:00
Chris Lattner
b84bb95b44
be slightly more volatile correct
...
llvm-svn: 41444
2007-08-26 16:22:13 +00:00
Chris Lattner
f6dcc9df7e
these fixme's are easy :)
...
llvm-svn: 41442
2007-08-26 07:30:49 +00:00
Chris Lattner
b753f66339
implement a fixme, add a couple more :)
...
llvm-svn: 41441
2007-08-26 07:29:23 +00:00
Chris Lattner
5de3b174c8
there are no conversions from aggregates to scalars.
...
llvm-svn: 41440
2007-08-26 07:26:12 +00:00
Chris Lattner
08c611e4dc
implement conversions from complex to scalar types.
...
llvm-svn: 41439
2007-08-26 07:21:11 +00:00
Chris Lattner
46c7161311
Omit EmitConversion
...
llvm-svn: 41438
2007-08-26 07:16:41 +00:00
Chris Lattner
45067906ad
Fix return of aggregate and return of complex.
...
llvm-svn: 41437
2007-08-26 07:14:44 +00:00
Chris Lattner
44d3e74e22
these implicit conversions are now explicit :)
...
llvm-svn: 41436
2007-08-26 07:09:42 +00:00
Chris Lattner
cf3da8495a
remove uses of EmitConversion
...
llvm-svn: 41435
2007-08-26 07:08:39 +00:00
Chris Lattner
798da7033f
implicit casts take care of this code, remove it now.
...
llvm-svn: 41434
2007-08-26 07:06:24 +00:00
Chris Lattner
3474c202ab
refactor scalar conversions out into CGExprScalar.cpp
...
llvm-svn: 41433
2007-08-26 06:48:56 +00:00
Chris Lattner
7460f9620c
Implement casts from scalar -> complex and complex->complex.
...
llvm-svn: 41429
2007-08-26 05:57:57 +00:00
Chris Lattner
b5e1262437
implement codegen of __imag of a scalar. Our impl doesn't suffer from
...
GCC bug PR33192.
llvm-svn: 41427
2007-08-26 05:29:21 +00:00
Chris Lattner
9de9527ad6
Make initialization of complex vars work.
...
llvm-svn: 41426
2007-08-26 05:13:54 +00:00
Chris Lattner
a01d898ff5
fix codegen of pre/post inc/dec of a pointer.
...
llvm-svn: 41425
2007-08-26 05:10:16 +00:00
Chris Lattner
c7f06ca780
tolerate unimplemented codegen better
...
llvm-svn: 41424
2007-08-26 05:06:40 +00:00
Chris Lattner
e7a160b37d
int X[] isn't a VLA. This improves support for stdio.h on darwin.
...
llvm-svn: 41423
2007-08-26 05:02:07 +00:00
Chris Lattner
57c269b5d3
implement rudimentary union layout support.
...
llvm-svn: 41421
2007-08-26 04:50:19 +00:00
Chris Lattner
881440f5d2
Don't make unknown builtins fatal errors yet.
...
llvm-svn: 41419
2007-08-26 04:17:05 +00:00
Chris Lattner
c5221650b3
remove a bunch of dead code
...
llvm-svn: 41418
2007-08-26 04:13:58 +00:00
Chris Lattner
0fffcb5b28
implement codegen for complex literals.
...
llvm-svn: 41414
2007-08-26 03:51:12 +00:00
Chris Lattner
27f00282e9
The new correct compound assignment operators exposed a bug in codegen.
...
llvm-svn: 41405
2007-08-25 21:56:20 +00:00
Chris Lattner
9f0ad96b3e
implement codegen for real/imag. TODO: imag of non-complex.
...
llvm-svn: 41376
2007-08-24 21:20:17 +00:00
Chris Lattner
3d966d6556
Teach emit-llvm for scalars to properly handle compound assignment
...
operators in all their glory :)
llvm-svn: 41373
2007-08-24 21:00:35 +00:00
Chris Lattner
100198f3f7
print the computation type for compound assignment operators in dumps.
...
llvm-svn: 41361
2007-08-24 16:24:49 +00:00
Chris Lattner
2da04b3322
completely refactor codegen of scalar expressions out into its own CGExprScalar.cpp file.
...
This patch temporarily breaks compound assignment operators, but greatly simplifies many
things.
llvm-svn: 41355
2007-08-24 05:35:26 +00:00
Chris Lattner
11e0de5193
rename two files.
...
llvm-svn: 41350
2007-08-24 02:22:53 +00:00
Chris Lattner
db0d60d5b5
implement codegen of builtin_choose_expr for complex.
...
llvm-svn: 41349
2007-08-24 02:18:47 +00:00
Chris Lattner
8ad56707ea
stub out complex -> bool conversion.
...
llvm-svn: 41347
2007-08-24 00:01:20 +00:00
Chris Lattner
0b984995b7
implement complex subtraction
...
llvm-svn: 41345
2007-08-23 23:46:33 +00:00
Chris Lattner
08b15df766
implement passing of complex and aggregates through call args.
...
llvm-svn: 41344
2007-08-23 23:43:33 +00:00
Chris Lattner
1aaab49a3e
add support for codegen of calls returning complex.
...
llvm-svn: 41336
2007-08-23 21:38:16 +00:00
Chris Lattner
cb1ffbc12e
add some fixme's, implement complex struct members.
...
llvm-svn: 41256
2007-08-21 22:33:41 +00:00
Chris Lattner
d34c999b67
implement codegen for --/++
...
llvm-svn: 41255
2007-08-21 22:25:29 +00:00
Chris Lattner
875a519ca6
implement __extension__ and unary~ for complex.
...
llvm-svn: 41249
2007-08-21 20:41:44 +00:00
Chris Lattner
ad4569eacb
implement codegen for complex unary +/-
...
llvm-svn: 41247
2007-08-21 20:08:23 +00:00
Chris Lattner
d614e7a553
minor nicities.
...
llvm-svn: 41244
2007-08-21 18:51:13 +00:00
Chris Lattner
a0733a777b
implement support for complex subscripts.
...
llvm-svn: 41240
2007-08-21 18:03:58 +00:00
Chris Lattner
e0e54120b2
allow support for volatile lvalues even though it's still not right.
...
llvm-svn: 41239
2007-08-21 18:02:02 +00:00
Anders Carlsson
76f4a902d7
Implement parsing and code generation of Objective-C string literals.
...
llvm-svn: 41238
2007-08-21 17:43:55 +00:00
Chris Lattner
2dc2af3515
add a new builder ivar.
...
llvm-svn: 41237
2007-08-21 17:39:38 +00:00
Chris Lattner
4b0e7873f6
move EmitLoadOfComplex/EmitStoreOfComplex into ComplexExprEmitter.
...
llvm-svn: 41236
2007-08-21 17:28:34 +00:00
Chris Lattner
3cf417b369
implement comma for complex.
...
llvm-svn: 41235
2007-08-21 17:15:50 +00:00
Chris Lattner
64be48fede
and/or/xor are invalid for complex, even integer complex apparently.
...
llvm-svn: 41234
2007-08-21 17:12:50 +00:00
Chris Lattner
bf1bd0dcc7
simplify code slightly
...
llvm-svn: 41233
2007-08-21 17:03:38 +00:00