Commit Graph

5420 Commits

Author SHA1 Message Date
Peter Collingbourne cfd2356180 Move VTable builder to AST
llvm-svn: 140510
2011-09-26 01:57:12 +00:00
Peter Collingbourne 1c593c6a38 Have CodeGenVTables::GenerateConstructionVTable use VTableLayout
llvm-svn: 140509
2011-09-26 01:57:04 +00:00
Peter Collingbourne 085095f1ac Move vtable dumper call to VTableBuilder ctor
llvm-svn: 140508
2011-09-26 01:57:00 +00:00
Peter Collingbourne 3b118abd93 Implement VTableContext::createConstructionVTableLayout
llvm-svn: 140507
2011-09-26 01:56:55 +00:00
Peter Collingbourne affe111ba5 Move all vtable layout data into new VTableLayout class
llvm-svn: 140506
2011-09-26 01:56:50 +00:00
Peter Collingbourne cd3c3f4f3d Move VTableComponent to header file
llvm-svn: 140505
2011-09-26 01:56:45 +00:00
Peter Collingbourne 5ee9ee490e Move vtable component accessors to VTableContext
llvm-svn: 140504
2011-09-26 01:56:41 +00:00
Peter Collingbourne 71c26936a0 Remove CodeGenVTables::ComputeVTableRelatedInformation dependency on CodeGen
llvm-svn: 140503
2011-09-26 01:56:36 +00:00
Peter Collingbourne a834166e48 Create a VTableContext class and start moving CodeGenVTables methods to it
llvm-svn: 140502
2011-09-26 01:56:30 +00:00
Peter Collingbourne 2d2595235d Move VTT builder to AST
llvm-svn: 140501
2011-09-26 01:56:24 +00:00
Peter Collingbourne 66c3a83e09 Move BaseSubobject class to AST
llvm-svn: 140500
2011-09-26 01:56:16 +00:00
Peter Collingbourne 2000e4ead5 Remove CodeGenModule field from VTTBuilder
llvm-svn: 140499
2011-09-26 01:56:10 +00:00
Peter Collingbourne d9eb79ca73 Make the VTTBuilder class independent of LLVM core
llvm-svn: 140498
2011-09-26 01:56:06 +00:00
David Blaikie 9c902b5502 Rename Diagnostic to DiagnosticsEngine as per issue 5397
llvm-svn: 140478
2011-09-25 23:23:43 +00:00
Sebastian Redl 12757ab4cb Treat list-initialization of scalars as a first-class citizen in C++11.
Allow empty initializer lists for scalars, which mean value-initialization.
Constant evaluation for single-element and empty initializer lists for scalars.
Codegen for empty initializer lists for scalars.
Test case comes in next commit.

llvm-svn: 140459
2011-09-24 17:48:14 +00:00
David Blaikie aa347f9392 Removing a bunch of dead returns/breaks after llvm_unreachables.
llvm-svn: 140407
2011-09-23 20:26:49 +00:00
David Blaikie 83d382b1ca Switch assert(0/false) llvm_unreachable.
llvm-svn: 140367
2011-09-23 05:06:16 +00:00
Bill Wendling 8c4b716352 Don't remove filters.
It's not valid to remove filters from landingpad instructions, even if we catch
the type. The metadata won't be set up correctly.

Testcase is projects/llvm-test/SingleSource/UnitTests/EH/filter-2.cpp.

llvm-svn: 140335
2011-09-22 20:32:54 +00:00
Douglas Gregor eb4089ad01 Only trigger the initialize-an-array-via-elementwise-copy/move code
generation when we're dealing with an implicitly-defined copy or move
constructor. And, actually set the implicitly-defined bit for
implicitly-defined constructors and destructors. Should fix self-host.

llvm-svn: 140334
2011-09-22 20:32:43 +00:00
Douglas Gregor 8a556ce512 Explicitly-defaulted copy/move constructors are not "implicit", but
they still need the logic to cope with array member
initialization. Fixes PR10720.

llvm-svn: 140302
2011-09-22 15:15:51 +00:00
John McCall cbc038a6c3 ANSI C requires that a call to an unprototyped function type succeed
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
2011-09-21 08:08:30 +00:00
Richard Trieu e4f3180fec Change "ivar" to true for a boolean function argument. Since string literals are cast to true, this should no effect on behavior.
llvm-svn: 140231
2011-09-21 02:46:06 +00:00
Akira Hatanaka ec11b4fa5a Create a MipsTargetCodeGenInfo object for mips64/mips64el. The size of the
UnwindException structure is 32 for mips64. 

