Commit Graph

377 Commits

Author SHA1 Message Date
Adrian Prantl 22e66b434a Cleanup: Add default arguments to CodeGenFunction::StartFunction.
Thanks dblaikie for the suggestion!

llvm-svn: 206012
2014-04-11 01:13:04 +00:00
Adrian Prantl 42d71b9906 Debug info: (Bugfix) Make sure artificial functions like _GLOBAL__I_a
are not associated with any source lines.

Previously, if the Location of a Decl was empty, EmitFunctionStart would
just keep using CurLoc, which would sometimes be correct (e.g., thunks)
but in other cases would just point to a hilariously random location.

This patch fixes this by completely eliminating all uses of CurLoc from
EmitFunctionStart and rather have clients explicitly pass in a
SourceLocation for the function header and the function body.

rdar://problem/14985269

llvm-svn: 205999
2014-04-10 23:21:53 +00:00
Tim Northover e77cc39aff ObjC: allow targets to decide when to use stret for blocks.
This was originally part of the ARM64 patch, but seems semantically
separate.

llvm-svn: 205097
2014-03-29 13:28:05 +00:00
Duncan P. N. Exon Smith 2fe531cb07 PGO: Statically generate data structures
In instrumentation-based profiling, we need a set of data structures to
represent the counters.  Previously, these were built up during static
initialization.  Now, they're shoved into a specially-named section so
that they show up as an array.

As a consequence of the reorganizing symbols, instrumentation data
structures for linkonce functions are now correctly coalesced.

This is the first step in a larger project to minimize runtime overhead
and dependencies in instrumentation-based profilng.  The larger picture
includes removing all initialization overhead and making the dependency
on libc optional.

<rdar://problem/15943240>

llvm-svn: 204080
2014-03-17 21:18:30 +00:00
Aaron Ballman 9371dd2287 [C++11] Replacing BlockDecl iterators capture_begin() and capture_end() with iterator_range captures(). Updating all of the usages of the iterators with range-based for loops.
llvm-svn: 203958
2014-03-14 18:34:04 +00:00
Craig Topper 4f12f10de4 [C++11] Add 'override' keyword to virtual methods that override their base class.
llvm-svn: 203643
2014-03-12 06:41:41 +00:00
Ahmed Charles b89843299a Replace OwningPtr with std::unique_ptr.
This compiles cleanly with lldb/lld/clang-tools-extra/llvm.

llvm-svn: 203279
2014-03-07 20:03:18 +00:00
Aaron Ballman b2b8b1dc66 [C++11] Replacing BlockDecl iterators param_begin() and param_end() with iterator_range params(). Updating all of the usages of the iterators with range-based for loops.
llvm-svn: 203250
2014-03-07 16:09:59 +00:00
Bob Wilson c845c00a5b PGO: Add support for Objective-C blocks.
llvm-svn: 203157
2014-03-06 20:24:27 +00:00
Chandler Carruth c80ceea90b [Modules] Update to reflect the move of CallSite into the IR library in
LLVM r202816.

llvm-svn: 202817
2014-03-04 11:02:08 +00:00
Benjamin Kramer 867ea1d426 [C++11] Replace llvm::tie with std::tie.
llvm-svn: 202639
2014-03-02 13:01:17 +00:00
Reid Kleckner 4982b82b73 [ms-cxxabi] Use x86_cdeclmethodcc for __cdecl methods on win32
This fixes PR15768, where the sret parameter and the 'this' parameter
are in the wrong order.

Instance methods compiled by MSVC never return records in registers,
they always return indirectly through an sret pointer.  That sret
pointer always comes after the 'this' parameter, for both __cdecl and
__thiscall methods.

Unfortunately, the same is true for other calling conventions, so we'll
have to change the overall approach here relatively soon.

Reviewers: rsmith

Differential Revision: http://llvm-reviews.chandlerc.com/D2664

