Douglas Gregor
70d83e27a4
Move FunctionDecl::TemplateSpecializationInfo out into its own class,
...
FunctionTemplateSpecializationInfo, in DeclTemplate.h. No functionality change.
llvm-svn: 74431
2009-06-29 17:30:29 +00:00
Bill Wendling
1835107ed0
Make the StackProtector bitfield use enums instead of obscure numbers.
...
llvm-svn: 74414
2009-06-28 23:01:01 +00:00
Bill Wendling
d63bbadbef
Add stack protector support to clang. This generates the 'ssp' and 'sspreq'
...
function attributes. There are predefined macros that are defined when stack
protectors are used: __SSP__=1 with -fstack-protector and __SSP_ALL__=2 with
-fstack-protector-all.
llvm-svn: 74405
2009-06-28 07:36:13 +00:00
Nate Begeman
ea12f6ebb5
OpenCL 1.0 Support: fix a bug with lvalue swizzles
...
llvm-svn: 74324
2009-06-26 21:12:50 +00:00
Anders Carlsson
082acded44
Implement enough of the 'auto' keyword so we can claim to support N2546.
...
llvm-svn: 74307
2009-06-26 18:41:36 +00:00
Devang Patel
2872df839d
typo
...
llvm-svn: 74305
2009-06-26 18:33:42 +00:00
Devang Patel
0d425350b2
Revrt PR4228 fix for now.
...
llvm-svn: 74304
2009-06-26 18:32:22 +00:00
Daniel Dunbar
c7d0e6525d
Simplify, and fix a possible crash (never happens however, because we don't ever
...
take this path with non-builtin floating point types).
llvm-svn: 74303
2009-06-26 18:32:06 +00:00
Anders Carlsson
81df7b89de
Add a DecltypeType type.
...
llvm-svn: 74099
2009-06-24 19:06:50 +00:00
Fariborz Jahanian
248c719a68
Patch fixes an obscure bug when 'used' attribute is applied to
...
variables in ObjC's Next runtime mode. Next runtime also implicitly applies
'used' attribute on some of its meta-data. This results in two
'llvm.used' arrays to be generated, and one of them is renamed to
'llvm.used1'.
llvm-svn: 74008
2009-06-23 21:47:46 +00:00
Chris Lattner
4c8da96ea9
fix PR4423.
...
llvm-svn: 73938
2009-06-23 01:38:41 +00:00
Douglas Gregor
fec52635f0
Parsing and AST support for using declarations, from John Thompson!
...
llvm-svn: 73812
2009-06-20 00:51:54 +00:00
Douglas Gregor
78bd61f661
Move the static DeclAttrs map into ASTContext. Fixes <rdar://problem/6983177>.
...
llvm-svn: 73702
2009-06-18 16:11:24 +00:00
Argyrios Kyrtzidis
c4b766bc65
Move CXXMethodDecl::OutOfLineDefinition into Decl::OutOfLine.
...
llvm-svn: 73651
2009-06-17 22:49:50 +00:00
Steve Naroff
fb4330f255
First step toward fixing <rdar://problem/6613046> refactor clang objc type representation.
...
Add a type (ObjCObjectPointerType) and remove a type (ObjCQualifiedIdType).
This large/tedious patch is just a first step. Next step is to remove ObjCQualifiedInterfaceType. After that, I will remove the magic TypedefType for 'id' (installed by Sema). This work will enable various simplifications throughout clang (when dealing with ObjC types).
No functionality change.
llvm-svn: 73649
2009-06-17 22:40:22 +00:00
Chris Lattner
94dfae248b
Update clang for the add ->add/fadd split. Likewise for sub and mul.
...
llvm-svn: 73604
2009-06-17 06:36:24 +00:00
Devang Patel
9fc4341eec
It is possible that main input file does not have any symbol with debug info. To handle this edge case, always create main compile unit first.
...
This fixes PR 4228.
llvm-svn: 73520
2009-06-16 18:02:02 +00:00
Anders Carlsson
a42ab8f3d5
Handle temporaries in default arguments.
...
llvm-svn: 73462
2009-06-16 03:37:31 +00:00
Chris Lattner
c7d2bfacef
"GCC emits an __objc_class_name_{classname} symbol for every class, and a corresponding reference to this symbol for every compilation unit that references the class. This causes linker errors when you try linking a program which references some classes but doesn't define them. The attached patch implements this support in clang, so you can compile a class with clang, reference it in a file compiled with GCC, and have it all work correctly."
...
Patch by David Chisnall!
llvm-svn: 73364
2009-06-15 01:09:11 +00:00
Eli Friedman
6282b3cff8
PR4390: Make sure to handle anonymous unions correctly while building
...
static intializers for structs.
llvm-svn: 73349
2009-06-14 21:41:37 +00:00
Chris Lattner
15ba94987a
Sink the BuiltinInfo object from ASTContext into the
...
preprocessor and initialize it early in clang-cc. This
ensures that __has_builtin works in all modes, not just
when ASTContext is around.
llvm-svn: 73319
2009-06-14 01:54:56 +00:00
Chris Lattner
5abdec7978
move the various builtins stuff from libast to libbasic. This
...
fixes a layering violation in lib/Basic/Targets.cpp.
llvm-svn: 73318
2009-06-14 01:05:48 +00:00
Chris Lattner
ecd79c6353
move GetBuiltinType from Builtin::Context to ASTContext.
...
llvm-svn: 73316
2009-06-14 00:45:47 +00:00
Chris Lattner
d50fea52af
Simplify mangleFunctionDecl by unnesting a crazy condition. This fixes
...
the check for extern "c" system headers, which should prevent functiondecls
from being mangled.
llvm-svn: 73311
2009-06-13 23:34:16 +00:00
Eli Friedman
3192cc8526
Fix the calling convention for structs/unions containing SSE vectors on
...
x86-32. This is slightly messy, but I think it's consistent with gcc.
llvm-svn: 73306
2009-06-13 21:37:10 +00:00
Chris Lattner
4ca97c3b9e
Fix PR4372, another case where non-prototyped functions can prevent
...
always_inline from working.
llvm-svn: 73273
2009-06-13 00:26:38 +00:00
Anders Carlsson
8783543a6f
Don't assert when generating code with static_asserts.
...
llvm-svn: 73208
2009-06-11 21:22:55 +00:00
Daniel Dunbar
76d864c7e7
Support complex properties, ivars and message expressions.
...
llvm-svn: 73158
2009-06-10 04:38:50 +00:00
Eli Friedman
e9ff191459
Remove a few more vector builtins.
...
llvm-svn: 73022
2009-06-07 09:32:56 +00:00
Eli Friedman
5a996fc0fc
Now that LLVM CodeGen can handle the generic variations a bit better,
...
get rid of a few more clang vector builtins.
llvm-svn: 73015
2009-06-07 07:12:56 +00:00
Eli Friedman
07bbeca406
PR4339: make sure to properly extend/trunc the index of a vector element
...
insert/extract; the relevant instructions are defined to take only an
i32.
llvm-svn: 73005
2009-06-06 19:09:26 +00:00
Anton Korobeynikov
18adbf5f07
Add new ABIArgInfo kind: Extend. This allows target to implement its own argument
...
zero/sign extension logic (consider, e.g. target has only 64 bit registers and thus
i32's should be extended as well).
llvm-svn: 72998
2009-06-06 09:36:29 +00:00
Eli Friedman
6813eb125f
Get rid of a bunch of dead builtins.
...
llvm-svn: 72996
2009-06-06 08:31:46 +00:00
Mike Stump
cbc2bcaf17
As an optimization, we maintain a cache of generated
...
___Block_byref_id_object_dispose and ___Block_byref_id_object_copy
functions so that we can simply reuse instead of creating a new one.
Additionally, add an assert to ensure no one yet tries to align a
__block variable beyond the alignment of a pointer as the codegen is
incomplete.
llvm-svn: 72974
2009-06-05 23:26:36 +00:00
Daniel Dunbar
feeeda70e2
weak_import should not make definitions have weak linkage.
...
- <rdar://problem/6948703> clang treats weak_import like weak
llvm-svn: 72967
2009-06-05 22:58:34 +00:00
Anton Korobeynikov
5bda50f84e
Update cmake script
...
llvm-svn: 72963
2009-06-05 22:08:54 +00:00
Anton Korobeynikov
244360d62b
Factor out TargetABIInfo stuff into separate file. No functionality change.
...
llvm-svn: 72962
2009-06-05 22:08:42 +00:00
Devang Patel
9e24386c65
Set function Attribute::NoImplicitFloat appropriately.
...
llvm-svn: 72961
2009-06-05 22:05:48 +00:00
Daniel Dunbar
4be99ff767
ABI handling: Fix nasty thinko where IRgen could generate an out-of-bounds read
...
when generating a coercion for ABI handling purposes.
- This may only manifest itself when building at -O0, but the practical effect
is that other arguments may get clobbered.
- <rdar://problem/6930451> [irgen] ABI coercion clobbers other arguments
llvm-svn: 72932
2009-06-05 07:58:54 +00:00
Daniel Dunbar
dd050567c1
Fix -Asserts build warnings.
...
llvm-svn: 72910
2009-06-05 02:03:25 +00:00
Devang Patel
6e467b1a46
Set function attribute llvm::Attribute::NoRedZone appropriately.
...
llvm-svn: 72902
2009-06-04 23:32:02 +00:00
Chris Lattner
0261e5c960
Make ReplaceUsesOfNonProtoTypeWithRealFunction verify that a call is *to* the
...
function of interest, not an operand of it.
llvm-svn: 72869
2009-06-04 16:47:43 +00:00
Anders Carlsson
43c52cdc29
Use PushConditionalTempDestruction/PopConditionalTempDestruction for the ternary operator.
...
llvm-svn: 72842
2009-06-04 03:00:32 +00:00
Anders Carlsson
f47a3de83c
Use conditional temp destruction for || and &&.
...
llvm-svn: 72838
2009-06-04 02:53:13 +00:00
Anders Carlsson
7d313fc09b
Make PushCXXTemporary and PopCXXTemporary handle conditional temporaries.
...
llvm-svn: 72837
2009-06-04 02:47:33 +00:00
Anders Carlsson
44bfcf0f97
Add PushConditionalTempDestruction/PopConditionalTempDestruction.
...
llvm-svn: 72835
2009-06-04 02:22:12 +00:00
Anders Carlsson
ea89e2b813
Make sure to push a cleanup block.
...
llvm-svn: 72831
2009-06-04 02:08:08 +00:00
Fariborz Jahanian
7c80959a97
Cleanup/Refactoring of ivar collection. No change in functionality.
...
llvm-svn: 72827
2009-06-04 01:19:09 +00:00
Mike Stump
fa0c645bae
Fix cmake builds.
...
llvm-svn: 72814
2009-06-03 22:24:28 +00:00
Eli Friedman
dd27484888
PR4316: Fix IRGen for cast-to-union extension.
...
llvm-svn: 72803
2009-06-03 20:45:06 +00:00
Anders Carlsson
4c49bb95f8
More temporary work.
...
llvm-svn: 72796
2009-06-03 19:05:16 +00:00
Anders Carlsson
6d36343ed8
Store more information about live temporaries. No functionality change for now.
...
llvm-svn: 72793
2009-06-03 18:54:26 +00:00
Anders Carlsson
82aea737a7
Move code generation of C++ temporaries into a new file.
...
llvm-svn: 72792
2009-06-03 18:40:21 +00:00
Eli Friedman
cb9d07caeb
Add support for __builtin_unwind_init.
...
Also, committing an #if 0'ed __builtin_setjmp and __builtin_longjmp
implementation I've had sitting in my tree for a while. I haven't
enabled it because the LLVM backend support isn't complete yet.
llvm-svn: 72727
2009-06-02 09:37:50 +00:00
Eli Friedman
f6bd15038c
If we recognize alloca, treat it as a builtin. This fixes uses of
...
alloca without declaring it.
llvm-svn: 72719
2009-06-02 07:10:30 +00:00
Fariborz Jahanian
c6d9800564
A corner case of objc2 gc's write-barrier generation
...
for the Next runtime.
llvm-svn: 72703
2009-06-01 21:29:32 +00:00
Eli Friedman
e32c02114f
PR4289: Make sure "&func" has the right LLVM type when "func" is a
...
K&R-style definition.
llvm-svn: 72690
2009-06-01 10:04:20 +00:00
Anders Carlsson
fa7c608ecc
Fix a thinko.
...
llvm-svn: 72679
2009-06-01 00:26:14 +00:00
Anders Carlsson
ca50119a31
Check for null correctly for new expressions.
...
llvm-svn: 72678
2009-06-01 00:05:16 +00:00
Anders Carlsson
cba81fc4de
Improve irgen of 'new' further.
...
llvm-svn: 72677
2009-05-31 21:53:59 +00:00
Anders Carlsson
96c012ff8b
...and aggregate POD types.
...
llvm-svn: 72676
2009-05-31 21:12:26 +00:00
Anders Carlsson
60d0c2c1c2
Support for complex types.
...
llvm-svn: 72675
2009-05-31 21:07:58 +00:00
Anders Carlsson
ec71f61608
Better support for scalar POD types in 'new' expressions.
...
llvm-svn: 72674
2009-05-31 20:56:36 +00:00
Anders Carlsson
1832f52b10
Very basic irgen support for new expressions.
...
llvm-svn: 72672
2009-05-31 20:21:44 +00:00
Anders Carlsson
0955f20473
Don't try to call getFileCharacteristic if the function declaration has an invalid source location (as is the case for the global allocation functions.
...
llvm-svn: 72671
2009-05-31 20:19:23 +00:00
Anders Carlsson
4a7b49b56a
Add a new function for emitting new functions.
...
llvm-svn: 72656
2009-05-31 01:40:14 +00:00
Anders Carlsson
8eb93e72f7
Emit destructors correctly for temporaries.
...
llvm-svn: 72655
2009-05-31 00:34:10 +00:00
Anders Carlsson
f3f91cee43
When possible, don't emit the cleanup block. Instead, just move the instructions to the current block.
...
llvm-svn: 72654
2009-05-31 00:33:20 +00:00
Anders Carlsson
c0092ad333
Implement VisitCXXExprWithTemporaries for complex expressions.
...
llvm-svn: 72653
2009-05-31 00:12:05 +00:00
Anders Carlsson
2262b307aa
Call EmitCXXExprWithTemporaries.
...
llvm-svn: 72652
2009-05-31 00:09:15 +00:00
Anders Carlsson
fd2af0cf86
Add lvalue irgen support for CXXBindTemporaryExpr.
...
llvm-svn: 72649
2009-05-30 23:30:54 +00:00
Anders Carlsson
3be22e27b6
More temporary support.
...
llvm-svn: 72648
2009-05-30 23:23:33 +00:00
Eli Friedman
f7f9f68722
Some small fixes for fields of reference type.
...
llvm-svn: 72636
2009-05-30 21:09:44 +00:00
Anders Carlsson
4b2434da54
Remove VarDecl from CXXConstructExpr.
...
llvm-svn: 72633
2009-05-30 20:56:46 +00:00
Anders Carlsson
0a63741a3f
Add code for emitting C++ destructors. Not used yet.
...
llvm-svn: 72591
2009-05-29 21:03:38 +00:00
Douglas Gregor
7de5966d76
Create a new PrintingPolicy class, which we pass down through the AST
...
printing logic to help customize the output. For now, we use this
rather than a special flag to suppress the "struct" when printing
"struct X" and to print the Boolean type as "bool" in C++ but "_Bool"
in C.
llvm-svn: 72590
2009-05-29 20:38:28 +00:00
Eli Friedman
9444638e4e
Re-add a slightly more general version of the check from r72578; it is
...
actually necessary in some obscure cases.
llvm-svn: 72585
2009-05-29 19:23:46 +00:00
Mike Stump
a678874975
Oops, the testcase I was thinking of is supposed to error out. I
...
tried other things that might trip, but they all worked.
llvm-svn: 72584
2009-05-29 19:14:13 +00:00
Mike Stump
7f12d51a48
Fixup codegen for composition of vla types using a normal array type.
...
llvm-svn: 72578
2009-05-29 17:06:45 +00:00
Mike Stump
df0fe27b66
Fixup the rest of the trivial cases of the codegen of volatile. If
...
any body can spot codegen bugs with volatile, or knows of any in the
bug database, let me know.
llvm-svn: 72572
2009-05-29 15:46:01 +00:00
Eli Friedman
2a69547f38
PR4281: Fix bogus CodeGen assertion. The issue is that
...
getUnqualifiedType() doesn't strip off all qualifiers for non-canonical
types.
llvm-svn: 72552
2009-05-28 23:04:00 +00:00
Mike Stump
01c2d0a17c
Not setting all the fields is confusing...
...
llvm-svn: 72506
2009-05-28 00:16:27 +00:00
Daniel Dunbar
16f422ec86
Fix a use-of-undefined, IRgen expects the RValue for "void" to be a scalar RValue.
...
llvm-svn: 72504
2009-05-27 23:45:33 +00:00
Fariborz Jahanian
7c1baf46d6
No write-barrier for initializations.
...
llvm-svn: 72492
2009-05-27 19:54:11 +00:00
Fariborz Jahanian
7551257f00
Change a confusing variable name.
...
llvm-svn: 72491
2009-05-27 19:48:48 +00:00
Anders Carlsson
ddcbfe7b53
IRgen support for calls to functions that return references to aggregate exressions.
...
llvm-svn: 72479
2009-05-27 16:45:02 +00:00
Eli Friedman
751aa72b72
Fix up constant expression handling to deal with the address
...
of a reference correctly.
llvm-svn: 72463
2009-05-27 06:04:58 +00:00
Eli Friedman
55422ad068
Add IRGen support for local variables of reference type.
...
llvm-svn: 72462
2009-05-27 05:39:06 +00:00
Eli Friedman
b909bf4937
Add IRGen support for return statements in functions with reference
...
type.
llvm-svn: 72459
2009-05-27 04:56:12 +00:00
Anders Carlsson
4034a95dc8
Handle operator call expressions where the callee is a member function.
...
llvm-svn: 72458
2009-05-27 04:18:27 +00:00
Anders Carlsson
d8b7ae205e
Functions that return references can be rvalues as well.
...
llvm-svn: 72457
2009-05-27 03:37:57 +00:00
Anders Carlsson
4ae70ff9a3
Add support for emitting calls to functions that return references (as lvalues only for now)
...
llvm-svn: 72449
2009-05-27 01:45:47 +00:00
Mike Stump
3e97f3b35d
Fix typo. I also fixed the hard to read case differences, so that no
...
one else is tempted to copy the style, incorrectly.
llvm-svn: 72448
2009-05-27 01:42:21 +00:00
Anders Carlsson
3a9463bfda
Rename an EmitCallExpr function to EmitCall to make it clear that it doesn't emit an expr.
...
llvm-svn: 72446
2009-05-27 01:22:39 +00:00
Mike Stump
ec3cbfe8c6
Fixup codegen for volatile structs in the trivial cases (a a=a and a=a=a).
...
llvm-svn: 72439
2009-05-26 22:03:21 +00:00
Daniel Dunbar
bee70bd1e7
Use .data() instead of &...[0].
...
- Just SmallVectors this time.
llvm-svn: 72432
2009-05-26 19:40:20 +00:00
Mike Stump
25306cacc6
Esnure that if we have a volatile structure as the destination, that
...
we actually have a destination.
llvm-svn: 72429
2009-05-26 18:57:45 +00:00
Daniel Dunbar
1518b64ddc
When trying to pass an argument on the stack, assume LLVM will do the right
...
thing for non-aggregate types.
- Otherwise we unnecessarily pin values to the stack and currently end up
triggering a backend bug in one case.
- This loose cooperation with LLVM to implement the ABI is pretty ugly.
- <rdar://problem/6918722> [irgen] clang miscompile of many pointer varargs on
x86-64
llvm-svn: 72419
2009-05-26 16:37:37 +00:00
Eli Friedman
895771aa4b
Handle the edge case of a weak function with incomplete type correctly.
...
Found by code inspection; I haven't seen this in real-world code.
llvm-svn: 72408
2009-05-26 01:22:57 +00:00
Mike Stump
b9f2518626
Propagate volatile for implicit property refernces.
...
llvm-svn: 72353
2009-05-23 23:52:31 +00:00
Mike Stump
9afc476d4a
Propagate volatile around for property references.
...
llvm-svn: 72352
2009-05-23 23:48:13 +00:00
Mike Stump
5e9e61b8d2
Track volatile aggregate copies better. I'm hoping someone else will decide
...
how to get the backend to know that the operation is volatile.
llvm-svn: 72348
2009-05-23 22:29:41 +00:00
Mike Stump
332ec2ce81
Fix thinko, and implement aggregate volatile reads.
...
llvm-svn: 72347
2009-05-23 22:01:27 +00:00
Mike Stump
23abd46b79
More volatile fixes. Can't testcase these yet as ultimately volatile
...
is still ignored.
llvm-svn: 72344
2009-05-23 21:40:07 +00:00
Mike Stump
ca9fc09c61
Collapse a few FIXMEs together and refactor to make fixing the code easier.
...
llvm-svn: 72342
2009-05-23 20:28:01 +00:00
Mike Stump
93700fc988
Add support for volatile RValues.
...
llvm-svn: 72341
2009-05-23 20:21:36 +00:00
Mike Stump
8673657275
One step to fixing up codegen for a=b, where a is a volatile struct.
...
llvm-svn: 72315
2009-05-23 04:13:59 +00:00
Daniel Dunbar
223db1c9e5
Initialize Obj-C GC attributes when emitting BlockDeclRefExprs.
...
- Otherwise we may incorrectly miss generation of some write barriers.
llvm-svn: 72313
2009-05-23 02:49:02 +00:00
Mike Stump
a35af82429
Fix typo.
...
llvm-svn: 72308
2009-05-23 02:02:29 +00:00
Fariborz Jahanian
a4404f21d1
This patch adds support for sender-aware dispatch in Objective-C for the GNU runtime, when
...
compiled with -fobjc-sender-dependent-dispatch. This is used in AOP, COP, implementing object
planes, and a few other things.
Patch by David Chisnall.
llvm-svn: 72275
2009-05-22 20:17:16 +00:00
Mike Stump
c63428b192
Fixup codegen for __block int i; i += rhs();. Should also slightly
...
improve codegen in some cases.
llvm-svn: 72273
2009-05-22 19:07:20 +00:00
Daniel Dunbar
499f3f9c5d
x86_64 ABI: Account for sret parameters consuming an integer register.
...
- PR4242.
llvm-svn: 72268
2009-05-22 17:33:44 +00:00
Sanjiv Gupta
47e296149e
Targets like PIC16 generate Static decls for automatic variables, emit the appropriate debug descriptor as well in that case.
...
llvm-svn: 72261
2009-05-22 13:54:25 +00:00
Torok Edwin
5b34933b90
Set correct calling convention even if there is a bitcast in the way.
...
This attempts to fix PR4239.
llvm-svn: 72251
2009-05-22 07:25:06 +00:00
Mike Stump
aed08f9929
Fixup blocks codegen for { __block i; i = rhs(); }, we want the rhs
...
evaluated first. This can also improve codegen just a bit as we might
have another register to play with for the evaluation of the rhs.
llvm-svn: 72226
2009-05-21 21:05:15 +00:00
Jay Foad
7d0479f2c2
Use v.data() instead of &v[0] when SmallVector v might be empty.
...
llvm-svn: 72210
2009-05-21 09:52:38 +00:00
Fariborz Jahanian
a6bed8370e
Minor refactoring. Uses an existing API to lookup a class method.
...
llvm-svn: 72203
2009-05-21 01:03:45 +00:00
Fariborz Jahanian
d20a03f308
This patch provides preliminary support for non-fragile instance variables on the GNU runtime.
...
It currently requires a patches to GNU libobjc (and so is not enabled by default) which are currently
being tested and reviewed by GNUstep before being pushed upstream.
This patch does not allow support for synthesized ivars, but does provide the infrastructure
needed for supporting them.
Patch by David Chisnall
llvm-svn: 72175
2009-05-20 18:41:51 +00:00
Eli Friedman
c21cb44de2
Handle the remaining unhandled cases in EmitReferenceBindingToExpr.
...
It would be nice if someone could write an ObjC++ testcase for the case
of passing a property returning a struct to a function taking a const
reference.
llvm-svn: 72159
2009-05-20 02:31:19 +00:00
Anders Carlsson
02bb7f0ac8
irgen for references to complex rvales (Very important...)
...
llvm-svn: 72157
2009-05-20 01:35:03 +00:00
Anders Carlsson
ad007d44b6
Create a temporary if the lvalue is a bitfield. Reported by Eli.
...
llvm-svn: 72155
2009-05-20 01:24:22 +00:00
Anders Carlsson
145eae5224
Add support for binding references to scalar rvalues.
...
llvm-svn: 72153
2009-05-20 01:03:17 +00:00
Anders Carlsson
7d4c083c19
Bind references to lvalues correctly.
...
llvm-svn: 72150
2009-05-20 00:36:58 +00:00
Anders Carlsson
6f5a015bd9
Add EmitReferenceBindingToExpr. Have EmitCallArg use it for now. Doesn't support anything but at least we don't crash ;)
...
llvm-svn: 72147
2009-05-20 00:24:07 +00:00
Anders Carlsson
2d228cef50
Improve support for irgen of references.
...
llvm-svn: 72133
2009-05-19 20:40:02 +00:00
Anders Carlsson
29a1be34b7
Only do the bitcast in EmitStoreOfScalar if the type is a boolean.
...
llvm-svn: 72125
2009-05-19 19:36:19 +00:00
Anders Carlsson
8370964257
Pass the destination QualType to EmitStoreOfScalar. No functionality change.
...
llvm-svn: 72118
2009-05-19 18:50:41 +00:00
Anders Carlsson
775640d248
Don't always zext the result of the not unary operator to an int.
...
llvm-svn: 72117
2009-05-19 18:44:53 +00:00
Anders Carlsson
c82b86dfaa
Have AggExprEmitter::VisitCXXConstructExpr make new variables if necessary. Stub out VisitCXXExprWithTemporaries.
...
llvm-svn: 72103
2009-05-19 04:48:36 +00:00
Eli Friedman
cec35d7e6a
Clean up some unnecessary includes.
...
llvm-svn: 72101
2009-05-19 04:30:57 +00:00
Fariborz Jahanian
b27c94199f
This patch allows clang to generate code for declared properties on the GNU runtime. As with @synchronized, this requires some extra functions that are included with other libraries (not with the GNU runtime itself) and so will cause linker errors when these are not present.
...
Patch by David Chisnall.
llvm-svn: 72079
2009-05-19 00:28:43 +00:00
Daniel Dunbar
c61d0bd8f1
Debug info: Initialize runtime language field correctly for Objective-C
...
interface types.
llvm-svn: 72036
2009-05-18 20:51:58 +00:00
Anders Carlsson
9b02760923
Since we miscompile many cases when declaring a variable with a reference type, make them unsupported for now.
...
llvm-svn: 72034
2009-05-18 19:55:29 +00:00
Anders Carlsson
8dd2947696
Remove an unused builtin.
...
llvm-svn: 72033
2009-05-18 19:25:54 +00:00
Anders Carlsson
2081200b8c
Add 'cmp' SSE builtins and get rid of a bunch of other builtins.
...
llvm-svn: 72032
2009-05-18 19:16:46 +00:00
Anders Carlsson
23ca0b4869
Add support for converting member pointer types to LLVM types. Also mangle pointer to member functions correctly and add tests.
...
llvm-svn: 71981
2009-05-17 17:41:20 +00:00
Fariborz Jahanian
078cd52297
This patch fixes two bugs in the GNU Objective-C runtime implementation. One is a case in rethrowing exceptions where the C types don't match correctly (I already sent this patch to Daniel Dunbar, who found the bug, so it may have already been committed). The other fixes the case properties so that the methods generated as property accessors are added to the class structure correctly.
...
Patch by David Chisnall.
llvm-svn: 71980
2009-05-17 16:49:27 +00:00
Anders Carlsson
d3a69ceaaf
extern "C" should preserve the 'extern' qualifier for VarDecls. Fixes 6853728.
...
llvm-svn: 71957
2009-05-16 21:02:39 +00:00
Mike Stump
18bb9284ff
Reflow some comments.
...
llvm-svn: 71937
2009-05-16 07:57:57 +00:00
Daniel Dunbar
9a017d7fcf
Classes with "+load" methods need to go in the non-lazy class list (or
...
else the method will not be found by the runtime at class load time).
llvm-svn: 71904
2009-05-15 22:33:15 +00:00
Daniel Dunbar
19573e7d29
Factor code for adding module-level class lists into separate method.
...
- No functionality change.
llvm-svn: 71898
2009-05-15 21:48:48 +00:00
Anders Carlsson
37604a0984
A C++ member function always has either weak linkage (if it's inline or defined inline) or strong linkage (other cases).
...
llvm-svn: 71873
2009-05-15 18:35:39 +00:00
Anders Carlsson
f6e9ece507
Name mangling for class template specializations and template arguments.
...
llvm-svn: 71861
2009-05-15 16:09:15 +00:00
Mike Stump
2c002929b2
Fixup debug information for the location information for __block
...
variables. For this to work, the backend needs to handle more complex
forms for locations.
A typical utterance would be:
%forwarding = getelementptr %0* %use_by_ref, i32 0, i32 1 ; <i8**> [#uses=1]
%0 = load i8** %forwarding ; <i8*> [#uses=1]
%1 = bitcast i8* %0 to %0* ; <%0*> [#uses=1]
%x = getelementptr %0* %1, i32 0, i32 4 ; <i32*> [#uses=1]
%2 = bitcast i32* %x to { }* ; <{ }*> [#uses=1]
call void @llvm.dbg.declare({ }* %2, { }* bitcast (%llvm.dbg.variable.type* @llvm.dbg.variable to { }*))
Presently when selection finds something it doesn't understand, it
just avoids generating any information, which is safe, just
incomplete. Radar 6867696
llvm-svn: 71824
2009-05-15 00:29:54 +00:00
Daniel Dunbar
0a2171ccd5
Skip the asm prefix when storing the name in block info.
...
- Otherwise we emit internal names with embedded '\01' characters,
which confuses some tools.
- Ideally all the code which wants to get a "display name" for the
given function should follow one code path, but this should be a
monotonic improvement for now.
llvm-svn: 71774
2009-05-14 16:42:16 +00:00
Mike Stump
31f099c8c2
Enhance debug information for block literals. Radar 6867696
...
llvm-svn: 71763
2009-05-14 02:03:51 +00:00
Daniel Dunbar
7911002bf9
We need to specify the "linkage name" to the subprogram now that we
...
emit the correct "display name". I suspect we need more work here, see
FIXME for example.
llvm-svn: 71761
2009-05-14 01:45:24 +00:00
Daniel Dunbar
0beb7894c4
Make sure not to include the LLVM asm prefix in function names for
...
debug info.
llvm-svn: 71736
2009-05-13 23:08:57 +00:00
Daniel Dunbar
ffdb8439d7
ABI handling: Fix invalid assertion, it is possible for a valid
...
coercion to be specified which truncates padding bits. It would be
nice to still have the assert, but we don't have any API call for the
unpadding size of a type yet.
llvm-svn: 71695
2009-05-13 18:54:26 +00:00
Fariborz Jahanian
1880136520
Removed 4-letter :) word in comment.
...
Used simple array for Selector build.
llvm-svn: 71674
2009-05-13 16:19:02 +00:00
Chris Lattner
afde259240
implement __sync_synchronize and __sync_lock_release,
...
rdar://6880573
llvm-svn: 71637
2009-05-13 04:46:13 +00:00
Chris Lattner
94578cba76
add support for __sync_nand_and_fetch and __sync_fetch_and_nand,
...
rdar://6880573
llvm-svn: 71636
2009-05-13 04:37:52 +00:00
Chris Lattner
46813bbfa2
Fix rdar://6880259 - invalid function name in block call (__NSConcreteGlobalBlock2)
...
by using the appropriate CGM interface instead of directly creating a global.
llvm-svn: 71617
2009-05-13 02:50:56 +00:00
Chris Lattner
e541ea3a61
implement l-value codegen of comma expr
...
llvm-svn: 71595
2009-05-12 21:28:12 +00:00
Chris Lattner
e0be0dfced
push GlobalDecl through enough of the CodeGenModule interfaces
...
to allow us to support generation of deferred ctors/dtors.
It looks like codegen isn't emitting a call to the dtor in
member-functions.cpp:test2, but when it does, its body should
get emitted.
llvm-svn: 71594
2009-05-12 21:21:08 +00:00
Chris Lattner
d035ebda2f
add an initial stab at emitting deferred c++ inline functions. This handles static
...
functions and methods declared inline, but not ctors/dtors or methods not declared
inline (apparently my previous patch wasn't good enough).
llvm-svn: 71591
2009-05-12 21:02:27 +00:00
Chris Lattner
eb7466d24a
cleanups, no functionality change.
...
llvm-svn: 71590
2009-05-12 20:58:15 +00:00
Chris Lattner
bea5b622be
static methods don't get this pointers.
...
llvm-svn: 71586
2009-05-12 20:27:19 +00:00
Chris Lattner
e7834115eb
revert my previous patch, I committed the wrong file.
...
llvm-svn: 71585
2009-05-12 20:26:52 +00:00
Chris Lattner
cd74ffa3eb
static methods don't get this pointers.
...
llvm-svn: 71583
2009-05-12 20:21:39 +00:00
Fariborz Jahanian
e4128642a7
Fixed typos, used DenseSet for keeping track of
...
selectors which need use Nonfrgile API for
message dispatch.
llvm-svn: 71578
2009-05-12 20:06:41 +00:00
Fariborz Jahanian
0f44d81a4c
Patch to implement ivar synthesis of properties declared in protocols
...
only and used in class imllementations (objc2 Nonfragile ABI specific).
llvm-svn: 71571
2009-05-12 18:14:29 +00:00
Daniel Dunbar
bbfd054746
Darwin x86-32 ABI: Now that structure passing is farther along, we
...
don't need special treatment for unions.
llvm-svn: 71559
2009-05-12 17:00:20 +00:00
Daniel Dunbar
203e2e8dd8
x86-64 ABI: clang incorrectly passes union { long double, float } in
...
register.
- Merge algorithm was returning MEMORY as it should.
llvm-svn: 71556
2009-05-12 15:22:40 +00:00
Anders Carlsson
bd7d11f770
Factor code that's common to EmitCXXMemberCallExpr and EmitCXXConstructorCall out into a EmitCXXMemberCall function.
...
llvm-svn: 71514
2009-05-11 23:37:08 +00:00
Daniel Dunbar
097353cbb5
Darwin x86-32: Multi-dimensional arrays were not handled correctly,
...
spotted by Eli!
llvm-svn: 71490
2009-05-11 23:01:34 +00:00
Fariborz Jahanian
5d5ed2d800
Patch to allow Nonfragile ABI to use 32-bit style legacy
...
message dispage API for all but a few messages. This is
a runtime performance improvement and there is not meant
to be a functional change.
llvm-svn: 71467
2009-05-11 19:25:47 +00:00
Daniel Dunbar
2ce6b3f91c
Darwin x86_32: Treat records with unnamed bit-fields as "empty".
...
llvm-svn: 71461
2009-05-11 18:58:49 +00:00
Chris Lattner
9fea944f26
More improvements for GNU runtime objc EH, patch by David Chisnall!
...
llvm-svn: 71451
2009-05-11 18:16:28 +00:00
Sebastian Redl
576fd424df
Implement C++0x nullptr.
...
llvm-svn: 71405
2009-05-10 18:38:11 +00:00
Duncan Sands
c76fe8b611
Correct for renaming PaddedSize -> AllocSize in
...
LLVM.
llvm-svn: 71350
2009-05-09 07:08:47 +00:00
Daniel Dunbar
b997f3bcc3
x86_64 ABI: Ignore padding bit-fields during classification.
...
- {return-types,single-args}-{32,64} pass the first 1k ABI tests with
bit-fields enabled.
llvm-svn: 71272
2009-05-08 22:26:44 +00:00
Daniel Dunbar
4752783057
Darwin x86_32: When coercing a "single element" structure, make sure
...
to use a wide enough type. This might be wider than the "single
element"'s type in the presence of padding bit-fields.
- Darwin x86_32 now passes the first 1k ABI tests with bit-field
generation enabled.
llvm-svn: 71270
2009-05-08 21:30:11 +00:00
Daniel Dunbar
fdda3501a0
Darwin x86_32: Ignore padding bit-fields when looking for "single
...
element" structures.
llvm-svn: 71266
2009-05-08 21:04:47 +00:00
Daniel Dunbar
4861346c44
Darwin x86_32: Improve bit-field handling for returning records.
...
- This turns out to be a no-op now that most of the handling for
everything else is in place.
llvm-svn: 71261
2009-05-08 20:55:49 +00:00
Daniel Dunbar
85f4028f2e
Darwin x86_32: Ignore arrays of empty structures inside records.
...
- This eliminates 5/1000 failures on return-types-32, on the current
ABITest config.
llvm-svn: 71250
2009-05-08 20:21:04 +00:00
Chris Lattner
96afab520b
further improvements to gnu objc EH stuff, patch by David Chisnall!
...
llvm-svn: 71227
2009-05-08 17:36:08 +00:00
Chris Lattner
a02cb80f99
"This patch fixes message sends to super in categories for the GNU runtime. This used to work, but I broke it when I modified the code to emit the same thing as GCC for message sends to super in classes."
...
Patch by David Chisnall!
llvm-svn: 71220
2009-05-08 15:39:58 +00:00
Chris Lattner
dc04654697
reimplement __sync_* builtins to be variadic and to follow the same
...
semantic rules that gcc and icc use. This implements the variadic
and concrete versions as builtins and has sema do the
disambiguation. There are probably a bunch of details to finish up
but this seems like a large monotonic step forward :)
llvm-svn: 71212
2009-05-08 06:58:22 +00:00
Chris Lattner
b6e9eb6956
initial support for ObjC exceptions with the GNU runtime:
...
"This patch is a first pass at adding support for exceptions for the GNU runtime. There are a few limitations at present:
- @synchronized() is not yet supported at all. gcc currently emits calls to runtime library functions that don't exist for this directive.
- Only id @catch statements are currently working. This is enough for NS_DURING and friends, but I need to spend more time reading the output from gcc -S to work out how it finds the class pointer to make arbitrary class type catch statements work.
- I've tested it with a few common cases[1] and the clang test suite (which doesn't test exceptions for the GNU runtime, but shows I haven't broken anything else), but there are probably a lot of cases I've missed."
Patch by David Chisnall!
llvm-svn: 71198
2009-05-08 00:11:50 +00:00
Eli Friedman
7ce29a18e1
Fix crash with constant initialization of bit-fields in unions.
...
llvm-svn: 71194
2009-05-07 23:42:42 +00:00
Fariborz Jahanian
f3648b8913
Patch to support Gnu runtime's typed selectors.
...
Patch by David Chisnall.
llvm-svn: 71023
2009-05-05 21:36:57 +00:00
Chris Lattner
36797ab251
When defining a function whose type has no prototype, make an effort
...
to go back and clean up existing uses of the bitcasted function. This
is not just an optimization: it is required for correctness to get
always inline functions to work, see testcases in function-attributes.c.
llvm-svn: 70971
2009-05-05 06:16:31 +00:00
Chris Lattner
448a228521
fix some more cases where we'd emit a file with a line of 0 for implicit
...
types. In this case, it was objc_selector and objc_class. This fixes
rdar://6852754 - clang sometimes generates incorrect/unknown file/line info for DW_TAG__structure_type dies
llvm-svn: 70969
2009-05-05 05:16:17 +00:00
Chris Lattner
f216fd96fe
Do not generate bogus location info for DW_TAG_inheritance
...
DIEs. We were generating a loc with line of 0 and a file.
These tags do not need locations at all, just remove it.
this fixes rdar://6852792 - Clang generates incorrect (and unnecessary) file and line info for DW_TAG_inheritance dies
llvm-svn: 70966
2009-05-05 05:05:36 +00:00
Chris Lattner
362d8ae328
Fix generated debug info for decls with no location (which include self/_cmd
...
in ObjC) to not emit file/line location information. Previously
we would output a file with bogus line information. This fixes:
rdar://6852814 - Clang generates incorrect file & line info for automatic/understood formal parameters for objc-programs
llvm-svn: 70965
2009-05-05 04:57:08 +00:00
Anders Carlsson
dae1abc7ac
Refactor global decls to hold either a regular Decl or a CXXConstructorDecl + ctor type or a CXXDestructorDecl + dtor type.
...
llvm-svn: 70962
2009-05-05 04:44:02 +00:00
Daniel Dunbar
3f86b9cb06
Remove an unneeded lookup routine.
...
llvm-svn: 70951
2009-05-05 00:36:57 +00:00
Fariborz Jahanian
32ff7aeefa
Provide basic support for generation of objc2's
...
objc_assign_global API when assigning to global
objective-c object pointer.
llvm-svn: 70939
2009-05-04 23:27:20 +00:00
Daniel Dunbar
9b042e06ee
Fix the field count in interface record layout (it was incorrectly
...
compensating for super classes). This was making the reported class
sizes for empty classes very, very wrong.
- Also, we now report the size info for an empty class like gcc (as
the offset of the start, not as 0, 0).
- Add a few more test cases we were mishandling before (padding bit
field at end of struct, for example).
llvm-svn: 70938
2009-05-04 23:23:09 +00:00
Daniel Dunbar
9252ee1779
Compute interface instanceStart and instanceSize using the record
...
layout.
- This is much simpler / more efficient.
- This also properly computes the size in the presence of bit-fields.
llvm-svn: 70916
2009-05-04 21:26:30 +00:00
Chris Lattner
23d5a39195
"Fix" a problem with debug info in the presence of always_inline
...
function calls. For a program like this:
#include <stdio.h>
static __inline__ __attribute__((always_inline))
int bar(int x) { return 4; }
int main() {
int X = bar(4);
printf("%d\n", X);
}
clang was not outputing any debug info for the body of main(). This is
because the backend is getting confused by the region_start/end that clang
is emitting for block scopes. For now, just disable these (matching llvm-gcc),
this stuff is in progress of rework anyway.
llvm-svn: 70889
2009-05-04 18:27:04 +00:00
Chris Lattner
bef2ee4322
"The attached diff fixes the //FIXME in message send to super. This should now be faster, and works in the presence of class posing. This is now the same approach as used in GCC (the earlier code was a quick hack to get something working)."
...
Patch by David Chisnall!
llvm-svn: 70877
2009-05-04 16:56:33 +00:00
Daniel Dunbar
566421c8a3
Patch from David Chisnall:
...
The attached diff fixes the //FIXME in message send to super. This
should now be faster, and works in the presence of class posing. This
is now the same approach as used in GCC (the earlier code was a quick
hack to get something working).
llvm-svn: 70868
2009-05-04 15:31:17 +00:00
Daniel Dunbar
d53e07b396
Remove unnecessary copy of constraint info.
...
llvm-svn: 70835
2009-05-04 06:56:16 +00:00
Eli Friedman
2ad7e17096
PR4143: don't crash generating debug info for incomplete enum types.
...
llvm-svn: 70825
2009-05-04 04:39:55 +00:00
Eli Friedman
33955dd28f
Remove unnecessary push_back (at least, I think it's unnecessary);
...
hopefully, this fixes PR4144 without any regressions.
llvm-svn: 70823
2009-05-04 04:12:48 +00:00
Daniel Dunbar
98ba964e5c
Don't allow clients to traverse into superclass synthesized properties
...
via CollectObjCIvars.
- In places where we need them, we should have the implementation and
access the properties through it.
This is a fairly substantial functionality change:
1. @encode no longer encodes synthesized ivars, ever.
2. The ivar layout bitmap no longer encodes information for
synthesized ivars in superclasses. Well, actually I had already
broken that, but it is intentional now.
We are now differing substantially from llvm-gcc and gcc
here. However, in my opinion this fundamentally *must* work if
non-fragile classes are to work. Without this change, the result of
@encode and the ivar layout depend on the order that the
implementation is seen in a file (if it is in the same file with its
superclass). Since both scenarios should work the same, our behavior
is now consistent with gcc behavior as if an implementation is never
seen following an implementation of its superclass.
Note that #2 is only a functionality change when (A) an
implementation appears in the same translation unit with the
implementation of its superclass, and (B) the superclass has
synthesized ivars. My belief is that this situation does not occur in
practice.
I am not yet sure of the role/semantics of @encode when synthesized
ivars are present... it's use is fairly unsound in a non-fragile world.
llvm-svn: 70822
2009-05-04 04:10:48 +00:00
Daniel Dunbar
62b1070fa2
Inline GetFieldBaseOffset into sole callsite.
...
llvm-svn: 70813
2009-05-03 23:35:23 +00:00
Daniel Dunbar
5b743915c3
Avoid recomputing field offsets.
...
llvm-svn: 70812
2009-05-03 23:31:46 +00:00