llvm-svn: 140165
2011-09-20 18:30:57 +00:00
Akira Hatanaka 0486db08bd Add a parameter to MipsTargetCodeGenInfo's constructor.
llvm-svn: 140161
2011-09-20 18:23:28 +00:00
Bill Wendling 5d7469e3e4 Don't assume that the clause is a GlobalVariable. It could be a constant.
llvm-svn: 140123
2011-09-20 00:40:19 +00:00
Eli Friedman 6b9c41ea68 Add list initialization for complex numbers in C. Essentially, this allows "_Complex float x = {1.0f, 2.0f};". See changes to docs/LanguageExtensions.html for a longer description.
<rdar://problem/9397672>.

llvm-svn: 140090
2011-09-19 23:17:44 +00:00
Bill Wendling 58e58fead1 The eh.selector intrinsic isn't used anymore. Replace the check here with a
check for the landingpad instruction instead. This check looks at each of the
clauses in the landingpad instruction. If it's a catch clause, it compares the
name directly with the global. If it's a filter clause, it has to look through
each value in the filer to see if any have the prefix.

llvm-svn: 140075
2011-09-19 22:08:36 +00:00
Peter Collingbourne 2dbb708b8a OpenCL: introduce support for function scope __local variables
llvm-svn: 140068
2011-09-19 21:14:35 +00:00
Argyrios Kyrtzidis 27bf76d6d2 In CodeGenAction::ExecuteAction() use SourceManager::translateFileLineCol()
instead of getLocation() since we don't care about expanded macro arguments.

llvm-svn: 140061
2011-09-19 20:40:38 +00:00
Argyrios Kyrtzidis e6e67deeed Rename SourceLocation::getFileLocWithOffset -> getLocWithOffset.
It already works (and is useful with) macro locs as well.

llvm-svn: 140057
2011-09-19 20:40:19 +00:00
Bill Wendling f0724e8e06 Throw the switch to convert clang to the new exception handling model!
This model uses the 'landingpad' instruction, which is pinned to the top of the
landing pad. (A landing pad is defined as the destination of the unwind branch
of an invoke instruction.) All of the information needed to generate the correct
exception handling metadata during code generation is encoded into the
landingpad instruction.

The new 'resume' instruction takes the place of the llvm.eh.resume intrinsic
call. It's lowered in much the same way as the intrinsic is.

llvm-svn: 140049
2011-09-19 20:31:14 +00:00
Devang Patel 5a54065c4f Tighten check to match an ivar with corresponding property by using ObjCImplementationDecl.
Radar 10139522 - Part 1.

llvm-svn: 140038
2011-09-19 18:54:16 +00:00
John McCall 28a5b326e1 In apple-kext mode, use external linkage for explicit template instantiations
instead of internal linkage.

llvm-svn: 140030
2011-09-19 18:05:26 +00:00
Richard Smith 20104048be PR10304: Do not call destructors for data members from union destructors. Prior to C++11, this
has no effect since any such destructors must be trivial, and in C++11 such destructors must not
be called.

llvm-svn: 139997
2011-09-18 12:11:43 +00:00
Bill Wendling 79a70e42b0 Refactor the load of the exception pointer and the exception selector from their
storage slot into helper functions.

llvm-svn: 139826
2011-09-15 18:57:19 +00:00
John McCall 99210dc9d1 Rewrite this loop to use partial destruction; I'm not sure it's
possible for that to matter right now, but eventually I think we'll
need to unify this better, and then it might.  Also, use a more
efficient looping structure.

llvm-svn: 139788
2011-09-15 06:49:18 +00:00
John McCall 3b201b7d5f Sorry, that assertion actually already exists.
llvm-svn: 139770
2011-09-15 01:55:23 +00:00
John McCall 8f8f8d67ea We don't generate null initializer expressions anymore, and
we don't need to.