llvm-svn: 200587
2014-01-31 22:54:50 +00:00
Alp Toker 314cc81b8c Rename getResultType() on function and method declarations to getReturnType()
A return type is the declared or deduced part of the function type specified in
the declaration.

A result type is the (potentially adjusted) type of the value of an expression
that calls the function.

Rule of thumb:

  * Declarations have return types and parameters.
  * Expressions have result types and arguments.

llvm-svn: 200082
2014-01-25 16:55:45 +00:00
Alp Toker f6a24ce40f Fix a tranche of comment, test and doc typos
llvm-svn: 196510
2013-12-05 16:25:25 +00:00
Nick Lewycky 2d84e84236 Thread a SourceLocation into the EmitCheck for "load_invalid_value". This occurs
when scalars are loaded / undergo lvalue-to-rvalue conversion.

llvm-svn: 191808
2013-10-02 02:29:49 +00:00
David Blaikie 92848dee31 Simplify/clean up debug info suppression in CodeGenFunction
CodeGenFunction is run on only one function - a new object is made for
each new function. I would add an assertion/flag to this effect, but
there's an exception: ObjC properties involve emitting helper functions
that are all emitted by the same CodeGenFunction object, so such a check
is not possible/correct.

llvm-svn: 189277
2013-08-26 20:33:21 +00:00
Adrian Prantl 49a78563d2 Debug Info: Fix an oversight of r186553. Ensure that the function prologue
of an artificial function gets an artificial location as well.

llvm-svn: 187074
2013-07-24 20:34:39 +00:00
Adrian Prantl b75016d299 s/BuiltinLocation/ArtificialLocation/
llvm-svn: 186557
2013-07-18 01:36:04 +00:00
Adrian Prantl 01eb2a53c7 Don't generate bogus line table entries for __copy_helper_block_ and
__destroy_helper_block_, but do generate scope information.

llvm-svn: 186553
2013-07-18 00:28:05 +00:00
Adrian Prantl 2e0637ff63 Replace llvm::DIBuilder::DisableDebugLocations() with two RAII interfaces
inspired by CodegenFunction::LexicalScope.
- NoLocation temporarily turns off debug locations altogether.
  This is useful for emitting instructions that should be
  counted towards the function prologue.
- BuiltinLocation temporarily switches to an artificial debug location
  that has a valid scope, but no line information. This is useful when
  emitting compiler-generated helper functions that have no source
  location associated with them.

llvm-svn: 186552
2013-07-18 00:28:02 +00:00
Eli Friedman c6036aa831 Compute 'this' correctly for block in lambda.
Using CurFuncDecl is both correct and simple compared to crawling
the DeclContexts of the block.

Fixes <rdar://problem/14415072>.

llvm-svn: 186210
2013-07-12 22:05:26 +00:00
Dmitri Gribenko 6c96ba2dc0 Comment: use \code...\endcode for code examples
llvm-svn: 181481
2013-05-08 23:09:44 +00:00
Fariborz Jahanian 7e548f70e8 unbreak buildbot.
llvm-svn: 181479
2013-05-08 22:52:20 +00:00
John McCall dec348f7db Correctly emit certain implicit references to 'self' even within
a lambda.

Bug #1 is that CGF's CurFuncDecl was "stuck" at lambda invocation
functions.  Fix that by generally improving getNonClosureContext
to look through lambdas and captured statements but only report
code contexts, which is generally what's wanted.  Audit uses of
CurFuncDecl and getNonClosureAncestor for correctness.

Bug #2 is that lambdas weren't specially mapping 'self' when inside
an ObjC method.  Fix that by removing the requirement for that
and using the normal EmitDeclRefLValue path in LoadObjCSelf.

rdar://13800041

llvm-svn: 181000
2013-05-03 07:33:41 +00:00
Adrian Prantl f1b28a5dbc Use a more idiomatic way to disable debug locations.
llvm-svn: 180931
2013-05-02 17:30:16 +00:00
John McCall c8e0170578 Standardize accesses to the TargetInfo in IR-gen.
Patch by Stephen Lin!

