Daniel Dunbar
a7566f163a
IRgen: Add CreateMemTemp, for creating an temporary memory object for a particular type, and flood fill. - CreateMemTemp sets the alignment on the alloca correctly, which fixes a great many places in IRgen where we were doing the wrong thing.
...
- This fixes many many more places than the test case, but my feeling is we need to audit alignment systematically so I'm not inclined to try hard to test the individual fixes in this patch. If this bothers you, patches welcome!
PR6240.
llvm-svn: 95648
2010-02-09 02:48:28 +00:00
Daniel Dunbar
3d33fab7fc
Reapply r95393, without the change to CGExpr. I was wrong in assuming that the
...
element type always matched the converted LLVM type for ExprType.
llvm-svn: 95596
2010-02-08 22:53:07 +00:00
John McCall
ab26cfa58d
Standardize the parsing of function type attributes in a way that
...
follows (as conservatively as possible) gcc's current behavior: attributes
written on return types that don't apply there are applied to the function
instead, etc. Only parse CC attributes as type attributes, not as decl attributes;
don't accepet noreturn as a decl attribute on ValueDecls, either (it still
needs to apply to other decls, like blocks). Consistently consume CC/noreturn
information throughout codegen; enforce this by removing their default values
in CodeGenTypes::getFunctionInfo().
llvm-svn: 95436
2010-02-05 21:31:56 +00:00
Douglas Gregor
a643780483
Revert r95393, which broke Clang's self-host.
...
llvm-svn: 95430
2010-02-05 21:10:36 +00:00
Daniel Dunbar
9c4e4651d5
IRgen: A few more ConvertType cleanups.
...
llvm-svn: 95423
2010-02-05 20:02:42 +00:00
Daniel Dunbar
d0bc7b9d13
IRgen: Factor out EmitAggExprToLValue.
...
llvm-svn: 95416
2010-02-05 19:38:31 +00:00
Daniel Dunbar
8848175547
IRgen: Fix some CreateTempAlloca calls to use ConvertTypeForMem when that is
...
conceptually correct. Review appreciated (Chris, Eli, Anders).
llvm-svn: 95401
2010-02-05 18:56:49 +00:00
Charles Davis
5a5473f0f8
Now that we store calling conventions in the types, use them instead of
...
getting the calling convention from the target function, which may or may not
exist. Fixes PR5280.
llvm-svn: 95399
2010-02-05 18:13:10 +00:00
Daniel Dunbar
363589bded
IRgen: Use hasAggregateLLVMType instead of isSingleValueType() for cases that
...
need to deal with aggregates specially; this is consistent with the rest of IRgen.
Also, simplify EmitParmDecl and don't worry about using Decl::getNameAsString.
llvm-svn: 95393
2010-02-05 17:51:33 +00:00
Anders Carlsson
824e0613de
When binding an lvalue to a reference, we always need to pop temporaries.
...
With this fix, and the other fixes committed today a make check-all with a clang-built LLVM now gives:
Expected Passes : 6933
Expected Failures : 46
Unsupported Tests : 40
Unexpected Failures: 27
which means that we pass 99.96% of all tests :) The resulting 27 tests are all LLVMC tests and seem to be because of differences in the clang and gcc drivers.
llvm-svn: 95313
2010-02-04 17:32:58 +00:00
Anders Carlsson
9b942c65a5
Fix a bug where we would not mark temporaries as conditional when emitting a conditional operator as an lvalue.
...
llvm-svn: 95311
2010-02-04 17:26:01 +00:00
Anders Carlsson
3b227bd629
Revert the new reference binding code; I came up with a way simpler solution for the reference binding bug that is preventing self-hosting.
...
llvm-svn: 95223
2010-02-03 16:38:03 +00:00
Anders Carlsson
259688ce29
Move pointer to data member emission to CodeGenModule and use it in CGExprConstant. Fixes PR5674.
...
llvm-svn: 95063
2010-02-02 03:37:46 +00:00
Anders Carlsson
ab0ddb57b1
Start creating CXXBindReferenceExpr nodes when binding complex types to references.
...
llvm-svn: 94964
2010-01-31 18:34:51 +00:00
Anders Carlsson
db78f0ad04
Add a new EmitLValueForFieldInitialization that will be used for initializing fields (and reference type fields in particular).
...
llvm-svn: 94799
2010-01-29 05:24:29 +00:00
Anders Carlsson
5d8645b150
Simplify EmitLValueForField - we can get whether the field is part of a union or not from the FieldDecl (through its DeclContext).
...
llvm-svn: 94798
2010-01-29 05:05:36 +00:00
Anders Carlsson
ba6c437d52
Add an CXXBindReferenceExpr (not used just yet).
...
llvm-svn: 94791
2010-01-29 02:39:32 +00:00
Ken Dyck
e5402e4749
Use CharUnits for alignment in EmitNullInitializationLValue().
...
llvm-svn: 94563
2010-01-26 18:35:11 +00:00
Ken Dyck
40775003e6
Roll out ASTContext::getTypeSizeInChars(), replacing instances of
...
"ASTContext::getTypeSize() / 8". Replace [u]int64_t variables with CharUnits
ones as appropriate.
Also rename RawType, fromRaw(), and getRaw() in CharUnits to QuantityType,
fromQuantity(), and getQuantity() for clarity.
llvm-svn: 93153
2010-01-11 17:06:35 +00:00
Chris Lattner
bb8976e36e
implement codegen support for preinc as an lvalue, PR5514.
...
llvm-svn: 93076
2010-01-09 21:44:40 +00:00
Chris Lattner
116ce8f172
refactor pre/postinc logic into CGF and require the caller to pass in the
...
lvalue to poke, no functionality change.
llvm-svn: 93075
2010-01-09 21:40:03 +00:00
Daniel Dunbar
5b9019515a
Fix -Asserts warning.
...
llvm-svn: 92491
2010-01-04 18:02:28 +00:00
Eli Friedman
b8841af8bd
Minor optimization; emit proper unsupported messages for a couple of cases.
...
llvm-svn: 92153
2009-12-25 06:17:05 +00:00
Eli Friedman
2e06e8bbcc
Some small improvements to dead code elimination; helps a bit on
...
LLVM-Code-Symbols test.
llvm-svn: 92152
2009-12-25 05:29:40 +00:00
Anders Carlsson
bfb3671b25
Pass the return value slot to all call exprs.
...
llvm-svn: 92145
2009-12-24 21:13:40 +00:00
Anders Carlsson
1749083e2e
Fill in the return value slot in CGExprAgg::VisitCallExpr. This takes us halfway towards fixing PR5824.
...
llvm-svn: 92142
2009-12-24 20:40:36 +00:00
Anders Carlsson
61a401caec
Pass ReturnValueSlot to EmitCall. No functionality change yet.
...
llvm-svn: 92138
2009-12-24 19:25:24 +00:00
Anders Carlsson
0435ed5875
Add a ReturnValueSlot class. Change the argument order in EmitCall to match the other overload better.
...
llvm-svn: 92136
2009-12-24 19:08:58 +00:00
Chris Lattner
f0a9ba37d4
simplify my previous patch.
...
llvm-svn: 92057
2009-12-23 21:33:41 +00:00
Chris Lattner
4e1a323b85
fix opencl extvector element extraction on rvalues. We previously
...
error_unsupported on test10 and crashed on test11.
llvm-svn: 92056
2009-12-23 21:31:11 +00:00
Eli Friedman
357e8c94d6
Fix for PR5524: make reference binding in default argument work correctly.
...
llvm-svn: 91733
2009-12-19 00:20:10 +00:00
Mike Stump
3f6f9febad
Implement additional undefined checks for additional loads and stores. WIP.
...
llvm-svn: 91498
2009-12-16 02:57:00 +00:00
Fariborz Jahanian
2b9fc83db5
Fixes a code gen bug related to accessing a now
...
non-existing 'isa' field of a non-existing struct type
all related to legacy type definition for 'id' which we have
dropped in clang in favor of a built-in type.
(fixes radar 7470820).
llvm-svn: 91455
2009-12-15 21:34:52 +00:00
Anders Carlsson
6e997b2993
ShouldDestroyTemporaries? I don't think so.
...
llvm-svn: 91450
2009-12-15 20:51:39 +00:00
Mike Stump
cf16d2cc42
Fix spacing.
...
llvm-svn: 91386
2009-12-15 01:22:35 +00:00
Mike Stump
9a4e0128a8
Ensure we preserve line information for each trap for
...
-fcatch-undefined-behavior if we aren't optimizing. WIP.
llvm-svn: 91382
2009-12-15 00:59:40 +00:00
Mike Stump
e8c3b3eca4
Switch codegen for -fcatch-undefined-bahavior over to __builtin_trap
...
instead of abort to improve codesize and codegen.
llvm-svn: 91374
2009-12-15 00:35:12 +00:00
Mike Stump
590d18f103
We have to allow one to form an address for one past the end. WIP.
...
llvm-svn: 91347
2009-12-14 22:14:31 +00:00
Mike Stump
f8858af909
Simplifiy.
...
llvm-svn: 91324
2009-12-14 20:52:00 +00:00
Mike Stump
d954638f02
Implement runtime checks for undefined behavior. WIP.
...
This implements a new flag -fcatch-undefined-behavior. The flag turns
on additional runtime checks for:
T a[I];
a[i] abort when i < 0 or i >= I.
Future stuff includes shifts by >= bitwidth amounts.
llvm-svn: 91198
2009-12-12 01:27:46 +00:00
Eli Friedman
68396b16f6
Move the code for converting a member pointer to a bool so that it is usable
...
for logical not.
llvm-svn: 91112
2009-12-11 09:26:29 +00:00
Anders Carlsson
0c6a7d8f42
When extending the lifetime of a temporary, make sure to emit a branch to the cleanup exit block. This fixes a broken module error in LLVMCConfigurationEmitter.cpp.
...
llvm-svn: 91086
2009-12-11 01:00:09 +00:00
Fariborz Jahanian
531c16f9fb
Code gen for ObjCIsaExpr AST used as lvalue.
...
(fixes radar 7457534).
llvm-svn: 90995
2009-12-09 23:35:29 +00:00
Mike Stump
aff69af918
Add cleanups for exceptional edges. WIP.
...
llvm-svn: 90940
2009-12-09 03:35:49 +00:00
Eli Friedman
8aaff69e86
Fix some direct checks of expressions which might be surrounded by parentheses.
...
llvm-svn: 90825
2009-12-08 02:09:46 +00:00
Eli Friedman
5445f6e5b6
Make the comma operator consistently call EnsureInsertPoint.
...
llvm-svn: 90799
2009-12-07 20:18:11 +00:00
Chris Lattner
72ecc68e11
use new helpers to simplify code.
...
llvm-svn: 90709
2009-12-06 17:22:42 +00:00
Eli Friedman
b2b120f664
Make EmitStoreOfScalar generate a more sane representation of boolean stores.
...
"Fixes" PR5645.
llvm-svn: 90272
2009-12-01 22:31:51 +00:00
Daniel Dunbar
c76493a65d
Don't pass false (default) for isVolatile parameter to CreateLoad.
...
llvm-svn: 90098
2009-11-29 21:23:36 +00:00
Eli Friedman
d15eb34d4b
Implement IRGen for MemberExpr referring to static member function.
...
llvm-svn: 89938
2009-11-26 06:08:14 +00:00
Douglas Gregor
7bab5ff8e7
Eliminate CXXConditionDeclExpr with extreme prejudice.
...
All statements that involve conditions can now hold on to a separate
condition declaration (a VarDecl), and will use a DeclRefExpr
referring to that VarDecl for the condition expression. ForStmts now
have such a VarDecl (I'd missed those in previous commits).
Also, since this change reworks the Action interface for
if/while/switch/for, use FullExprArg for the full expressions in those
expressions, to ensure that we're emitting
Note that we are (still) not generating the right cleanups for
condition variables in for statements. That will be a follow-on
commit.
llvm-svn: 89817
2009-11-25 00:27:52 +00:00
Douglas Gregor
48a409eb39
Rename CleanupScope -> DelayedCleanupBlock. No functionality change.
...
llvm-svn: 89769
2009-11-24 16:21:10 +00:00
Anders Carlsson
8c793172c2
Handle base-to-derived casts. Will land test case shortly.
...
llvm-svn: 89678
2009-11-23 17:57:54 +00:00
Eli Friedman
928a567af1
Clean up EmitPointerToDataMemberBinaryExpr a bit.
...
llvm-svn: 89197
2009-11-18 05:01:17 +00:00
Anders Carlsson
cfd3012756
More const is always good.
...
llvm-svn: 89033
2009-11-17 03:57:07 +00:00
Mike Stump
65511704f7
Implement most of dynamic_cast. WIP.
...
llvm-svn: 88901
2009-11-16 06:50:58 +00:00
Eli Friedman
8c98dffd1f
Some minor cleanup for EmitCastLValue.
...
llvm-svn: 88894
2009-11-16 05:48:01 +00:00
Mike Stump
c9b231c8d1
Implement typeid for class types.
...
llvm-svn: 88843
2009-11-15 08:09:41 +00:00
Anders Carlsson
50cb321fdc
Handle CK_BitCast in EmitCastLValue.
...
llvm-svn: 88810
2009-11-14 21:21:42 +00:00
Anders Carlsson
52ce3bbf57
Handle CXXDefaultArgExprs in EmitLValue. Fixes PR5484.
...
llvm-svn: 88735
2009-11-14 01:51:50 +00:00
Eli Friedman
a72bf0fae8
Explicitly note that pre-inc/dec lvalues are not supported yet, so that it
...
doesn't crash. (Such expressions are valid in C++, but not in C.)
llvm-svn: 86513
2009-11-09 04:20:47 +00:00
Daniel Dunbar
7e215ea165
Add clarifying parens.
...
llvm-svn: 86457
2009-11-08 09:46:46 +00:00
Anders Carlsson
5bbdc9f857
Handle member expressions where the member declaration is actually a static variable. Fixes PR5392.
...
llvm-svn: 86414
2009-11-07 23:16:50 +00:00
Anders Carlsson
ea4c30b39a
More LValue related code cleanup.
...
llvm-svn: 86413
2009-11-07 23:06:58 +00:00
Anders Carlsson
2ff6395ddc
More cleanup, the code is much easier to follow now.
...
llvm-svn: 86412
2009-11-07 22:53:10 +00:00
Anders Carlsson
6eee97276b
Reduce nesting, no functionality change.
...
llvm-svn: 86411
2009-11-07 22:46:42 +00:00
Anders Carlsson
03f83e58f7
We only need to call SetObjCNonGC for local variables. No functionality change.
...
llvm-svn: 86410
2009-11-07 22:43:34 +00:00
Anders Carlsson
509850ebec
Change EmitPointerToDataMemberLValue to take a FieldDecl. No intended functionality change.
...
llvm-svn: 86407
2009-11-07 22:00:15 +00:00
Chris Lattner
ab5e0af8bc
random tidying
...
llvm-svn: 85408
2009-10-28 17:39:19 +00:00
Chris Lattner
5e71d43155
adjust for a pending LLVM change.
...
llvm-svn: 85373
2009-10-28 05:12:07 +00:00
Fariborz Jahanian
038374f887
Add Code gen support for '->*' operator which fell
...
through the crack.
llvm-svn: 85160
2009-10-26 21:58:25 +00:00
Douglas Gregor
4bd90e53c2
Eliminate QualifiedDeclRefExpr, which captured the notion of a
...
qualified reference to a declaration that is not a non-static data
member or non-static member function, e.g.,
namespace N { int i; }
int j = N::i;
Instead, extend DeclRefExpr to optionally store the qualifier. Most
clients won't see or care about the difference (since
QualifierDeclRefExpr inherited DeclRefExpr). However, this reduces the
number of top-level expression types that clients need to cope with,
brings the implementation of DeclRefExpr into line with MemberExpr,
and simplifies and unifies our handling of declaration references.
Extended DeclRefExpr to (optionally) store explicitly-specified
template arguments. This occurs when naming a declaration via a
template-id (which will be stored in a TemplateIdRefExpr) that,
following template argument deduction and (possibly) overload
resolution, is replaced with a DeclRefExpr that refers to a template
specialization but maintains the template arguments as written.
llvm-svn: 84962
2009-10-23 18:54:35 +00:00
John McCall
6fd4c23324
Emit calls using the canonical prototype of the called function.
...
llvm-svn: 84947
2009-10-23 08:22:42 +00:00
Fariborz Jahanian
ffba662dd2
Complete code gen for '.*' binary expression for
...
both scalar and aggregates.
llvm-svn: 84910
2009-10-22 22:57:31 +00:00
Fariborz Jahanian
b25817ac1f
Expand on code gen. for pointer to data members so it works
...
for base classe members as well. Test case enhanced for this.
llvm-svn: 84780
2009-10-21 21:01:47 +00:00
Fariborz Jahanian
4ebdff5e1c
Code gen for pointer-to-datamember - WIP.
...
llvm-svn: 84771
2009-10-21 18:38:00 +00:00
Fariborz Jahanian
e4d94cee05
Code-gen for CXXZeroInitValueExpr AST passed
...
as argument to a function call. Removes a FIXME.
llvm-svn: 84694
2009-10-20 23:29:04 +00:00
Anders Carlsson
0999aafda5
Handle emitting the assignment operator when the lhs is a reference. Fixes PR5227.
...
llvm-svn: 84518
2009-10-19 18:28:22 +00:00
Daniel Dunbar
b5aacc282c
Twinify CodeGenFunction::CreateTempAlloca
...
llvm-svn: 84456
2009-10-19 01:21:05 +00:00
Anders Carlsson
69c2c4becc
When binding a reference to a temporary, it's important that other temporaries created as on the RHS are destroyed before emitting the dtor for the temporary.
...
llvm-svn: 84451
2009-10-18 23:09:21 +00:00
Anders Carlsson
66413c29d3
Handle
...
struct A { };
struct B : A { };
void f() {
const A& a = B();
}
correctly. (This now does the offset conversion if necessary and calls the destructor when a goes out of scope).
llvm-svn: 84162
2009-10-15 00:51:46 +00:00
Benjamin Kramer
abd5b90e4c
Simplify pointer creation with the new Type::getInt*Ptr methods.
...
llvm-svn: 83964
2009-10-13 10:07:13 +00:00
Devang Patel
dac79decf3
There is no need to attach debug location info with alloca instruction.
...
llvm-svn: 83913
2009-10-12 22:29:02 +00:00
Devang Patel
5d90d62701
Add support to attach debug info to an instruction.
...
This is not yet enabled.
llvm-svn: 83399
2009-10-06 18:36:08 +00:00
Fariborz Jahanian
e01e434aef
<rdar://problem/7263113> Make clang produce gcc's objc_assign_StrongCast as a result of type-cast of an ivar in assignment.
...
llvm-svn: 83150
2009-09-30 17:10:29 +00:00
Fariborz Jahanian
1f9ed58277
Fixed another code gen bug in objc's new write-barrier API.
...
llvm-svn: 82735
2009-09-25 00:00:20 +00:00
Fariborz Jahanian
7a95d72b10
Patch fixes a code gen. bug in generation of objc_assign_ivar
...
(objc GC's API).
llvm-svn: 82724
2009-09-24 22:25:38 +00:00
John McCall
8ccfcb51ee
Refactor the representation of qualifiers to bring ExtQualType out of the
...
Type hierarchy. Demote 'volatile' to extended-qualifier status. Audit our
use of qualifiers and fix a few places that weren't dealing with qualifiers
quite right; many more remain.
llvm-svn: 82705
2009-09-24 19:53:00 +00:00
John McCall
9dd450bb78
Change all the Type::getAsFoo() methods to specializations of Type::getAs().
...
Several of the existing methods were identical to their respective
specializations, and so have been removed entirely. Several more 'leaf'
optimizations were introduced.
The getAsFoo() methods which imposed extra conditions, like
getAsObjCInterfacePointerType(), have been left in place.
llvm-svn: 82501
2009-09-21 23:43:11 +00:00
Fariborz Jahanian
71848a3ff1
Removed -fobjc-newgc-api option. clang now conforms to
...
gcc-style write-barrier api only.
llvm-svn: 82493
2009-09-21 23:03:37 +00:00
Fariborz Jahanian
38c3ae9bc4
Miscellanous fixes in generatation of objc gc's write-barriers.
...
llvm-svn: 82472
2009-09-21 18:54:29 +00:00
Fariborz Jahanian
2e32ddc7ba
Fixed a bug in generation of the new write-barriers when
...
array syntax is used to derefernce and assign to ivar pointee.
llvm-svn: 82183
2009-09-18 00:04:00 +00:00
Fariborz Jahanian
de1d324dce
patch for generating objc'2 objc_assign_ivar. WIP.
...
llvm-svn: 82090
2009-09-16 23:11:23 +00:00
Fariborz Jahanian
a7fa6beb2e
Starting patch to generate more specific API for objc's
...
GC. Currently, new API will be generated under
clang-cc's -fobjc-newgc-api flag which will eventually
become the default. WIP.
llvm-svn: 82082
2009-09-16 21:37:16 +00:00
Fariborz Jahanian
4141deb68e
Removed a superfluous check before setting
...
a flag (objc GC).
llvm-svn: 82052
2009-09-16 16:49:08 +00:00
Anders Carlsson
1450adbbf9
Code generation of Conditional operators that are lvalues (but that aren't bitfields).
...
llvm-svn: 81867
2009-09-15 16:35:24 +00:00
Anders Carlsson
96bad9a5cd
Implement CodeGenFunction::EmitCXXExprWithTemporariesLValue.
...
llvm-svn: 81738
2009-09-14 01:10:45 +00:00
Daniel Dunbar
0482cfd790
Don't use the PredefinedExpr string as the global variable name, these don't
...
make very nice symbols, just use the function name.
llvm-svn: 81653
2009-09-12 23:06:21 +00:00
Anders Carlsson
d95f9608ab
Handle CK_DerivedToBase when emitting lvalue casts.
...
llvm-svn: 81614
2009-09-12 16:16:49 +00:00
Anders Carlsson
f8e94f2008
Add support for __block variables with alignment greater than __alignof(void *).
...
llvm-svn: 81602
2009-09-12 02:44:18 +00:00