llvm-svn: 139769
2011-09-15 01:54:21 +00:00
Devang Patel ecaf9ac0bb Emit debug info for c++0x nullptr.
llvm-svn: 139752
2011-09-14 23:14:14 +00:00
Eric Christopher 19329c402f Formatting.
llvm-svn: 139681
2011-09-14 01:10:50 +00:00
Eli Friedman 2dadd3ebee Fix comment.
llvm-svn: 139678
2011-09-14 00:52:45 +00:00
Eric Christopher 47300ad6e4 Fix typo.
llvm-svn: 139668
2011-09-13 23:45:09 +00:00
John McCall 30e4efd458 Correctly generate IR for casted "builtin" functions, where
the builtin is really just a predefined declaration.  These are
totally valid to cast.

llvm-svn: 139657
2011-09-13 23:05:03 +00:00
Eli Friedman 84d2812111 Re-commit r139643.
Make clang use Acquire loads and Release stores where necessary.

llvm-svn: 139650
2011-09-13 22:21:56 +00:00
Eli Friedman acca089617 Revert r139643 while I look into it; it's breaking selfhost.
llvm-svn: 139648
2011-09-13 22:08:16 +00:00
Eli Friedman f92b2e0714 Make clang use Acquire loads and Release stores where necessary.
llvm-svn: 139643
2011-09-13 21:31:32 +00:00
Eli Friedman 5be3e6ae9d Turn off the generation of unaligned atomic load/store; I'm going to explicitly error out on such cases in the backend, at least for the moment.
llvm-svn: 139640
2011-09-13 20:48:30 +00:00
John McCall 4319286337 Refactoring, mostly to give ObjCPropertyDecls stronger invariants for
their semantic attributes and then to take advantage of that.

llvm-svn: 139615
2011-09-13 18:31:23 +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 0bef0badf6 Don't use native atomics on ivars whose size is not a power of two,
even on architectures that support unaligned access (which is the
only way this is otherwise legal, given that ivars apparently do
not honor alignment attributes).

llvm-svn: 139590
2011-09-13 07:33:34 +00:00
John McCall bdd8185e22 Handle reference properties correctly in the trivial-getter check.
llvm-svn: 139585
2011-09-13 06:00:03 +00:00
John McCall 0e5c086de4 Always emit bitfield properties using expression behavior, even if they're
atomic.  This is probably something we should warn about.

llvm-svn: 139584
2011-09-13 05:36:29 +00:00
John McCall f4528ae063 Unify the decision of how to emit property getters and setters into a
single code path.  Use atomic loads and stores where necessary.  Load and
store anything of the appropriate size and alignment with primitive
operations instead of going through the call.

llvm-svn: 139580
2011-09-13 03:34:09 +00:00
John McCall b923ece770 Privatize the setter/getter call generation methods, plus some minor
modernization.  No functionality change.

llvm-svn: 139555
2011-09-12 23:06:44 +00:00
Devang Patel b0fa5b57ac By popular demand, enumerate all builtin types!
llvm-svn: 139521
2011-09-12 18:50:21 +00:00
Devang Patel 33e097b699 Add an assert so that new builtins do not sneak without proper debug info.
llvm-svn: 139514
2011-09-12 18:24:46 +00:00
Devang Patel 98ca8aeca6 Fix debug info encodings for char16_t and char32_t.
llvm-svn: 139502
2011-09-12 17:11:58 +00:00
John McCall 6acaef9fe8 Modernize and comment; no functionality change.
llvm-svn: 139470
2011-09-10 09:30:49 +00:00
John McCall 7f16c42b9e Simplify the generation of Objective-C setters, at least a little.
Use a more portable heuristic for deciding when to emit a single
atomic store;  it's possible that I've lost information here, but
I'm not sure how much of the logic before was intentionally arch-specific
and how much was just not quite consistent.

llvm-svn: 139468
2011-09-10 09:17:20 +00:00
John McCall 2d637d2e79 Rename the ARC cast kinds to start with "ARC".
llvm-svn: 139466
2011-09-10 06:18:15 +00:00
John McCall cd78e805e9 When converting a block pointer to an Objective-C pointer type, extend
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
2011-09-10 01:16:55 +00:00
Devang Patel 964d758d17 Emit debug info for wchar_t.
llvm-svn: 139443
2011-09-10 00:44:49 +00:00
Douglas Gregor 87d8124b0e Clean up our handling of Objective-C definitions in AST files. Rather
than having CodeGen check whether a declaration comes from an AST file
(which it shouldn't know or care about), make sure that the AST writer and
reader pass along "interesting" declarations that CodeGen needs to
know about.

llvm-svn: 139441
2011-09-10 00:22:34 +00:00
Douglas Gregor b3722e2223 Introduce a new predicate Decl::isFromASTFile() to determine whether a
declaration was deserialized from an AST file. Use this instead of
Decl::getPCHLevel() wherever possible. This is a simple step toward
killing off Decl::getPCHLevel().

llvm-svn: 139427
2011-09-09 23:01:35 +00:00
Julien Lerouge e0d5fad37b Remove trailing } in comment.
llvm-svn: 139424
2011-09-09 22:46:39 +00:00
Julien Lerouge 5a6b6987dc Bring llvm.annotation* intrinsics support back to where it was in llvm-gcc: can
annotate global, local variables, struct fields, or arbitrary statements (using
the __builtin_annotation), rdar://8037476.

