summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGExpr.cpp
Commit message (Collapse)AuthorAgeFilesLines
* objc gc: assigning to an objc object struct member through an ivar Fariborz Jahanian2011-09-301-8/+20
| | | | | | pointer to this struct must go through the none ivar writer barrier. llvm-svn: 140867
* Rename EmitStopPoint in CGDebugInfo to EmitLocation. "stop points" don'tEric Christopher2011-09-291-1/+1
| | | | | | exist anymore. llvm-svn: 140739
* Call UpdateLineDirectiveRegion every time we want to emit a stopEric Christopher2011-09-291-1/+0
| | | | | | | point in the code. Ensures that we don't miss any places and the check is reasonably cheap. llvm-svn: 140737
* de-tmpify clang.Benjamin Kramer2011-09-271-16/+16
| | | | llvm-svn: 140637
* Removing a bunch of dead returns/breaks after llvm_unreachables.David Blaikie2011-09-231-1/+0
| | | | llvm-svn: 140407
* Switch assert(0/false) llvm_unreachable.David Blaikie2011-09-231-6/+7
| | | | llvm-svn: 140367
* ANSI C requires that a call to an unprototyped function type succeedJohn McCall2011-09-211-2/+30
| | | | | | | | | | | | | | | | | if the definition has a non-variadic prototype with compatible parameters. Therefore, the default rule for such calls must be to use a non-variadic convention. Achieve this by casting the callee to the function type with which it is required to be compatible, unless the target specifically opts out and insists that unprototyped calls should use the variadic rules. The only case of that I'm aware of is the x86-64 convention, which passes arguments the same way in both cases but also sets a small amount of extra information; here we seek to maintain compatibility with GCC, which does set this when calling an unprototyped function. Addresses PR10810 and PR10713. llvm-svn: 140241
* Switch LangOptions over to a .def file that describes header of theDouglas Gregor2011-09-131-3/+3
| | | | | | | | | | language options. Use that .def file to declare the LangOptions class and initialize all of its members, eliminating a source of annoying initialization bugs. AST serialization changes are next up. llvm-svn: 139605
* Rename the ARC cast kinds to start with "ARC".John McCall2011-09-101-4/+4
| | | | llvm-svn: 139466
* When converting a block pointer to an Objective-C pointer type, extendJohn McCall2011-09-101-1/+2
| | | | | | | | | | | the lifetime of the block by copying it to the heap, or else we'll get a dangling reference because the code working with the non-block-typed object will not know it needs to copy. There is some danger here, e.g. with assigning a block literal to an unsafe variable, but, well, it's an unsafe variable. llvm-svn: 139451
* Bring llvm.annotation* intrinsics support back to where it was in llvm-gcc: canJulien Lerouge2011-09-091-0/+3
| | | | | | | annotate global, local variables, struct fields, or arbitrary statements (using the __builtin_annotation), rdar://8037476. llvm-svn: 139423
* Give conversions of block pointers to ObjC pointers a different cast kindJohn McCall2011-09-091-1/+2
| | | | | | | | than conversions of C pointers to ObjC pointers. In order to ensure that we've caught every case, add asserts to CastExpr that strictly determine which cast kind is used for which kind of bit cast. llvm-svn: 139352
* Formatting.Eric Christopher2011-09-081-1/+2
| | | | llvm-svn: 139296
* When extracting the callee declaration from a call expression, be sureDouglas Gregor2011-09-061-8/+4
| | | | | | | | | | to look through SubstNonTypeTemplateParmExprs. Then, update the IR generation of CallExprs to actually use CallExpr::getCalleeDecl() rather than attempting to mimick its behavior (badly). Fixes <rdar://problem/10063539>. llvm-svn: 139185
* Slight optimization enabled by the previous assert: John McCall2011-08-261-2/+1
| | | | | | emit all gl-value arguments as reference bindings. llvm-svn: 138655
* What say we document some of these AggValueSlot flags a bitJohn McCall2011-08-261-1/+1
| | | | | | better. llvm-svn: 138628
* An initialization does not alias.John McCall2011-08-261-1/+2
| | | | llvm-svn: 138624
* Track whether an AggValueSlot is potentially aliased, and do notJohn McCall2011-08-251-1/+2
| | | | | | | | | | emit call results into potentially aliased slots. This allows us to properly mark indirect return slots as noalias, at the cost of requiring an extra memcpy when assigning an aggregate call result into a l-value. It also brings us into compliance with the x86-64 ABI. llvm-svn: 138599
* Use stronger typing for the flags on AggValueSlot and requireJohn McCall2011-08-251-2/+7
| | | | | | | creators to tell us whether something needs GC barriers. No functionality change. llvm-svn: 138581
* remove unneeded llvm:: namespace qualifiers on some core types now that ↵Chris Lattner2011-07-231-14/+14
| | | | | | | | LLVM.h imports them into the clang namespace. llvm-svn: 135852
* Convert IRBuilder::CreateGEP and IRBuilder::CreateInBoundsGEP to useJay Foad2011-07-221-2/+2
| | | | | | ArrayRef. llvm-svn: 135761
* as eli points out, we're not doing memory stuff here. While ConvertType Chris Lattner2011-07-201-1/+1
| | | | | | | and ConvertTypeForMem are the same for pointers, it is best to just use ConvertType. Thanks Eli! llvm-svn: 135567
* de-constify llvm::Type, patch by David Blaikie!Chris Lattner2011-07-181-13/+13
| | | | llvm-svn: 135370
* Create a new expression node, SubstNonTypeTemplateParmExpr,John McCall2011-07-151-0/+2
| | | | | | | | to represent a fully-substituted non-type template parameter. This should improve source fidelity, as well as being generically useful for diagnostics and such. llvm-svn: 135243
* Change intrinsic getter to take an ArrayRef, now that the underlying ↵Benjamin Kramer2011-07-141-3/+2
| | | | | | function in LLVM does. llvm-svn: 135155
* Add more compiler workarounds. Should fix the build with old GCCs and MSVC.Benjamin Kramer2011-07-121-6/+10
| | | | llvm-svn: 134995
* Switch field destruction over to use the new destroyer-based APIJohn McCall2011-07-121-17/+25
| | | | | | and kill a lot of redundant code. llvm-svn: 134988
* Work around a problem with a static helper's formulation in releaseChandler Carruth2011-07-121-5/+5
| | | | | | | | | | | | | | | builds introduced in r134972: lib/CodeGen/CGExpr.cpp:1294:7: error: no matching function for call to 'EmitBitCastOfLValueToProperType' lib/CodeGen/CGExpr.cpp:1278:1: note: candidate function not viable: no known conversion from 'CGBuilderTy' (aka 'IRBuilder<false>') to 'llvm::IRBuilder<> &' for 1st argument This fixes the issue by passing CodeGenFunction on down, and using its builder directly rather than passing just the builder down. This may not be the best / cleanest fix, Chris please review. It at least fixes builds. llvm-svn: 134977
* Fix a problem Eli ran into where we now reject incomplete arrays of Chris Lattner2011-07-121-6/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | uncompleted struct types. We now do what llvm-gcc does and compile them into [i8 x 0]. If the type is later completed, we make sure that it is appropriately cast. We compile the terrible example to something like this now: %struct.A = type { i32, i32, i32 } @g = external global [0 x i8] define void @_Z1fv() nounwind { entry: call void @_Z3fooP1A(%struct.A* bitcast ([0 x i8]* @g to %struct.A*)) ret void } declare void @_Z3fooP1A(%struct.A*) define %struct.A* @_Z2f2v() nounwind { entry: ret %struct.A* getelementptr inbounds ([0 x %struct.A]* bitcast ([0 x i8]* @g to [0 x %struct.A]*), i32 0, i64 1) } llvm-svn: 134972
* enhance EmitLValueForFieldInitialization to do the proper pointer ↵Chris Lattner2011-07-101-9/+9
| | | | | | | | adjustment, allowing us to revert the other half of r134860. Now things are back to a relatively tidy state. llvm-svn: 134865
* revert part of r134860, which is empirically unnecessary after the proper fixChris Lattner2011-07-101-4/+0
| | | | llvm-svn: 134864
* change EmitLValueForField to cast the returned lvalue to the rightChris Lattner2011-07-101-13/+18
| | | | | | | type, even when in the struct case. This was one root issue that was causing type mismatches throughout the compiler. llvm-svn: 134862
* when emitting pointer load from an lvalue or storing to an lvalue,Chris Lattner2011-07-101-0/+12
| | | | | | | do an explicit bitcast to whatever ConvertType produces. This will go with the next patch. llvm-svn: 134860
* clang side to match the LLVM IR type system rewrite patch.Chris Lattner2011-07-091-1/+1
| | | | llvm-svn: 134831
* In ARC, reclaim all return values of retainable type, not just thoseJohn McCall2011-07-071-1/+2
| | | | | | | | | | | | where we have an immediate need of a retained value. As an exception, don't do this when the call is made as the immediate operand of a __bridge retain. This is more in the way of a workaround than an actual guarantee, so it's acceptable to be brittle here. rdar://problem/9504800 llvm-svn: 134605
* Sort #includes.Nick Lewycky2011-07-071-1/+1
| | | | llvm-svn: 134589
* Fix PR10204 in a better way.John McCall2011-06-271-3/+1
| | | | llvm-svn: 133943
* Revert parts of r133860 to fix a crash. Add a test.Nico Weber2011-06-271-1/+3
| | | | llvm-svn: 133931
* LValue carries a type now, so simplify the main EmitLoad/Store APIsJohn McCall2011-06-251-35/+24
| | | | | | by removing the redundant type parameter. llvm-svn: 133860
* Mark the multiply which occurs as part of performing pointerJohn McCall2011-06-251-4/+9
| | | | | | | | arithmetic on a VLA as 'nsw', per discussion with djg, and implement pointer arithmetic (other than array accesses) and pointer subtraction for VLA types. llvm-svn: 133855
* Change the IR-generation of VLAs so that we capture bounds,John McCall2011-06-241-7/+8
| | | | | | | not sizes; so that we use well-typed allocas; and so that we properly recurse through the full set of variably-modified types. llvm-svn: 133827
* When binding a reference to an Automatic Reference Counting temporary,Douglas Gregor2011-06-221-32/+65
| | | | | | | | | retain/release the temporary object appropriately. Previously, we would only perform the retain/release operations when the reference would extend the lifetime of the temporary, but this does the wrong thing across calls. llvm-svn: 133620
* A few tweaks to MaterializeTemporaryExpr suggested by John.Douglas Gregor2011-06-211-3/+1
| | | | llvm-svn: 133528
* Introduce a new AST node describing reference binding to temporaries.Douglas Gregor2011-06-211-1/+17
| | | | | | | | | | | | | | | | | | | | | | | | | MaterializeTemporaryExpr captures a reference binding to a temporary value, making explicit that the temporary value (a prvalue) needs to be materialized into memory so that its address can be used. The intended AST invariant here is that a reference will always bind to a glvalue, and MaterializeTemporaryExpr will be used to convert prvalues into glvalues for that binding to happen. For example, given const int& r = 1.0; The initializer of "r" will be a MaterializeTemporaryExpr whose subexpression is an implicit conversion from the double literal "1.0" to an integer value. IR generation benefits most from this new node, since it was previously guessing (badly) when to materialize temporaries for the purposes of reference binding. There are likely more refactoring and cleanups we could perform there, but the introduction of MaterializeTemporaryExpr fixes PR9565, a case where IR generation would effectively bind a const reference directly to a bitfield in a struct. Addresses <rdar://problem/9552231>. llvm-svn: 133521
* Remove dead variables.Benjamin Kramer2011-06-181-3/+0
| | | | llvm-svn: 133346
* 80 cols.Benjamin Kramer2011-06-181-5/+5
| | | | llvm-svn: 133345
* Restore correct use of GC barriers.John McCall2011-06-161-13/+25
| | | | llvm-svn: 133144
* Automatic Reference Counting.John McCall2011-06-151-26/+190
| | | | | | | | | | Language-design credit goes to a lot of people, but I particularly want to single out Blaine Garst and Patrick Beard for their contributions. Compiler implementation credit goes to Argyrios, Doug, Fariborz, and myself, in no particular order. llvm-svn: 133103
* Use isAnyComplexType here so we don't pass complex numbers into the ↵Eli Friedman2011-06-151-1/+1
| | | | | | aggregate handling code; found by inspection. llvm-svn: 133070
* fix 80 col violationChris Lattner2011-05-221-1/+2
| | | | llvm-svn: 131870
OpenPOWER on IntegriCloud