llvm-svn: 179638
2013-04-16 22:48:15 +00:00
John McCall 4d14a90ac6 Don't copy just to capture a strong block pointer under ARC.
It turns out that the optimizer can't eliminate this without extra
information, for which there's a separate bug.

rdar://13588325

llvm-svn: 179069
2013-04-08 23:27:49 +00:00
Adrian Prantl 83e30fd80f fix indentation
llvm-svn: 179052
2013-04-08 20:52:12 +00:00
Rafael Espindola 6ae7e50be4 Add 178663 back.
http://lab.llvm.org:8011/builders/clang-x86_64-darwin10-gdb went back green
before it processed the reverted 178663, so it could not have been the culprit.

Revert "Revert 178663."

This reverts commit 4f8a3eb2ce5d4ba422483439e20c8cbb4d953a41.

llvm-svn: 178682
2013-04-03 19:27:57 +00:00
Rafael Espindola 985a3abee4 Revert 178663.
Looks like it broke http://lab.llvm.org:8011/builders/clang-x86_64-darwin10-gdb

Revert "Don't compute a patched/semantic storage class."

This reverts commit 8f187f62cb0487d31bc4afdfcd47e11fe9a51d05.

llvm-svn: 178681
2013-04-03 19:22:20 +00:00
Rafael Espindola adea16bd9e Don't compute a patched/semantic storage class.
For variables and functions clang used to store two storage classes. The one
"as written" in the code and a patched one, which, for example, propagates
static to the following decls.

This apparently is from the days clang lacked linkage computation. It is now
redundant and this patch removes it.

llvm-svn: 178663
2013-04-03 15:50:00 +00:00
Adrian Prantl 2832b4e8cb un-break remaining gdb buildbot testcases.
Make sure we do not generate line info for debugging-related frame setup.
Follow-up to r178361 / rdar://problem/12767564

llvm-svn: 178517
2013-04-02 01:00:48 +00:00
Adrian Prantl 0f6df00e4d Bugfix/Followup for r177086.
* Store the .block_descriptor (instead of self) in the alloca so we
  can guarantee that all captured variables are available at -O0.
* Add the missing OpDeref for the alloca.
rdar://problem/12767564

llvm-svn: 178361
2013-03-29 19:20:35 +00:00
Adrian Prantl 51936dd0bc Allocate stack storage for .block_descriptor and captured self at -O0.
This way the register allocator will not optimize away the debug info
for captured variables.

Fixes rdar://problem/12767564

llvm-svn: 177086
2013-03-14 17:53:33 +00:00
John McCall cdda29c968 Tighten up the rules for precise lifetime and document
the requirements on the ARC optimizer.

rdar://13407451

llvm-svn: 176924
2013-03-13 03:10:54 +00:00
John McCall a37c2fa409 Fix the emission of the copy-initialization of a block capture
from a lambda capture when the capture is not trivially-copyable.

rdar://13295759

llvm-svn: 176431
2013-03-04 06:32:36 +00:00
John McCall 882987f30c Use the actual ABI-determined C calling convention for runtime
calls and declarations.

LLVM has a default CC determined by the target triple.  This is
not always the actual default CC for the ABI we've been asked to
target, and so we sometimes find ourselves annotating all user
functions with an explicit calling convention.  Since these
calling conventions usually agree for the simple set of argument
types passed to most runtime functions, using the LLVM-default CC
in principle has no effect.  However, the LLVM optimizer goes
into histrionics if it sees this kind of formal CC mismatch,
since it has no concept of CC compatibility.  Therefore, if this
module happens to define the "runtime" function, or got LTO'ed
with such a definition, we can miscompile;  so it's quite
important to get this right.

Defining runtime functions locally is quite common in embedded
applications.

llvm-svn: 176286
2013-02-28 19:01:20 +00:00
John McCall f593b10d04 Use the correct field to copy/dispose a __block variable.
We were previously hard-coding a particular field index.  This was
fine before (because we were obviously guaranteed the presence
of a copy/dispose member) except for (1) alignment padding and
(2) future extensions adding extra members to the header, such
as the extended-layout pointer.