llvm-svn: 139423
2011-09-09 22:41:49 +00:00
Eric Christopher 65c5c9132f Carry the debug information from single exit unified return block
along with the new insert point.

Fixes PR10829

llvm-svn: 139416
2011-09-09 21:53:04 +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
Argyrios Kyrtzidis 2169a75a0a Do a lookup for the blocks runtime globals to see if they were declared,
instead of codegen waiting to consume such a declaration, which won't
happen if that decls are coming from a PCH.

Fixes rdar://10028656.

llvm-svn: 139359
2011-09-09 06:44:21 +00:00
John McCall 9320b87cff Give conversions of block pointers to ObjC pointers a different cast kind
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
2011-09-09 05:25:32 +00:00
Eric Christopher d98e424716 Formatting.
llvm-svn: 139296
2011-09-08 17:15:04 +00:00
Eli Friedman e9f8113ec4 Switch clang over to using fence/atomicrmw/cmpxchg instead of the intrinsics (which will go away). LLVM CodeGen does almost exactly the same thing with these and the old intrinsics, so I'm reasonably confident this will not break anything.
There are still a few issues which need to be resolved with code generation for atomic load and store, so I'm not converting the places which need those for now.

I'm not entirely sure what to do about __builtin_llvm_memory_barrier: the fence instruction doesn't expose all the possibilities which can be expressed by __builtin_llvm_memory_barrier.  I would appreciate hearing from anyone who is using this intrinsic.

llvm-svn: 139216
2011-09-07 01:41:24 +00:00
Douglas Gregor e0e9630e07 When extracting the callee declaration from a call expression, be sure
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
2011-09-06 21:41:04 +00:00
Eli Friedman cf9b1f6524 Rearrange code so that we pass the right pointer to delete[] when an exception is thrown constructing the array elements in an array new expression. Fixes PR10870.
llvm-svn: 139158
2011-09-06 18:53:03 +00:00
Douglas Gregor 146b8e9a58 When performing a derived-to-base cast on the right-hand side of the
synthesized move assignment within an implicitly-defined move
assignment operator, be sure to treat the derived-to-base cast as an
xvalue (rather than an lvalue). Otherwise, we'll end up getting the
wrong constructor.

Optimize a direct call to a trivial move assignment operator to an
aggregate copy, as we do for trivial copy assignment operators, and
update the the assertion in CodeGenFunction::EmitAggregateCopy() to
cope with this optimization.

Fixes PR10860.

llvm-svn: 139143
2011-09-06 16:26:56 +00:00
Fariborz Jahanian 2bb8270e6f blocks: Support capturing complex variable in block.
// rdar://10033896

llvm-svn: 139041
2011-09-02 21:33:44 +00:00
Fariborz Jahanian b74711df52 revert patch in r139020
llvm-svn: 139029
2011-09-02 20:03:16 +00:00
Fariborz Jahanian f30bc00103 blocks: Support capturing complex variable in block.
// rdar://10033896

llvm-svn: 139020
2011-09-02 18:39:40 +00:00
Douglas Gregor e8bbc12152 Extend the ASTContext constructor to delay the initialization of
builtin types (When requested). This is another step toward making
ASTUnit build the ASTContext as needed when loading an AST file,
rather than doing so after the fact. No actual functionality change (yet).

llvm-svn: 138985
2011-09-02 00:18:52 +00:00
Nick Lewycky 0112b11f5c Don't try to emit unsupported templated friend declarations. They're unsupported
and may very well be dependent-types, triggering an assertion in debug info
codegen.

