summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGBlocks.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix the required args count for variadic blocks.John McCall2012-12-071-1/+1
| | | | | | | | | | | | | | | | | We were emitting calls to blocks as if all arguments were required --- i.e. with signature (A,B,C,D,...) rather than (A,B,...). This patch fixes that and accounts for the implicit block-context argument as a required argument. In addition, this patch changes the function type under which we call unprototyped functions on platforms like x86-64 that guarantee compatibility of variadic functions with unprototyped function types; previously we would always call such functions under the LLVM type T (...)*, but now we will call them under the type T (A,B,C,D,...)*. This last change should have no material effect except for making the type conventions more explicit; it was a side-effect of the most convenient implementation. llvm-svn: 169588
* objective-c blocks: Consider padding due to alignmentFariborz Jahanian2012-12-041-5/+13
| | | | | | | after the fixed size block header when generating captured block variable info. // rdar://12773256 llvm-svn: 169285
* Sort all of Clang's files under 'lib', and fix up the broken headersChandler Carruth2012-12-041-3/+3
| | | | | | | | | | | | | uncovered. This required manually correcting all of the incorrect main-module headers I could find, and running the new llvm/utils/sort_includes.py script over the files. I also manually added quite a few missing headers that were uncovered by shuffling the order or moving headers up to be main-module-headers. llvm-svn: 169237
* objective-C blocks: Make sure that identical logic is usedFariborz Jahanian2012-11-281-3/+2
| | | | | | | | | | in deciding a copy/dispose field is needed in a byref structure and when generating the copy/dispose helpers. In certain cases, these fields were being added but no copy/dispose was being generated. This was uncovered in ARC, but not in MRR. // rdar://12759433 llvm-svn: 168825
* A step towards sorting out handling of triviality of special members in C++11.Richard Smith2012-11-161-1/+1
| | | | | | | | | | | | | | Separate out the notions of 'has a trivial special member' and 'has a non-trivial special member', and use them appropriately. These are not opposites of one another (there might be no special member, or in C++11 there might be a trivial one and a non-trivial one). The CXXRecordDecl predicates continue to produce incorrect results, but do so in fewer cases now, and they document the cases where they might be wrong. No functionality changes are intended here (they will come when the predicates start producing the right answers...). llvm-svn: 168119
* fixes a buildbot failure.Fariborz Jahanian2012-11-141-0/+1
| | | | llvm-svn: 167934
* objective-C blocks: Provide layout map for byrefFariborz Jahanian2012-11-141-5/+72
| | | | | | variables captured in a block. // rdar://12184410 llvm-svn: 167931
* objective-C block meta-data. This patch completes meta-dataFariborz Jahanian2012-11-011-2/+7
| | | | | | | | generation for captured block variables in arc mode. This includes inlined version of the meta-data when it can be done. It also includes severat tests. This is wip. // rdar://12184410. llvm-svn: 167241
* objective-C arc/mrr: Patch for the new block variable layout meta-data.Fariborz Jahanian2012-10-271-2/+6
| | | | | | It is currently off (so no tests). This is wip. llvm-svn: 166892
* Provide comment describing what buildBlockDescriptor does.Fariborz Jahanian2012-10-251-1/+12
| | | | llvm-svn: 166703
* Initialize debug info for special cases of functions that lack declarations ↵Alexey Samsonov2012-10-251-0/+4
| | | | | | and are generated by Clang (global initializers/destructors, thunks) . Fixes PR13942. llvm-svn: 166676
* Switch CodeGenOptions over to a .def file, like we do with LangOptions.Douglas Gregor2012-10-231-1/+2
| | | | llvm-svn: 166497
* At -O0, prefer objc_storeStrong with a null new value to theJohn McCall2012-10-171-24/+64
| | | | | | | | | | | combination of a load+objc_release; this is generally better for tools that try to track why values are retained and released. Also use objc_storeStrong when copying a block (again, only at -O0), which requires us to do a preliminary store of null in order to compensate for objc_storeStrong's assign semantics. llvm-svn: 166085
* Transform pattern:Alexey Samsonov2012-10-161-6/+3
| | | | | | | | | | | if (CGM.getModuleDebugInfo()) DebugInfo = CGM.getModuleDebugInfo() into a call: maybeInitializeDebugInfo(); This is a simplification for a possible future fix of PR13942. llvm-svn: 166019
* Move TargetData to DataLayout.Micah Villmow2012-10-081-2/+2
| | | | llvm-svn: 165395
* Distinguish more carefully between free functions and C++ instance methodsJohn McCall2012-07-071-1/+1
| | | | | | | | in the ABI arrangement, and leave a hook behind so that we can easily tweak CCs on platforms that use different CCs by default for C++ instance methods. llvm-svn: 159894
* block literal irgen: several improvements on naming blockFariborz Jahanian2012-06-261-2/+3
| | | | | | | | | | | | literal helper functions. All helper functions (global and locals) use block_invoke as their prefix. Local literal helper names are prefixed by their enclosing mangled function names. Blocks in non-local initializers (e.g. a global variable or a C++11 field) are prefixed by their mangled variable name. The descriminator number added to end of the name starts off with blank (for first block) and _<N> (for the N+2-th block). llvm-svn: 159206
* Fix code generation of variables reference expressions when mixingDouglas Gregor2012-05-161-1/+1
| | | | | | | blocks and lambdas, based heavily on a patch from Meador Inge. Fixes PR12746 / <rdar://problem/11465120>. llvm-svn: 156925
* This patch adds a new Clang compiler flag "-gline-tables-only".Alexey Samsonov2012-05-041-8/+10
| | | | | | | | | | | | | | It reduces the amount of emitted debug information: 1) DIEs in .debug_info have types DW_TAG_compile_unit, DW_TAG_subprogram, DW_TAG_inlined_subroutine (for opt builds) and DW_TAG_lexical_block only. 2) .debug_str contains only function names. 3) No debug data for types/namespaces/variables is emitted. 4) The data in .debug_line is enough to produce valid stack traces with function names and line numbers. Reviewed by Eric Christopher. llvm-svn: 156160
* During block layout, after padding up to the max field alignment,John McCall2012-05-011-1/+2
| | | | | | | the alignment might actually exceed the max field alignment; don't assert in this case. llvm-svn: 155937
* Fix a bug with block layout when the block contains somethingJohn McCall2012-04-261-5/+8
| | | | | | | | | | | | more aligned than the block header but also contains something smaller than the block-header alignment but not exactly half the difference between the large alignment and the header alignment. Got that? I'm really not sure what I was thinking with the buggy computation here, but the fix is pretty obvious. llvm-svn: 155662
* Don't enter cleanups for unreachable variables. It's impossible toJohn McCall2012-04-131-0/+2
| | | | | | | | jump into these scopes, and the cleanup-entering code sometimes wants to do some operations first (e.g. a GEP), which can leave us with unparented IR. llvm-svn: 154684
* These functions too have no prototypes. Audited the rest of Sema forEric Christopher2012-04-121-2/+2
| | | | | | | | FunctionDecl::Create calls as well. rdar://11079003 llvm-svn: 154578
* The copy and destroy helper functions aren't prototyped, don't call themEric Christopher2012-04-121-2/+2
| | | | | | so. llvm-svn: 154569
* Don't crash (assert failure) when generating blocks for C++ types with a ↵David Chisnall2012-04-041-1/+2
| | | | | | | | non-const copy constructor. This was caused by the code deciding the number of fields in the byref structure using a different test to the part of the code creating the GEPs into said structure. llvm-svn: 154013
* Revert r153613 as it's causing large compile-time regressions on the nightly ↵Chad Rosier2012-03-291-2/+1
| | | | | | testers. llvm-svn: 153660
* When we can't prove that the target of an aggregate copy isJohn McCall2012-03-281-1/+2
| | | | | | | a complete object, the memcpy needs to use the data size of the structure instead of its sizeof() value. Fixes PR12204. llvm-svn: 153613
* Unify naming of LangOptions variable/get function across the Clang stack ↵David Blaikie2012-03-111-8/+8
| | | | | | | | | | (Lex to AST). The member variable is always "LangOpts" and the member function is always "getLangOpts". Reviewed by Chris Lattner llvm-svn: 152536
* Remove BlockDeclRefExpr and introduce a bit on DeclRefExpr toJohn McCall2012-03-101-10/+6
| | | | | | | | track whether the referenced declaration comes from an enclosing local context. I'm amenable to suggestions about the exact meaning of this bit. llvm-svn: 152491
* Implement "optimization" for lambda-to-block conversion which inlines the ↵Eli Friedman2012-03-011-6/+18
| | | | | | | | generated block literal for lambdas which are immediately converted to block pointer type. This simplifies the AST, avoids an unnecessary copy of the lambda and makes it much easier to avoid copying the result onto the heap. Note that this transformation has a substantial semantic effect outside of ARC: it gives the converted lambda lifetime semantics similar to a block literal. With ARC, the effect is much less obvious because the lifetime of blocks is already managed. llvm-svn: 151797
* Work-in-progress for lambda conversion-to-block operator. Still need to ↵Eli Friedman2012-02-251-4/+15
| | | | | | implement the retain+autorelease outside of ARC, and there's a bug that causes the generated code to crash in ARC (which I think is unrelated to my code, although I'm not completely sure). llvm-svn: 151428
* Whether an argument is required (in contrast with being anJohn McCall2012-02-171-17/+24
| | | | | | | | | | | | | | | | | | | | | optional argument passed through the variadic ellipsis) potentially affects how we need to lower it. Propagate this information down to the various getFunctionInfo(...) overloads on CodeGenTypes. Furthermore, rename those overloads to clarify their distinct purposes, and make sure we're calling the right one in the right place. This has a nice side-effect of making it easier to construct a function type, since the 'variadic' bit is no longer separable. This shouldn't really change anything for our existing platforms, with one minor exception --- we should now call variadic ObjC methods with the ... in the "right place" (see the test case), which I guess matters for anyone running GNUStep on MIPS. Mostly it's just a substantial clean-up. llvm-svn: 150788
* simplify a bunch of code to use the well-known LLVM IR types computed by ↵Chris Lattner2012-02-071-1/+1
| | | | | | CodeGenModule. llvm-svn: 149943
* Basic: import OwningPtr<> into clang namespaceDylan Noblesmith2012-02-051-1/+1
| | | | llvm-svn: 149798
* Use function pointers, rather than references, to pass DestroyersPeter Collingbourne2012-01-261-3/+3
| | | | | | | around, in the process cleaning up the various gcc/msvc compiler workarounds. llvm-svn: 149036
* constexpr irgen: Add irgen support for APValue::Struct, APValue::Union,Richard Smith2012-01-141-6/+8
| | | | | | | | | | | | | | | | | | | | APValue::Array and APValue::MemberPointer. All APValue values can now be emitted as constants. Add new CGCXXABI entry point for emitting an APValue MemberPointer. The other entrypoints dealing with constant member pointers are no longer necessary and will be removed in a later change. Switch codegen from using EvaluateAsRValue/EvaluateAsLValue to VarDecl::evaluateValue. This performs caching and deals with the nasty cases in C++11 where a non-const object's initializer can refer indirectly to previously-initialized fields within the same object. Building the intermediate APValue object incurs a measurable performance hit on pathological testcases with huge initializer lists, so we continue to build IR directly from the Expr nodes for array and record types outside of C++11. llvm-svn: 148178
* Switch LValue so that it exposes alignment in CharUnits. (No functional ↵Eli Friedman2011-12-031-2/+1
| | | | | | change.) llvm-svn: 145753
* Whenever explicitly activating or deactivating a cleanup, weJohn McCall2011-11-101-2/+7
| | | | | | | | | | need to provide a 'dominating IP' which is guaranteed to dominate the (de)activation point but which cannot be avoided along any execution path from the (de)activation point to the push-point of the cleanup. Using the entry block is bad mojo. llvm-svn: 144276
* Enter the cleanups for a block outside the enclosingJohn McCall2011-11-101-40/+144
| | | | | | | | | | | | full-expression. Naturally they're inactive before we enter the block literal expression. This restores the intended behavior that blocks belong to their enclosing scope. There's a useful -O0 / compile-time optimization that we're missing here with activating cleanups following straight-line code from their inactive beginnings. llvm-svn: 144268
* Emit the copy and dipose helpers for ARC __strongJohn McCall2011-11-091-10/+48
| | | | | | | | | | | | | | | | | | | | block-typed __block variables using objc_retainBlock and objc_dispose. Previously we were using _Block_object_assign and _Block_object_destroy with BLOCK_BYREF_CALLER, which causes the runtime to completely ignore the retain and release. In most cases this doesn't cause catastrophe because the retain/release are balanced and because the block in the variable was copied upon assignment there. However, the stack copy of the variable will be released when it goes out of scope, which is a problem if that value was released due to an assignment to the heap copy. Similarly, a leak can occur if the variable is assigned after the copy to the heap. llvm-svn: 144162
* back out changes in r143399 and r143475.Fariborz Jahanian2011-11-021-15/+9
| | | | | | | rvale-references are captured by reference in blocks. // rdar://9971124. llvm-svn: 143583
* Adds IRGen support for captured rvalue references in blocks.Fariborz Jahanian2011-10-311-11/+19
| | | | | | | In this case, temporary value is copied into block descriptor as their own copy to work on. // rdar://9971124 llvm-svn: 143399
* Recommit:Eric Christopher2011-10-131-1/+1
| | | | | | | | | | | | | | | Start handling debug line and scope information better: Migrate most of the location setting within the larger API in CGDebugInfo and update a lot of callers. Remove the existing file/scope change machinery in UpdateLineDirectiveRegion and replace it with DILexicalBlockFile usage. Finishes off the rest of rdar://10246360 after fixing a few bugs that were exposed in gdb testsuite testing. llvm-svn: 141893
* Revert file/scope handling patches. gdb testing revealed a couple of bugs.Eric Christopher2011-10-121-1/+1
| | | | llvm-svn: 141796
* Start handling debug line and scope information better:Eric Christopher2011-10-111-1/+1
| | | | | | | | | | | Migrate most of the location setting within the larger API in CGDebugInfo and update a lot of callers. Remove the existing file/scope change machinery in UpdateLineDirectiveRegion and replace it with DILexicalBlockFile usage. Finishes off the rest of rdar://10246360 llvm-svn: 141732
* Minor cleanup.Eli Friedman2011-09-301-4/+3
| | | | llvm-svn: 140866
* de-tmpify clang.Benjamin Kramer2011-09-271-3/+3
| | | | llvm-svn: 140637
* Switch LangOptions over to a .def file that describes header of theDouglas Gregor2011-09-131-1/+1
| | | | | | | | | | 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
* Treat the weak export of block runtime symbols as a deployment-targetJohn McCall2011-09-091-0/+55
| | | | | | | | feature akin to the ARC runtime checks. Removes a terrible hack where IR gen needed to find the declarations of those symbols in the translation unit. llvm-svn: 139404
* switch clang to use the new-new way of creating llvm::StructType's.Chris Lattner2011-08-121-11/+7
| | | | llvm-svn: 137472
OpenPOWER on IntegriCloud