Note that we only introduce the extended-layout pointer in the
presence of structs.  (We also seem to be introducing it even
in the presence of an all-non-object layout, but that's a
different potential issue.)

llvm-svn: 173122
2013-01-22 03:56:22 +00:00
Fariborz Jahanian c889205567 objC block layout: Patch reorders block layout to
produce more inline layout metadata. // rdar://12752901

llvm-svn: 172683
2013-01-17 00:25:06 +00:00
Fariborz Jahanian cc2ae88e3c In my last patch initialize the destination to null (with a simple store) before doing a storeStrong to it.
// rdar://12530881

llvm-svn: 171572
2013-01-05 00:32:13 +00:00
Fariborz Jahanian a82e9265d8 objective-C arc: in copy helper function for
__strong __block variables, perform objc_storeStrong on
source and destination instead of direct move. This 
is done with -O0 and to improve some analysis.
// rdar://12530881

llvm-svn: 171555
2013-01-04 23:32:24 +00:00
Manman Ren ab08a9adab Debug Info: fix the line location for cleanup code of a block function
The line information was changed when emitting debug information for all the
DeclRefExprs and we should change it back to get ready for PopClenupBlocks
called from FinishFunction.

rdar://11562117

llvm-svn: 171493
2013-01-04 18:51:35 +00:00
Chandler Carruth ffd5551bc7 Rewrite #includes for llvm/Foo.h to llvm/IR/Foo.h as appropriate to
reflect the migration in r171366.

Re-sort the #include lines to reflect the new paths.

llvm-svn: 171369
2013-01-02 11:45:17 +00:00
John McCall c818bbb8b2 Fix the required args count for variadic blocks.
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
2012-12-07 07:03:17 +00:00
Fariborz Jahanian 4cf177e238 objective-c blocks: Consider padding due to alignment
after the fixed size block header when generating
captured block variable info. // rdar://12773256

llvm-svn: 169285
2012-12-04 17:20:57 +00:00
Chandler Carruth 3a02247dc9 Sort all of Clang's files under 'lib', and fix up the broken headers
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
2012-12-04 09:13:33 +00:00
Fariborz Jahanian 998f0a3360 objective-C blocks: Make sure that identical logic is used
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
2012-11-28 23:12:17 +00:00
Richard Smith 1648847248 A step towards sorting out handling of triviality of special members in C++11.
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
2012-11-16 00:53:38 +00:00
Fariborz Jahanian 983ae49a92 fixes a buildbot failure.
llvm-svn: 167934
2012-11-14 17:43:08 +00:00
Fariborz Jahanian a9d4464baf objective-C blocks: Provide layout map for byref
variables captured in a block. // rdar://12184410

llvm-svn: 167931
2012-11-14 17:15:51 +00:00
Fariborz Jahanian 23290b0570 objective-C block meta-data. This patch completes meta-data
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
2012-11-01 18:32:55 +00:00
Fariborz Jahanian 0c58ce9346 objective-C arc/mrr: Patch for the new block variable layout meta-data.
It is currently off (so no tests). This is wip.

llvm-svn: 166892
2012-10-27 21:10:38 +00:00
Fariborz Jahanian bf7bf29166 Provide comment describing what buildBlockDescriptor does.
llvm-svn: 166703
2012-10-25 18:06:53 +00:00
Alexey Samsonov 9b502e512c Initialize debug info for special cases of functions that lack declarations and are generated by Clang (global initializers/destructors, thunks) . Fixes PR13942.
llvm-svn: 166676
2012-10-25 10:18:50 +00:00
Douglas Gregor b0eea8b54b Switch CodeGenOptions over to a .def file, like we do with LangOptions.
llvm-svn: 166497
2012-10-23 20:05:01 +00:00
John McCall e68b8f4dcc At -O0, prefer objc_storeStrong with a null new value to the
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
2012-10-17 02:28:37 +00:00
Alexey Samsonov 38e2496497 Transform pattern:
if (CGM.getModuleDebugInfo())
    DebugInfo = CGM.getModuleDebugInfo()