llvm-svn: 138970
2011-09-01 21:49:51 +00:00
Sebastian Redl 22653bac1a Declare and define implicit move constructor and assignment operator.
This makes the code duplication of implicit special member handling even worse,
but the cleanup will have to come later. For now, this works.
Follow-up with tests for explicit defaulting and enabling the __has_feature
flag to come.

llvm-svn: 138821
2011-08-30 19:58:05 +00:00
John McCall 3480ef24d1 The size of struct UnwindException varies by platform with no
apparent general rule.  Just special-case it as appropriate.
PR10789.

llvm-svn: 138792
2011-08-30 01:42:09 +00:00
John McCall 154a2fd3cb Be sure to emit lvalue-to-rvalue casts for loads from x-values.
Doing this happens to disrupt the pattern that ARC was looking for
for move optimizations, so we need to fix that simultaneously.

llvm-svn: 138789
2011-08-30 00:57:29 +00:00
Benjamin Kramer 1174675c7b Remove unused variables noticed by GCC.
llvm-svn: 138707
2011-08-27 17:54:32 +00:00
John McCall 17054bd670 Slight optimization enabled by the previous assert:
emit all gl-value arguments as reference bindings.

llvm-svn: 138655
2011-08-26 21:08:13 +00:00
John McCall 0a76c0cf68 Assert that a call argument is a gl-value iff the parameter is a reference type.
llvm-svn: 138639
2011-08-26 18:42:59 +00:00
John McCall cac93853ae What say we document some of these AggValueSlot flags a bit
better.

llvm-svn: 138628
2011-08-26 08:02:37 +00:00
John McCall 46759f4f46 Since the 'is aliased' bit is critical for correctness in C++, it
really shouldn't be optional.  Fix the remaining place where a
temporary was being passed as potentially-aliased memory.

Fixes PR10756.

llvm-svn: 138627
2011-08-26 07:31:35 +00:00
John McCall a8a39bc346 An initialization does not alias.
llvm-svn: 138624
2011-08-26 05:38:08 +00:00
John McCall 35e4f0cd0f The allocated exception slot does not alias anything; should fix self-host.
llvm-svn: 138615
2011-08-26 00:46:38 +00:00
Chad Rosier ba3df1d3ca [driver] Add -mglobal-merge/-mno-global-merge machine options to enable/disable merging of
globals during codegen.
Fixes <rdar://problem/10017909>.

llvm-svn: 138612
2011-08-26 00:26:29 +00:00
John McCall a5efa7386a Track whether an AggValueSlot is potentially aliased, and do not
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
2011-08-25 23:04:34 +00:00
John McCall 8d6fc9583d Use stronger typing for the flags on AggValueSlot and require
creators to tell us whether something needs GC barriers.
No functionality change.

llvm-svn: 138581
2011-08-25 20:40:09 +00:00
Fariborz Jahanian 5c4b2ca699 blocks - capturing logic of byref block variable's expression
statement initializer makes safe assumption when a substatement 
is encounterred (with a fix me).

llvm-svn: 138528
2011-08-25 00:06:26 +00:00
Evan Cheng 494eb062b5 Match LLVM change: TargetRegistry and TargetSelect have been moved to Support.
llvm-svn: 138451
2011-08-24 18:09:14 +00:00
Eric Christopher b58b3e879d Make constant aggregate constant initializers private linkage.
After talking with John making this the case for all of these is
the right way to go.

Fixes rdar://9804564 and PR10414

llvm-svn: 138418
2011-08-24 00:33:55 +00:00
Eric Christopher d28d107099 Whitespace and 80-col cleanup.
llvm-svn: 138413
2011-08-23 23:44:09 +00:00
Eric Christopher 31ab13047d Whitespace.
llvm-svn: 138404
2011-08-23 22:38:00 +00:00
Eli Friedman 750a5916af Cleanup to use helper.
llvm-svn: 138369
2011-08-23 20:22:34 +00:00
Fariborz Jahanian 797f1e23f6 checking for __block variable captured by given
stmt expression, recursively walk down all substatements 
of the stmt expression. // rdar://10001085

llvm-svn: 138334
2011-08-23 16:47:15 +00:00
Fariborz Jahanian b50801f049 block IRgen - Fixes a crash when determining if given block variable
is captured by a given statement expression. // rdar://10001085

llvm-svn: 138314
2011-08-23 00:27:49 +00:00
Eli Friedman c55efe4fb2 Make sure we don't inline functions marked with __attribute__((naked)). <rdar://problem/9973228>
llvm-svn: 138310
2011-08-22 23:55:33 +00:00
Ted Kremenek c14efa7122 Fix a handful of dead stores found by Clang's static analyzer. There's a bunch of others I haven't touched.
llvm-svn: 137867
2011-08-17 21:04:19 +00:00
Argyrios Kyrtzidis 004df6e053 Mark objc methods that are implicitly declared for properties (not user-declared) as implicit.
This results in libclang ignoring such methods.

llvm-svn: 137852
2011-08-17 19:25:08 +00:00
Devang Patel ffa30ab216 Finalize debug info after all deferred globals are emitted.
llvm-svn: 137750
2011-08-16 20:58:22 +00:00
Devang Patel e24d324762 Use new DIBuilder::finalize() at the end to wrap up debug info encoding for a translation unit.
llvm-svn: 137674
2011-08-15 23:01:55 +00:00
Eric Christopher bf005ecd9c 'pure' and 'const' functions should also be marked nounwind. Migrate
test over from llvm/test/FrontendC++ and update others to account for
the change.

llvm-svn: 137669
2011-08-15 22:38:22 +00:00
Eli Friedman 0be3970804 Fix r137086 to actually work properly in general. PR10650.
llvm-svn: 137574
2011-08-14 04:50:34 +00:00
Francois Pichet 00c7e6ceb1 Implement function template specialization at class scope extension in Microsoft mode. A new AST node is introduced: ClassScopeFunctionSpecialization. This node holds a FunctionDecl that is not yet specialized; then during the class template instantiation the ClassScopeFunctionSpecialization will spawn the actual function specialization.
Example:
template <class T>
class A {
public:
  template <class U> void f(U p) {  }
  template <> void f(int p) {  } // <== class scope specialization
};

This extension is necessary to parse MSVC standard C++ headers, MFC and ATL code.
BTW, with this feature in, clang can parse (-fsyntax-only) all the MSVC 2010 standard header files without any error.

llvm-svn: 137573
2011-08-14 03:52:19 +00:00
Bob Wilson 445c24f8f0 Move handling of vget_lane/vset_lane before the code that checks the type.
Unlike most of the other Neon intrinsics, these are not overloaded and do not
have the extra argument that specifies the vector type.  This has not been
fatal because the lane number operand is supposed to be an ICE and so that
value has harmlessly been used as the type identifier.  Radar 9901281.

llvm-svn: 137550
2011-08-13 05:03:46 +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
Akira Hatanaka ae31c7af1c Alignment of a va_arg must be at least as large as the ABI's minimum alignment.
llvm-svn: 137420
2011-08-12 02:30:14 +00:00
Akira Hatanaka dabfc21fbf Add definition of a static member of a class.
llvm-svn: 137411
2011-08-12 01:43:14 +00:00
Douglas Gregor 9767347b11 Encapsulate the Objective-C id/Class/SEL "redefinition" types in
ASTContext with accessors/mutators. The only functional change is that
the AST writer won't bother writing the id/Class/SEL redefinition type
if it hasn't been explicitly set; previously, it ended up being
written as a synonym for the built-in id/Class/SEL.