into a call:
  maybeInitializeDebugInfo();

This is a simplification for a possible future fix of PR13942.

llvm-svn: 166019
2012-10-16 07:22:28 +00:00
Micah Villmow dd31ca10ef Move TargetData to DataLayout.
llvm-svn: 165395
2012-10-08 16:25:52 +00:00
John McCall 8dda7b27ee Distinguish more carefully between free functions and C++ instance methods
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
2012-07-07 06:41:13 +00:00
Fariborz Jahanian 6362803cfe block literal irgen: several improvements on naming block
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
2012-06-26 16:06:38 +00:00
Douglas Gregor 26b51746ec Fix code generation of variables reference expressions when mixing
blocks and lambdas, based heavily on a patch from Meador Inge. Fixes
PR12746 / <rdar://problem/11465120>.

llvm-svn: 156925
2012-05-16 16:50:20 +00:00
Alexey Samsonov 74a3868dbb This patch adds a new Clang compiler flag "-gline-tables-only".
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
2012-05-04 07:39:27 +00:00
John McCall 1db0a2fab2 During block layout, after padding up to the max field alignment,
the alignment might actually exceed the max field alignment;  don't
assert in this case.

llvm-svn: 155937
2012-05-01 20:28:00 +00:00
John McCall ac0350a396 Fix a bug with block layout when the block contains something
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
2012-04-26 21:14:42 +00:00
John McCall 8c38d35b05 Don't enter cleanups for unreachable variables. It's impossible to
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
2012-04-13 18:44:05 +00:00
Eric Christopher 0b1aef2bb0 These functions too have no prototypes. Audited the rest of Sema for
FunctionDecl::Create calls as well.

rdar://11079003

llvm-svn: 154578
2012-04-12 02:16:49 +00:00
Eric Christopher 56ef374611 The copy and destroy helper functions aren't prototyped, don't call them
so.

llvm-svn: 154569
2012-04-12 00:35:04 +00:00
David Chisnall 5221a947a5 Don't crash (assert failure) when generating blocks for C++ types with a 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
2012-04-04 13:07:13 +00:00
Chad Rosier 615ed1a3a6 Revert r153613 as it's causing large compile-time regressions on the nightly testers.
llvm-svn: 153660
2012-03-29 17:37:10 +00:00
John McCall 1a0877f99d When we can't prove that the target of an aggregate copy is
a complete object, the memcpy needs to use the data size of
the structure instead of its sizeof() value.  Fixes PR12204.

llvm-svn: 153613
2012-03-28 23:30:44 +00:00
David Blaikie bbafb8a745 Unify naming of LangOptions variable/get function across the Clang stack (Lex to AST).
The member variable is always "LangOpts" and the member function is always "getLangOpts".

Reviewed by Chris Lattner

llvm-svn: 152536
2012-03-11 07:00:24 +00:00
John McCall 113bee0536 Remove BlockDeclRefExpr and introduce a bit on DeclRefExpr to
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
2012-03-10 09:33:50 +00:00
Eli Friedman 98b01edc8c Implement "optimization" for lambda-to-block conversion which inlines the 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
2012-03-01 04:01:32 +00:00
Eli Friedman 2495ab08fc Work-in-progress for lambda conversion-to-block operator. Still need to 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
2012-02-25 02:48:22 +00:00
John McCall a729c62b81 Whether an argument is required (in contrast with being an
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
2012-02-17 03:33:10 +00:00
Chris Lattner ece0409a1a simplify a bunch of code to use the well-known LLVM IR types computed by CodeGenModule.
llvm-svn: 149943
2012-02-07 00:39:47 +00:00
Dylan Noblesmith e27789991d Basic: import OwningPtr<> into clang namespace
llvm-svn: 149798
2012-02-05 02:12:40 +00:00
Peter Collingbourne 1425b4556a Use function pointers, rather than references, to pass Destroyers
around, in the process cleaning up the various gcc/msvc compiler
workarounds.

llvm-svn: 149036
2012-01-26 03:33:36 +00:00
Richard Smith dafff94759 constexpr irgen: Add irgen support for APValue::Struct, APValue::Union,
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
2012-01-14 04:30:29 +00:00
Eli Friedman a0544d6fdf Switch LValue so that it exposes alignment in CharUnits. (No functional change.)
llvm-svn: 145753
2011-12-03 04:14:32 +00:00
John McCall f4beacd059 Whenever explicitly activating or deactivating a cleanup, we
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
2011-11-10 10:43:54 +00:00
John McCall 08ef466048 Enter the cleanups for a block outside the enclosing
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
2011-11-10 08:15:53 +00:00
John McCall 3a237aa31c Emit the copy and dipose helpers for ARC __strong
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
2011-11-09 03:17:26 +00:00
Fariborz Jahanian 10317eaa28 back out changes in r143399 and r143475.
rvale-references are captured by reference
in blocks. // rdar://9971124.

llvm-svn: 143583
2011-11-02 22:53:43 +00:00
Fariborz Jahanian f0cda63975 Adds IRGen support for captured rvalue references in blocks.
In this case, temporary value is copied into block descriptor
as their own copy to work on. // rdar://9971124

llvm-svn: 143399
2011-10-31 23:44:33 +00:00
Eric Christopher 7cdf948601 Recommit:
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
2011-10-13 21:45:18 +00:00
Eric Christopher 93663b3c62 Revert file/scope handling patches. gdb testing revealed a couple of bugs.
llvm-svn: 141796
2011-10-12 18:39:35 +00:00
Eric Christopher 498b7fd7fe 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

llvm-svn: 141732
2011-10-11 23:00:55 +00:00
Eli Friedman 1b87b29bfd Minor cleanup.
llvm-svn: 140866
2011-09-30 18:19:16 +00:00
Benjamin Kramer 76399eb2ad de-tmpify clang.
llvm-svn: 140637
2011-09-27 21:06:10 +00:00
Douglas Gregor 79a91418bd Switch LangOptions over to a .def file that describes header of the
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
2011-09-13 17:21:33 +00:00
John McCall 7959fee258 Treat the weak export of block runtime symbols as a deployment-target
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
2011-09-09 20:41:01 +00:00
Chris Lattner 5ec04a51fa switch clang to use the new-new way of creating llvm::StructType's.
llvm-svn: 137472
2011-08-12 17:43:31 +00:00
Eli Friedman f481ccafd8 Cleanup; no functionality change.
llvm-svn: 137126
2011-08-09 17:38:12 +00:00
Chris Lattner 0e62c1cc0b remove unneeded llvm:: namespace qualifiers on some core types now that LLVM.h imports
them into the clang namespace.

llvm-svn: 135852
2011-07-23 10:55:15 +00:00
Chris Lattner 2192fe50da de-constify llvm::Type, patch by David Blaikie!
llvm-svn: 135370
2011-07-18 04:24:23 +00:00
John McCall 30317fda63 Generalize Cleanup::Emit's "isForEH" parameter into a set
of flags.  No functionality change.

llvm-svn: 134997
2011-07-12 20:27:29 +00:00
John McCall 5fa8e20878 Ugh, use this compiler workaround again.
llvm-svn: 134989
2011-07-12 16:53:04 +00:00
John McCall 4bd0fb1f09 Switch field destruction over to use the new destroyer-based API
and kill a lot of redundant code.

llvm-svn: 134988
2011-07-12 16:41:08 +00:00
Jay Foad 7c57be3e2b De-constify Types in StructType::get() and TargetData::getIntPtrType().
llvm-svn: 134893
2011-07-11 09:56:20 +00:00