llvm-svn: 137349
2011-08-11 20:58:55 +00:00
John McCall 8e4c74bb7c Simplify EH control flow by observing that EH scopes form a simple
hierarchy of delegation, and that EH selector values are meaningful
function-wide (good thing, too, or inlining wouldn't work).
2,3d
1a
hierarchy of delegation and that EH selector values have the same
meaning everywhere in the function instead of being meaningful only
in the context of a specific selector.

This removes the need for routing edges through EH cleanups,
since a cleanup simply always branches to its enclosing scope.

llvm-svn: 137293
2011-08-11 02:22:43 +00:00
John McCall a3654e327b Formatting.
llvm-svn: 137200
2011-08-10 04:11:11 +00:00
Eli Friedman f5dfb31df0 Revert bad change. (It may look equivalent, but it isn't.)
llvm-svn: 137132
2011-08-09 18:16:09 +00:00
Eli Friedman f481ccafd8 Cleanup; no functionality change.
llvm-svn: 137126
2011-08-09 17:38:12 +00:00
Douglas Gregor 636e200675 Move the creation of the record type for the state of Objective-C fast
enumerations from the ASTContext into CodeGen, so that we don't need
to serialize it to AST files. This appears to be the last of the
low-hanging fruit for SpecialTypes.

llvm-svn: 137124
2011-08-09 17:23:49 +00:00
Douglas Gregor abf4e0dfcd Move the construction of the RecordDecl representing the runtime
layout of a constant NSString from the ASTContext over to CodeGen,
since this is solely CodeGen's responsibility. Eliminates one of the
unnecessary "special" types that we serialize.

llvm-svn: 137121
2011-08-09 15:54:21 +00:00
Douglas Gregor 34f6c6db26 Hand materialization of temporary expressions when emitting a scalar
expression. Fxies PR10592.

llvm-svn: 137086
2011-08-09 00:37:14 +00:00
David Chisnall 51ed0d112b Fix typo so we don't use the wrong function for ending ObjC++ catch blocks (GNU runtimes)
llvm-svn: 137052
2011-08-08 17:26:06 +00:00
John McCall 45e429524b Avoid fallthrough-branching to an inactive cleanup even if it's
otherwise required.

llvm-svn: 137029
2011-08-07 07:05:57 +00:00
John McCall f82bdf6dd1 Be sure to destroy the normal entry block of a cleanup that we
aren't actually going to make a normal cleanup for.  Sometimes
we optimistically create branches to such blocks for fixups,
and then we resolve the fixup to somewhere within the cleanup's
scope, and then the cleanup is actually not reachable for some
reason.  The process of resolving the fixup leaves us with
switches whose default edge leads to the cleanup;  we can
replace that with unreachable, then (in many cases) turn
the switch into an unconditional branch.

Fixes PR10467.

llvm-svn: 137011
2011-08-06 06:53:52 +00:00
John McCall 91e82dd477 The continue label in an ARC for-in loop should not involve
releasing the collection.

llvm-svn: 136949
2011-08-05 00:14:38 +00:00
John McCall 9b24df470d Emit wide string literals with the appropriate alignment.
Patch by Craig Topper and Sundeep!

llvm-svn: 136856
2011-08-04 01:03:22 +00:00
John McCall 9c8e1c9401 Use the general conditional-cleanup framework instead of rolling our
own, incorrectly, for releasing objects at the end of a full-expression.

llvm-svn: 136823
2011-08-03 22:24:24 +00:00
Bob Wilson e826a2a56b Handle "homogeneous aggregates" as required by the ARM AAPCS-VFP ABI.
A homogeneous aggregate is an aggregate data structure where after flattening
any nesting there are 1 to 4 elements of the same base type that is either a
float, double, or Neon vector.  All Neon vectors of the same size, either 64
or 128 bits, are treated as equivalent for this purpose.  When using the
AAPCS-VFP ABI, check for homogeneous aggregates and pass them as arguments by
expanding them into a sequence of their base types.  This requires extending
the existing support for expanded arguments to handle not only structs, but
also constant arrays and complex types.

llvm-svn: 136767
2011-08-03 05:58:22 +00:00
John McCall 625ed88f07 When rewriting a call to a K&R function to lead to a well-prototyped
function, be sure to drop parameter attributes when dropping their
associated arguments.  Patch by Aaron Landwehr!

llvm-svn: 136753
2011-08-03 00:43:55 +00:00
Rafael Espindola 11d994b769 Implements alignment for long long and double types in va_arg on ARM AAPCS.
Patch by Jim (Ningjie) Chen.

llvm-svn: 136734
2011-08-02 22:33:37 +00:00
Rafael Espindola 56a7dab0c4 Update for LLVM change in PassManagerBuilder.
llvm-svn: 136728
2011-08-02 21:51:02 +00:00
Eli Friedman b23533db13 PR10566: Make sure codegen for deleting an pointer to an incomplete type actually works.
llvm-svn: 136703
2011-08-02 18:05:30 +00:00
Bob Wilson 8e2b75dbad Revert "Re-enable byval for ARM in clang. rdar://problem/7662569"
This reverts commit 67d097e1232b7d66f58989c16a45b8a11721f76e.
We found a miscompile with ARM byval, which is still being investigated.
In the meantime, this works around the problem by disabling ARM byval.

Conflicts:
	lib/CodeGen/TargetInfo.cpp

llvm-svn: 136662
2011-08-01 23:39:04 +00:00
Akira Hatanaka fb1d9f325c Implement MipsABIInfo::EmitVAArg. This fix enables clang to complete compilation
without bailing out when va_arg is an aggregate expression. However, 
alignment checking needs to be added in isSafeToEliminateVarargsCast in
InstCombineCalls.cpp in order to produce correct mips code (see link below).

http://lists.cs.uiuc.edu/pipermail/llvmdev/2011-July/042047.html

llvm-svn: 136647
2011-08-01 20:48:01 +00:00
Akira Hatanaka df425dbf04 Pass records with non-trivial destructors or constructors indirectly.
llvm-svn: 136630
2011-08-01 18:09:58 +00:00
David Chisnall 28dc7f94f8 Fix linkage type for tentative definition of ivar offset variables (GNUstep runtime)
llvm-svn: 136628
2011-08-01 17:36:53 +00:00
Jay Foad 5709f7c5f7 Remove some unnecessary single element array temporaries.
llvm-svn: 136461
2011-07-29 13:56:53 +00:00
Peter Collingbourne 05500ba6ec Fix assertion failure in CodeGen where the input operand to an asm
instruction is tied to an output operand which is a pointer, and
the input operand is narrower than the output operand.

llvm-svn: 136438
2011-07-29 00:24:50 +00:00
John McCall b726a55729 Fix a couple of problems with initialization and assignment to
__block variables where the act of initialization/assignment
itself causes the __block variable to be copied to the heap
because the variable is of block type and is being assigned
a block literal which captures the variable.

rdar://problem/9814099

llvm-svn: 136337
2011-07-28 07:23:35 +00:00
John McCall d9bb743e0d The lock operand to an @synchronized statement is also
supposed to be a full-expression;  make it so.  In ARC, make sure
we retain the lock for the entire protected block. 

llvm-svn: 136271
2011-07-27 21:50:02 +00:00
Peter Collingbourne e1d209911f CodeGen: rename CodeGenModule::Runtime to ObjCRuntime
llvm-svn: 136254
2011-07-27 20:29:46 +00:00
Eli Friedman b2f3695e9a Make CodeGen for array delete involving incomplete class work without crashing. Should fix regression on g++.dg/init/delete1.C.
llvm-svn: 136241
2011-07-27 18:54:57 +00:00
Douglas Gregor fb65e592e0 Add support for C++0x unicode string and character literals, from Craig Topper!
llvm-svn: 136210
2011-07-27 05:40:30 +00:00
John McCall 538482373b Clean up the analysis of the collection operand to ObjC
for-in statements;  specifically, make sure to close over any
temporaries or cleanups it might require.  In ARC, this has
implications for the lifetime of the collection, so emit it
with a retain and release it upon exit from the loop.

rdar://problem/9817306

llvm-svn: 136204
2011-07-27 01:07:15 +00:00
Douglas Gregor 8771796493 Disable the optimization that skips emission of complete, non-virtual
destructors of abstract classes. It's undefined behavior to actually
call the destructor (e.g., via delete), but the presence of code that
calls this destructor doesn't make the program
ill-formed. Fixes <rdar://problem/9819242>.

llvm-svn: 136180
2011-07-26 23:18:30 +00:00
Chandler Carruth d48db2115a Rename getInstantiationLineNumber to getExpansionLineNumber in both
SourceManager and FullSourceLoc.

llvm-svn: 135969
2011-07-25 21:09:52 +00:00
Chandler Carruth 35f5320d8e Mechanically rename SourceManager::getInstantiationLoc and
FullSourceLoc::getInstantiationLoc to ...::getExpansionLoc. This is part
of the API and documentation update from 'instantiation' as the term for
macros to 'expansion'.

llvm-svn: 135914
2011-07-25 16:49:02 +00:00
Frits van Bommel ede0dc6dda Shorten some expressions by using ArrayRef::slice().
llvm-svn: 135910
2011-07-25 15:13:01 +00:00
Chris Lattner 84037d3d0a fix PR10415, tidying up IR representation of module level inline asm
to avoid extraneous \n's.

llvm-svn: 135862
2011-07-23 20:04:25 +00:00
Chris Lattner 54b1677d23 Move ArrayRef to LLVM.h and eliminate now-redundant qualifiers, patch by Jon Mulder!
llvm-svn: 135855
2011-07-23 17:14:25 +00:00