Commit Graph

5727 Commits

Author SHA1 Message Date
Akira Hatanaka f64e1adcbb Add field PaddingType to ABIArgInfo which specifies the type of padding that
is inserted before the real argument. Padding is needed to ensure the backend
reads from or writes to the correct argument slots when the original alignment
of a byval structure is unavailable due to flattening.

llvm-svn: 147699
2012-01-07 00:25:33 +00:00
Fariborz Jahanian 7ff610b62d objc++: more code gen stuff for atomic property api,
currently turned off. // rdar://6137845
Also, fixes a test case which should be nonatomic under
new API.

llvm-svn: 147691
2012-01-06 22:33:54 +00:00
Eli Friedman 48fd89ad14 Revert r147664; it's breaking clang regression tests.
llvm-svn: 147681
2012-01-06 20:42:20 +00:00
Eli Friedman df88c54f8d Revert r147655; it's breaking the compiler_rt build on OSX.
llvm-svn: 147677
2012-01-06 20:03:09 +00:00
Fariborz Jahanian 1e1b54926b objc++: some declarations related to atomic
properties of c++ object types with non-trivial
assignment copy. Not used yet. // rdar://6137845

llvm-svn: 147666
2012-01-06 18:07:23 +00:00
Jakub Staszak a78c20d734 Silence GCC warnings.
llvm-svn: 147664
2012-01-06 17:44:30 +00:00
David Chisnall 9217435a33 If we are compiling with -fno-builtin then don't do constant folding of
builtins.

This fixes PR11711.

llvm-svn: 147655
2012-01-06 12:20:19 +00:00
Fariborz Jahanian 17eaf4089d objc++: sythesize a helper function to be used
for copying atomic properties of c++ objects
with non-trivial copy assignment in setters/getters.
Not yet used. // rdar://6137845

llvm-svn: 147636
2012-01-06 00:29:35 +00:00
Eli Friedman b1bc368ca7 Address Richard's review comments on r147561 (Evaluate support for address-of-label differences).
llvm-svn: 147631
2012-01-05 23:59:40 +00:00
Fariborz Jahanian 088f1bc295 Fixes a code gen bug for setter code for a property of
c++ object reference type with trivial copy constructor.
This causes an assert crash and bad code gen. when assert 
is off. // rdar://6137845

llvm-svn: 147573
2012-01-05 00:10:16 +00:00
Eli Friedman fd5e54da2d Add an APValue representation for the difference between two address-of-label expressions. Add support to Evaluate and CGExprConstant for generating/handling them. Remove the special-case for such differences in Expr::isConstantInitializer.
With that done, remove a bunch of buggy code from CGExprConstant for handling scalar expressions which is no longer necessary.

Fixes PR11705.

llvm-svn: 147561
2012-01-04 23:13:47 +00:00
Chris Lattner 36bc4f41bc implement rdar://10639962 by keeping track of increased alignment
information even in subscripting operations.

llvm-svn: 147557
2012-01-04 22:35:55 +00:00
David Chisnall 207a630052 Restore r147493 and remove the part of the test that was checking the wrong thing.
llvm-svn: 147530
2012-01-04 12:02:13 +00:00
Akira Hatanaka f093f5be3e Have functions return structures smaller than 128-bit in registers if ABI
is either N32 or N64. 

llvm-svn: 147520
2012-01-04 03:34:42 +00:00
Rafael Espindola f90b6d1580 Revert r147493. It broke test/CodeGenObjC/constant-strings.m.
llvm-svn: 147511
2012-01-04 01:32:19 +00:00
David Chisnall 31640e1606 Initialise constant Objective-C string isa pointers with a weak reference to the class, so that they are usable in +load methods if the string class has been compiled with clang - if it's been compiled with GCC, the ABI makes this impossible. (GNU runtimes)
llvm-svn: 147493
2012-01-03 23:18:17 +00:00
Douglas Gregor f610267581 Eliminate ObjCForwardProtocolDecl, which is redundant now that
ObjCProtocolDecl modules forward declarations properly.

llvm-svn: 147415
2012-01-01 21:23:57 +00:00
Douglas Gregor a715bfff98 Introduce the core infrastructure needed to model redeclaration chains
for Objective-C protocols, including:
  - Using the first declaration as the canonical declaration
  - Using the definition as the primary DeclContext
  - Making sure that all declarations have a pointer to the definition
  data, and that we know which declaration is the definition
  - Serialization support for redeclaration chains and for adding
  definitions to already-serialized declarations.

However, note that we're not taking advantage of much of this code
yet, because we're still re-using ObjCProtocolDecls.

llvm-svn: 147410
2012-01-01 19:51:50 +00:00
Richard Smith fddd384b73 Unrevert r147271, reverted in r147361.
Also temporarily remove the assumption from IR gen that we can emit IR for every
constant we can fold, since it isn't currently true in C++11, to fix PR11676.

Original comment from r147271:

constexpr: perform zero-initialization prior to / instead of performing a
constructor call when appropriate. Thanks to Eli for spotting this.

llvm-svn: 147384
2011-12-30 21:15:51 +00:00
Richard Smith 5fab0c9e1a Small refactoring and simplification of constant evaluation and some of its
clients. No functionality change.

llvm-svn: 147318
2011-12-28 19:48:30 +00:00
Douglas Gregor deafd0b2a4 Eliminate ObjCClassDecl, which is redundant now that ObjCInterfaceDecl
covers both declarations (@class) and definitions (@interface) of an
Objective-C class.

llvm-svn: 147299
2011-12-27 22:43:10 +00:00
Richard Smith 6e52514c5d constexpr: support for evaluation and codegen of typeid constants.
llvm-svn: 147290
2011-12-27 12:18:28 +00:00
Craig Topper f2855ade2b Add intrinsics for lzcnt and tzcnt instructions.
llvm-svn: 147263
2011-12-25 06:25:37 +00:00
Eli Friedman 5c9cd7a8a3 Fix a failure (which led to a crash) in constant emission code with vector compound literals.
llvm-svn: 147111
2011-12-22 00:04:00 +00:00
David Blaikie 68e081d606 Unweaken vtables as per http://llvm.org/docs/CodingStandards.html#ll_virtual_anch
llvm-svn: 146959
2011-12-20 02:48:34 +00:00
Bill Wendling bd26cf90dc Mark the calls to the _setjmp function as returns twice. <rdar://problem/10492556>
llvm-svn: 146926
2011-12-19 23:53:28 +00:00
Eli Friedman 3184a5e482 Switch a few callers of MakeAddrLValue places over to MakeNaturalAlignAddrLValue.
llvm-svn: 146920
2011-12-19 23:03:09 +00:00
Chris Lattner 2415357a05 Fix PR5279 - don't sliently drop alignment information on stores of types that have alignment less than the natural alignment of the type when it comes from a typedef.
llvm-svn: 146908
2011-12-19 21:16:08 +00:00
Rafael Espindola 4fdc1759ca Extend the fix for PR9614 to handle inline asm in the outer decl and
the inner decl being a builtin. This is needed to support the glibc headers
in fedora 16 (2.14).

llvm-svn: 146867
2011-12-19 14:41:01 +00:00
Craig Topper 94aba2c260 More AVX2 intrinsic support including saturating add/sub and palignr.
llvm-svn: 146857
2011-12-19 07:03:25 +00:00
Eric Christopher cd88813dbf When in a limited debug information situation if we can find the original
declaration for the type then go ahead and use that, it's still smaller
than creating an all new derived type.

Part of rdar://10335756 and others.

llvm-svn: 146779
2011-12-16 23:40:18 +00:00
Eric Christopher ea225fb412 Start down the path of getting clang to internally agree on structs versus
classes.

Part of rdar://10520586 and a couple others.

llvm-svn: 146778
2011-12-16 23:40:14 +00:00
Douglas Gregor c8b0c9d8fd When generating debug info for an ObjCInterfaceDecl, try to dig out the definition.
llvm-svn: 146705
2011-12-15 23:32:29 +00:00
Douglas Gregor dc9166c8e1 Keep track of all declarations of an Objective-C class (both forward
declarations and definitions) as ObjCInterfaceDecls within the same
redeclaration chain. This new representation matches what we do for
C/C++ variables/functions/classes/templates/etc., and makes it
possible to answer the query "where are all of the declarations of
this class?"

llvm-svn: 146679
2011-12-15 20:29:51 +00:00
Douglas Gregor 0b144e160a Replace all comparisons between ObjCInterfaceDecl pointers with calls
to declaresSameEntity(), as a baby step toward tracking forward
declarations of Objective-C classes precisely. Part of
<rdar://problem/10583531>.

llvm-svn: 146618
2011-12-15 00:29:59 +00:00
Chad Rosier 1332d9b26a Per discussion on the list, remove BitcodeVerify pass to reimplement as a free function.
llvm-svn: 146530
2011-12-14 00:29:23 +00:00
Eli Friedman 3c840aad54 Make CGRecordLayoutBuilder correctly switch over to a packed class when a class has a base whose alignment will break the class layout. <rdar://problem/10551376>.
llvm-svn: 146443
2011-12-12 23:13:20 +00:00
Chad Rosier c4399f779b Add frontend flags to enable bitcode verifier pass.
llvm-svn: 146441
2011-12-12 23:05:47 +00:00
Tony Linthicum 76329bf83f Hexagon backend support
llvm-svn: 146413
2011-12-12 21:14:55 +00:00
Chandler Carruth a31b95cacf Update Clang to emit the new form of llvm.cttz and llvm.ctlz intrinsics,
setting the is_zero_undef flag appropriately to true as that matches the
semantics of these GCC builtins.

This is the Clang side of r146357 in LLVM.

llvm-svn: 146358
2011-12-12 04:28:35 +00:00
Benjamin Kramer 4257ab3ff0 Reuse forAddr to create ignored AggValueSlots.
Silences valgrind warnings about uninitalized alignment values.

llvm-svn: 146342
2011-12-11 16:34:24 +00:00
Eli Friedman de6a86b4f6 Make array new on a pointer to data member type work correctly. PR11523.
llvm-svn: 146291
2011-12-09 23:05:37 +00:00
Bill Wendling 90118a3c9b Don't get the exception obj from the slot more than once.
llvm-svn: 146202
2011-12-08 23:21:26 +00:00
Eli Friedman 516c2ad731 Fix an edge case in IRGen for conditionals. PR11509.
llvm-svn: 146189
2011-12-08 22:01:56 +00:00
Eli Friedman dae858aca3 Make sure we correctly zero-initialize unions containing a pointer to data member as the first field. PR11487.
llvm-svn: 146009
2011-12-07 01:30:11 +00:00
Nick Lewycky f4d3f7a0b9 Stack realignment is a tristate. Add -mno-stackrealign to turn off all stack
realignment, even with locals with alignment exceeding the ABI guarantee.

llvm-svn: 145909
2011-12-06 03:33:03 +00:00
Eli Friedman b8e45b28da Minor comment update.
llvm-svn: 145905
2011-12-06 03:08:26 +00:00
Joerg Sonnenberger db66ed0e4c Add -mstack-alignment=X and fix -mstackrealign handling now that the
backend options are gone.

llvm-svn: 145868
2011-12-05 23:05:23 +00:00
Eli Friedman 6d694a38fd Make EmitAggregateCopy take an alignment argument. Make EmitFinalDestCopy pass in the correct alignment when known.
The test includes a FIXME for a related case involving calls; it's a bit more complicated to fix because the RValue class doesn't keep track of alignment.

<rdar://problem/10463337>
  

llvm-svn: 145862
2011-12-05 22:23:28 +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
Eli Friedman 2869b5afe3 Add a utility to get a RValue for a given LValue for an aggregate; switch a few places over to it.
llvm-svn: 145747
2011-12-03 03:08:40 +00:00
Eli Friedman 38cd36dbdb Switch the Alignment argument on AggValueSlot over to CharUnits, per John's review comment.
llvm-svn: 145741
2011-12-03 02:13:40 +00:00
Eli Friedman c1d85b931e Track alignment in AggValueSlot. No functional change in this patch, but I'll be introducing uses of the specified alignment soon.
llvm-svn: 145736
2011-12-03 00:54:26 +00:00
Douglas Gregor ba34552e79 Introduce a module import declaration, so that we properly represent, e.g.,
__import_module__ std.vector;

in the AST.

llvm-svn: 145725
2011-12-02 23:23:56 +00:00
Nick Lewycky 432add5b8f Update for change to LLVM TargetMachine API in r145714.
llvm-svn: 145715
2011-12-02 22:17:00 +00:00
Richard Smith d572f82e49 Fix wrong-code bug when a const automatic variable of struct type has both a
mutable member and a constant initializer. We'd previously promoted such
variables to global constants, resulting in nasal demons if the mutable member
was modified.

This is only a temporary fix. The subtle interplay between isConstantInitializer
and CGExprConstant is very bug-prone; there are some other issues in this area
which I will be addressing in subsequent, more major reworking of this code.

llvm-svn: 145654
2011-12-02 00:30:33 +00:00
Eli Friedman bfd5addf4c When we're passing a vector with an illegal type through memory on x86-64, use byval so we're sure the backend does the right thing. Fixes va_arg with illegal vectors and an obscure ABI mismatch with __m64 vectors.
llvm-svn: 145652
2011-12-02 00:11:43 +00:00
David Chisnall 6aec31a5cf Fix -forwardingTargetForSelector: (GNUstep runtime) which was broken for the
old dispatch mechanism when I introduced the new one.

llvm-svn: 145609
2011-12-01 18:40:09 +00:00
Eli Friedman f37bd2f2f1 Don't use a varargs convention for calls unprototyped functions where one of the arguments is an AVX vector.
llvm-svn: 145574
2011-12-01 04:53:19 +00:00
Douglas Gregor de3ef502a9 Promote ModuleMap::Module to a namespace-scope class in the Basic
library, since modules cut across all of the libraries. Rename
serialization::Module to serialization::ModuleFile to side-step the
annoying naming conflict. Prune a bunch of ModuleMap.h includes that
are no longer needed (most files only needed the Module type).

llvm-svn: 145538
2011-11-30 23:21:26 +00:00
Kostya Serebryany d47685769e make asan work at -O0, clang part. Patch by glider@google.com
llvm-svn: 145531
2011-11-30 22:20:21 +00:00
Bob Wilson 5f4e3a780f Add bigger method type encodings to protocol objects. <rdar://problem/10492418>
The new metadata are method @encode strings with additional data.

1. Each Objective-C object is marked with its class name and protocol names.
The same is done for property @encode already.

2. Each block object is marked with its function prototype's @encoding. For
example, a method parameter that is a block object that itself returns void
and takes an int would look like:
    @?<v@?i>

These new method @encode strings are stored in a single array pointed to by structs protocol_t and objc_protocol_ext.

Patch provided by Greg Parker!

llvm-svn: 145469
2011-11-30 01:57:58 +00:00
Eric Christopher 607fb70750 Make sure that forward declarations are marked as such in the debug info
for the structure type.

rdar://10499337

llvm-svn: 145461
2011-11-29 23:57:40 +00:00
Benjamin Kramer 3df1a2dd59 The cheap version of getName() is sufficient here.
llvm-svn: 145399
2011-11-29 14:46:55 +00:00
Bill Wendling bcefeae5c1 The _setjmp builtin library function should have the "returns twice"
attribute. This prevents the stack slot allocator from coming along and using a
stack which it thinks is available but isn't.
<rdar://problem/10492556>

llvm-svn: 145332
2011-11-29 00:10:10 +00:00
Tanya Lattner 71f1b2dcd4 Correct the code generation for function arguments of vec3 types on x86_64 when they are greater than 128 bits. This was incorrectly coercing things like long3 into a double2.
Add test case.

llvm-svn: 145312
2011-11-28 23:18:11 +00:00
Peter Collingbourne eec0a2aa87 Another silly workaround for MSVC.
llvm-svn: 145227
2011-11-28 04:29:10 +00:00
Peter Collingbourne fc38dfe499 Sigh, another workaround for MSVC.
llvm-svn: 145211
2011-11-28 00:41:08 +00:00
Peter Collingbourne 1424b308c3 Work around a gcc4.2 bug.
llvm-svn: 145209
2011-11-28 00:18:21 +00:00
Peter Collingbourne 702b2841a4 When destroying temporaries, instead of a custom cleanup use the
generic pushDestroy function.

This would reduce the number of useful declarations in
CGTemporaries.cpp to one.  Since CodeGenFunction::EmitCXXTemporary
does not deserve its own file, move it to CGCleanup.cpp and delete
CGTemporaries.cpp.

llvm-svn: 145202
2011-11-27 22:09:22 +00:00
Rafael Espindola 32d8a275b9 Add inreg attributes to reference arguments.
llvm-svn: 145189
2011-11-27 18:35:39 +00:00
Sebastian Redl 29526f09ce Reference initialization with initializer lists.
This supports single-element initializer lists for references according to DR1288, as well as creating temporaries and binding to them for other initializer lists.

llvm-svn: 145186
2011-11-27 16:50:07 +00:00
Richard Smith 2d988f0f05 Use static storage duration for file-scope compound literals, even when they
appear in non-constant initializers in C++.

llvm-svn: 145087
2011-11-22 22:48:32 +00:00
Kostya Serebryany c3333e879f implement __has_feature(address_sanitizer); also use LangOpts.AddressSanitizer instead of CodeGenOpts.AddressSanitizer
llvm-svn: 145054
2011-11-22 01:28:36 +00:00
Benjamin Kramer 5642e19065 CodeGen: Simplify code.
llvm-svn: 145040
2011-11-21 15:47:23 +00:00
Benjamin Kramer ddbb2b85ab CodeGen: allow __asm renaming on static local variables.
Fixes PR4777.

llvm-svn: 145015
2011-11-20 21:05:04 +00:00
Eli Friedman f22fa9eaef Finish r144971, which was an incomplete commit.
llvm-svn: 144972
2011-11-18 04:01:36 +00:00
Eli Friedman 0b3f201b61 Fix the meaning of an "empty" record for the case of a zero-length array. Use isEmptyRecord for arguments on x86-32; there are structs of size 0 which don't count as empty.
llvm-svn: 144971
2011-11-18 03:47:20 +00:00
Eli Friedman a1748564b4 Make va_arg on x86-64 compute alignment the same way as argument passing.
Fixes <rdar://problem/10463281>.

llvm-svn: 144966
2011-11-18 02:44:19 +00:00
Eli Friedman 1d7dd3b682 A bunch of fixes to argument passing and va_arg on Darwin x86-32 for structures containing an SSE vector.
llvm-svn: 144963
2011-11-18 02:12:09 +00:00
Eli Friedman e5c85622c9 Don't try to expand struct arguments containing holes on x86-32. From gcc struct layout tests.
llvm-svn: 144961
2011-11-18 01:32:26 +00:00
Eli Friedman ee94534662 Simplify code for returning a struct for Darwin x86-32 ABI. Use a better type for a function returning a struct containing only a pointer. Handle the edge case of a struct containing only a float or double plus some dead padding instead of asserting.
llvm-svn: 144960
2011-11-18 01:25:50 +00:00
Eli Friedman 9f061a37bb Ignore empty unions in argument lowering on x86-32. From gcc struct layout tests.
llvm-svn: 144944
2011-11-18 00:28:11 +00:00
Argyrios Kyrtzidis 841dd8861a Change ASTConsumer::HandleTopLevelDecl to return true for the parser to continue
parsing or false to abort parsing.

llvm-svn: 144943
2011-11-18 00:26:59 +00:00
Eric Christopher 459532e1d5 Use the canonical decl to index so that we can really find it later.
Fixes rdar://10433202

llvm-svn: 144938
2011-11-17 23:45:00 +00:00
Richard Smith 027bf11eb3 Constant expression evaluation: add support for evaluation of member pointers
and base-to-derived casts, and add proper handling of temporaries.

llvm-svn: 144926
2011-11-17 22:56:20 +00:00
Kostya Serebryany 8855ff61cb Add -f[no-]address-sanitizer flag
llvm-svn: 144800
2011-11-16 17:34:26 +00:00
Evan Cheng dd286bce2c Match LLVM API change.
llvm-svn: 144789
2011-11-16 08:38:55 +00:00
Eli Friedman d20adbdce3 Fix a bunch of really nasty bugs in how we compute alignment for reference lvalues. PR11376.
llvm-svn: 144745
2011-11-16 00:42:57 +00:00
Eli Friedman 95ff70021c Fix crash in calling convention code expanding an struct with a complex member.
llvm-svn: 144612
2011-11-15 02:46:03 +00:00
Eric Christopher 04832b9210 Fixup comment.
llvm-svn: 144548
2011-11-14 18:55:02 +00:00
Richard Smith ce40ad677e Represent an APValue based on a Decl as that Decl, rather than a DeclRefExpr
or MemberExpr which refers to it. As a side-effect, MemberExprs which refer to
static member functions and static data members are now emitted as constant
expressions.

llvm-svn: 144468
2011-11-12 22:28:03 +00:00
Pete Cooper 9d6055133b Add invariant.load metadata to loads from selector references. Allows these loads to later be moved/combined in the optimizer. Fixes <rdar://problem/6027699>
llvm-svn: 144318
2011-11-10 21:45:06 +00:00
Eli Friedman 5ceb8aa23e Add missing dependency for shared library build to CMakeLists. Patch by Johannes Obermayr.
llvm-svn: 144310
2011-11-10 20:07:09 +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 e63abb5d2b Fix a subtle bug with cleanups: when activating
a previously-inactive cleanup, not only do we need a
flag variable, but we should also force the cleanup to
query the flag variable.  However, we only need to do
this when we're activating in a context that's
conditionally executed;  otherwise, we may safely
assume that the cleanup is dominated by the activation
point.

llvm-svn: 144271
2011-11-10 09:22:44 +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
Richard Smith d62306a481 Constant expression evaluation: support for evaluation of structs and unions of
literal types, as well as derived-to-base casts for lvalues and
derived-to-virtual-base casts.

llvm-svn: 144265
2011-11-10 06:34:14 +00:00
Nick Lewycky 1679035122 Reflow lines, remove else-if after returns, rename variable "TydefContext" to
"TypedefContext". No functionality change.

llvm-svn: 144248
2011-11-10 00:34:02 +00:00
Devang Patel 71510f6fb3 Remove unnecessary include.
llvm-svn: 144210
2011-11-09 21:08:24 +00:00
Nick Lewycky 6aad6df4d1 Reflow one line I missed in previous cleanup commit. No functionality change.
llvm-svn: 144168
2011-11-09 04:27:23 +00:00
Nick Lewycky 2219ef0b68 Minor cleanup, mostly reindenting. Remove one helper function that just called
the other helper functions, since we already differentiated the cases it was
testing between. No functionality change.

llvm-svn: 144167
2011-11-09 04:25:21 +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
John McCall 9a54961e01 Bind function "r-values" as l-values when emitting them as
opaque values.  Silly C type system.

llvm-svn: 144144
2011-11-08 22:54:08 +00:00
John McCall 0153cd3027 Fix the layout of vb-tables and vf-tables in the MS C++ ABI.
Based on work by Dmitry Sokolov!

llvm-svn: 144072
2011-11-08 04:01:03 +00:00
NAKAMURA Takumi dabda6b839 lib/CodeGen/CGBuiltin.cpp: Tweak the identifier "Type" to appease msvc.
llvm-svn: 144065
2011-11-08 03:27:04 +00:00
Bob Wilson 98bc98caa8 Clean up type flags for overloaded Neon builtins. No functional change.
This patch just adds a simple NeonTypeFlags class to replace the various
hardcoded constants that had been used until now.  Unfortunately I couldn't
figure out a good way to avoid duplicating that class between clang and
TableGen, but since it's small and rarely changes, that's not so bad.

llvm-svn: 144054
2011-11-08 01:16:11 +00:00
Richard Smith f3e9e43da4 Constant expression evaluation: support for arrays.
llvm-svn: 143922
2011-11-07 09:22:26 +00:00
John McCall ffc8ca2d84 Rip out CK_GetObjCProperty.
llvm-svn: 143910
2011-11-07 05:09:54 +00:00
John McCall c109a259d2 Rip the ObjCPropertyRef l-value kind out of IR-generation.
llvm-svn: 143908
2011-11-07 03:59:57 +00:00
John McCall fe96e0b6be Change the AST representation of operations on Objective-C
property references to use a new PseudoObjectExpr
expression which pairs a syntactic form of the expression
with a set of semantic expressions implementing it.
This should significantly reduce the complexity required
elsewhere in the compiler to deal with these kinds of
expressions (e.g. IR generation's special l-value kind,
the static analyzer's Message abstraction), at the lower
cost of specifically dealing with the odd AST structure
of these expressions.  It should also greatly simplify
efforts to implement similar language features in the
future, most notably Managed C++'s properties and indexed
properties.

Most of the effort here is in dealing with the various
clients of the AST.  I've gone ahead and simplified the
ObjC rewriter's use of properties;  other clients, like
IR-gen and the static analyzer, have all the old
complexity *and* all the new complexity, at least
temporarily.  Many thanks to Ted for writing and advising
on the necessary changes to the static analyzer.

I've xfailed a small diagnostics regression in the static
analyzer at Ted's request.

llvm-svn: 143867
2011-11-06 09:01:30 +00:00
Akira Hatanaka f3879ee666 Use a single integer type for a sub-doubleword part of a byval structure.
llvm-svn: 143666
2011-11-03 23:31:00 +00:00
Eli Friedman 3d9f47fe6f Fix alignment on alloca's for parameters using ABIArgInfo::Expand.
llvm-svn: 143658
2011-11-03 21:39:02 +00:00
Eli Friedman eadd3e81a0 Fix the alignment on scalar parameter variables so that it matches what the AST thinks it should be. Per report on cfe-dev.
llvm-svn: 143645
2011-11-03 20:31:28 +00:00
Jan Wen Voung 180319f72d Do not add "byval" attribute to records with non-trivial copy constructors
and destructors in the DefaultABIInfo.

llvm-svn: 143601
2011-11-03 00:59:44 +00:00
Akira Hatanaka 756ce7f9ab Set MinABIStackAlignInBytes to 8 if ABI is N32/64.
llvm-svn: 143597
2011-11-03 00:05:50 +00:00
Akira Hatanaka 101f70da7c Convert the type of a structure passed by value if it has double precision
fields in order to ease handling of such structures in backend. 

llvm-svn: 143596
2011-11-02 23:54:49 +00:00
Akira Hatanaka 1437852c38 Return function results whose size is smaller than 128-bits in registers if ABI
is N32/64.

llvm-svn: 143589
2011-11-02 23:14:57 +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
Bob Wilson 1d9269a8d6 Check for homogeneous aggregate return values with ARM's AAPCS-VFP ABI.
llvm-svn: 143530
2011-11-02 04:51:36 +00:00
Eli Friedman fcec630a57 Fix the representation of wide strings in the AST and IR so that it uses the native representation of integers for the elements. This fixes a bunch of nastiness involving
treating wide strings as a series of bytes.

Patch by Seth Cantrell.

llvm-svn: 143417
2011-11-01 02:23:42 +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
Anders Carlsson 2f1a6c3f01 In x86_64, when calling an Objective-C method that returns a _Complex long double, make sure to use the objc_msgSend_fp2ret function which ensures that the return value will be {0, 0} if the receiver is nil.
llvm-svn: 143350
2011-10-31 16:27:11 +00:00
Nick Lewycky dd424a5bc4 Turn on the new .file directive when appropriate, instead of turning it off.
llvm-svn: 143327
2011-10-31 01:06:42 +00:00
Peter Collingbourne f1d76db466 Add support for lazily linking bitcode files (using a new
-mlink-bitcode-file flag), and more generally llvm::Modules, before
running optimisations.

llvm-svn: 143314
2011-10-30 17:30:44 +00:00
Richard Smith 7b553f1b19 Rename Expr::Evaluate to Expr::EvaluateAsRValue to make it clear that it will
implicitly perform an lvalue-to-rvalue conversion if used on an lvalue
expression. Also improve the documentation of Expr::Evaluate* to indicate which
of them will accept expressions with side-effects.

llvm-svn: 143263
2011-10-29 00:50:52 +00:00
Devang Patel fa59ac363e In case of template specialization, do not try to delay emitting debug info for concrete type in -flimit-debug-info mode. This fixes some of the failures from bs15503.exp tests in gdb testsuite.
llvm-svn: 143227
2011-10-28 21:12:13 +00:00
Rafael Espindola fffc1ce1d7 Fix PR9614 for functions with the always_inline attribute. Try to keep
the common case (-O0, no always_inline) fast.

llvm-svn: 143222
2011-10-28 20:43:56 +00:00
David Chisnall 0cc83e7518 It turns out that the Objective-C message lookup functions can throw exceptions after all...
llvm-svn: 143205
2011-10-28 17:55:06 +00:00
Peter Collingbourne 95fd2ca69f Annotate imprecise FP division with fpaccuracy metadata
The OpenCL single precision division operation is only required to
be accurate to 2.5ulp.  Annotate the fdiv instruction with metadata
which signals to the backend that an imprecise divide instruction
may be used.

llvm-svn: 143136
2011-10-27 19:19:51 +00:00
Fariborz Jahanian b005070b83 Objective-c: fix an ir-gen crash where objc messag returns a _Complex
value and ABI requires return slot to be passed as first
argument to message sent. // rdar://10331109

llvm-svn: 143053
2011-10-26 20:53:59 +00:00
Rafael Espindola c594135b68 Fix pr9614 by not emitting an available_externally function when it calls
itself via an asm label.

available_externally functions are supposed to correspond to an external
function, and that is not the case in the examples in pr9614.

llvm-svn: 143049
2011-10-26 20:41:06 +00:00
John McCall 526ab47a55 Restore r142914 and r142915, now with missing file and apparent
GCC compiler workaround.

llvm-svn: 142931
2011-10-25 17:37:35 +00:00
NAKAMURA Takumi 9a8f13961c Revert r142914 and r142915, due to possibly missing file.
r142914: "Introduce a placeholder type for "pseudo object""
r142915: "Pull the pseudo-object stuff into its own file."
llvm-svn: 142921
2011-10-25 14:32:25 +00:00
David Chisnall e89ac0666b Change an int64_t to an intptr_t so that we don't end up with crashes in the back end on large classes on 32-bit.
llvm-svn: 142918
2011-10-25 10:12:21 +00:00
John McCall c4a2d3259f Introduce a placeholder type for "pseudo object"
expressions: expressions which refer to a logical rather
than a physical l-value, where the logical object is
actually accessed via custom getter/setter code.
A subsequent patch will generalize the AST for these
so that arbitrary "implementing" sub-expressions can
be provided.

Right now the only client is ObjC properties, but
this should be generalizable to similar language
features, e.g. Managed C++'s __property methods.

llvm-svn: 142914
2011-10-25 07:27:56 +00:00
Douglas Gregor deb4a2be67 Implement support for dependent Microsoft __if_exists/__if_not_exists
statements. As noted in the documentation for the AST node, the
semantics of __if_exists/__if_not_exists are somewhat different from
the way Visual C++ implements them, because our parsed-template
representation can't accommodate VC++ semantics without serious
contortions. Hopefully this implementation is "good enough".

llvm-svn: 142901
2011-10-25 01:33:02 +00:00
Dan Gohman 53bb0ff685 Remove the SystemZ backend.
llvm-svn: 142879
2011-10-24 23:48:52 +00:00
Devang Patel 242ce91ecc Do not drop type qualifiers in -flimit-debug-info mode.
llvm-svn: 142873
2011-10-24 23:15:17 +00:00
Eli Friedman 9190e19b66 Don't try to emit CK_LValueBitCast casts as constants. PR9558.
llvm-svn: 142863
2011-10-24 22:25:55 +00:00
Benjamin Kramer 1e93c6a809 Fix mismatched new[]/delete[].
llvm-svn: 142803
2011-10-24 17:22:36 +00:00
David Chisnall d5bcd07e5d Remove debugging printfs that some idiot left in.
llvm-svn: 142796
2011-10-24 14:11:46 +00:00
David Chisnall 8c93cf2a27 Enable experimental support for objc_msgSend with GNUstep ObjC runtime.
llvm-svn: 142795
2011-10-24 14:07:03 +00:00
Bob Wilson 02d5fe29ab Fix a typo that completely broke the expansion of complex arguments.
llvm-svn: 142734
2011-10-22 21:42:34 +00:00
Benjamin Kramer e35328c878 Remove obsolete debugging macro, make helper static.
llvm-svn: 142730
2011-10-22 19:16:39 +00:00
Eric Christopher 4b4beb2fe7 Fix PR11073 by adding the argument type information to the decl we construct
for the function type. Update a testcase accordingly.

Patch initially by Anders Waldenborg!

llvm-svn: 142700
2011-10-21 23:30:10 +00:00
Fariborz Jahanian 47f9a73f51 c++: support gcc's application of weak attribute on
class declaration which forces any such class and any 
class that inherits from such a class to have their 
typeinfo symbols be marked as weak.
// rdar://10246395
A    test/CodeGenCXX/weak-extern-typeinfo.cpp
M    lib/Sema/SemaDeclCXX.cpp
M    lib/Sema/SemaDeclAttr.cpp
M    lib/CodeGen/CGRTTI.cpp

llvm-svn: 142693
2011-10-21 22:27:12 +00:00
Nick Lewycky ba743b75cb Take DW_AT_comp_dir from $PWD when it's present and starts with a '/'. This is
closer to what GCC does, except that GCC also checks that the inodes for $PWD
and '.' match.

llvm-svn: 142633
2011-10-21 02:32:14 +00:00
Eric Christopher 7ec8ec8581 Add block information for ObjC @catch blocks.
Fixes rdar://10282889

llvm-svn: 142467
2011-10-19 00:44:01 +00:00
Eric Christopher a9d3497b5e Add a new subclass of RunCleanupScopes that also handles creating new
lexical blocks for debug info.

llvm-svn: 142466
2011-10-19 00:43:52 +00:00
John McCall 59207978e6 More metaprogramming with builtin types.
llvm-svn: 142433
2011-10-18 22:28:37 +00:00
John McCall e314e27c58 Macro metaprogramming for builtin types.
llvm-svn: 142420
2011-10-18 21:02:43 +00:00
Eli Friedman 5e9534b0ae Rewrite parts of MS ABI C++ layout. Based on work by r4start; I ended up doing this while I was trying to review his patch.
llvm-svn: 142325
2011-10-18 00:55:28 +00:00
Nick Lewycky 1d617acef9 Wire up support for the controlling the extended dwarf .file directive. With
r142300 but not this patch, clang -S may emit .s files that assemblers other
than llvm-mc can't parse.

llvm-svn: 142301
2011-10-17 23:05:52 +00:00
John McCall 8a6b59ad97 Add a new placeholder type to represent "unbridged"
casts in ARC.

No semantic analysis yet.

llvm-svn: 142208
2011-10-17 18:09:15 +00:00
Benjamin Kramer e06b2b7012 Convert inline asm source ranges into clang SourceRanges and print them with the instantiated note.
t.c:2:7: error: invalid operand for instruction
  asm("movl 0(%rax), 0(%edx)");
      ^
<inline asm>:1:16: note: instantiated into assembly here
        movl 0(%rax), 0(%edx)
                      ^~~~~~~
1 error generated.

llvm-svn: 142131
2011-10-16 10:48:28 +00:00
Benjamin Kramer 22d24c287a Replace vectors with arrays.
llvm-svn: 142072
2011-10-15 12:20:02 +00:00
Eli Friedman 27ef75b0be Handle an edge case involving the conditional operator and throw expressions. PR10582.
llvm-svn: 142047
2011-10-15 02:10:40 +00:00
Anton Korobeynikov f0c267e6e0 Provide half floating point support as a storage only type.
Lack of half FP was a regression compared to llvm-gcc.

llvm-svn: 142016
2011-10-14 23:23:15 +00:00
Eli Friedman 4b72fddd99 Misc fixes for atomics. Biggest fix is doing alignment correctly for _Atomic types.
llvm-svn: 142002
2011-10-14 20:59:01 +00:00
Benjamin Kramer 47b5b31e61 Simplify code to avoid a useless string copy.
llvm-svn: 141970
2011-10-14 18:45:16 +00:00
Benjamin Kramer fd0b05f341 Upgrade to PathV2.
llvm-svn: 141969
2011-10-14 18:45:11 +00:00
Benjamin Kramer 13481e27cb Add parens to pacify GCC.
llvm-svn: 141968
2011-10-14 18:45:06 +00:00
Eli Friedman fde961dbf3 PR11124: Don't overwrite memory outside of a base class when performing zero-initialization before running its constructor.
llvm-svn: 141933
2011-10-14 02:27:24 +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
Peter Collingbourne adcf7c9203 TCE target: conversion of OpenCL reqd_work_group_size attr to metadata
Patch by Pekka Jääskeläinen!

llvm-svn: 141865
2011-10-13 16:24:41 +00:00
Rafael Espindola 2d21ab024e Add returns_twice to functions that are known to return twice. This implements
the same behavior of gcc by keeping the attribute out of the function type.

llvm-svn: 141803
2011-10-12 19:51: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
Jim Goodnow II 5a793d3762 Removed extra line in comment.
llvm-svn: 141773
2011-10-12 09:55:01 +00:00
Eric Christopher 663b7f353e Remember to set the location in EmitGlobalVariable to the current decl
if we're going to delete the setLocation as we did in 141732.

llvm-svn: 141762
2011-10-12 01:11:30 +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
Eric Christopher fefafacf68 80-column and tab cleanup.
llvm-svn: 141731
2011-10-11 23:00:51 +00:00
Eric Christopher fb4cd4082c Reorder this to make it easier to add more changes for a location set.
llvm-svn: 141730
2011-10-11 23:00:45 +00:00
Eli Friedman c2025567f5 Silence some -Wuninitialized false positives with gcc.
llvm-svn: 141701
2011-10-11 20:00:47 +00:00
Eli Friedman df14b3a837 Initial implementation of __atomic_* (everything except __atomic_is_lock_free).
llvm-svn: 141632
2011-10-11 02:20:01 +00:00
Richard Smith caf3390d44 Constant expression evaluation refactoring:
- Remodel Expr::EvaluateAsInt to behave like the other EvaluateAs* functions,
   and add Expr::EvaluateKnownConstInt to capture the current fold-or-assert
   behaviour.
 - Factor out evaluation of bitfield bit widths.
 - Fix a few places which would evaluate an expression twice: once to determine
   whether it is a constant expression, then again to get the value.

llvm-svn: 141561
2011-10-10 18:28:20 +00:00
David Chisnall e0dc7cb2e2 Apparently getPtrToInt() takes an explicit type parameter to allow you to generate invalid bitcode, not so that it can actually produce a value of this type. This should fix PR11085.
llvm-svn: 141482
2011-10-08 08:54:36 +00:00
Ted Kremenek c168e50722 Free 'TheTargetCodeGenInfo' in the class CodeGenModule. This looks like an obvious memory leak that was reported from LLDB devs. The comment indicates the leak is deliberate, but I have no idea why this needs to be so. Please comment/revert if you know otherwise.
llvm-svn: 141479
2011-10-08 05:28:26 +00:00
Eli Friedman 235266700a Fix warning on MSVC. Patch by Aaron Ballman.
llvm-svn: 141467
2011-10-08 01:03:47 +00:00
John McCall f937c023bf Rename TagDecl::isDefinition -> isCompleteDefinition
for better self-documenting code, since the semantics
are subtly different from getDefinition().

llvm-svn: 141355
2011-10-07 06:10:15 +00:00
John McCall 0710e551ef Record layout requires not just a definition, but a complete
definition.  Assert this.  Change IR generation to not try to
aggressively emit the IR translation of a record during its
own definition.  Fixes PR10912.

llvm-svn: 141350
2011-10-07 02:39:22 +00:00
Eli Friedman c8b57f6683 llvm.memory.barrier is going away; remove the wrapper intrinsic __builtin_llvm_memory_barrier.
__atomic_thread_fence will be landing soon as a replacement, wrapping around the new fence instruction.

llvm-svn: 141332
2011-10-06 23:12:03 +00:00
Eli Friedman 0dfb889575 Support for C1x _Atomic specifier (see testcase). This is primarily being committed at the moment to help support C++0x <atomic>, but it should be a solid base for implementing the full specification of C1x _Atomic.
Thanks to Jeffrey Yasskin for the thorough review!

llvm-svn: 141330
2011-10-06 23:00:33 +00:00
Peter Collingbourne fa4d6033a3 CUDA: IR generation support for device stubs
llvm-svn: 141304
2011-10-06 18:51:56 +00:00
Peter Collingbourne a9455ec9f8 CUDA: add -fcuda-is-device flag
This frontend-only flag is used by the IR generator to determine
whether to filter CUDA declarations for the host or for the device.

llvm-svn: 141301
2011-10-06 18:29:46 +00:00
Peter Collingbourne fe88342240 CUDA: IR generation support for kernel call expressions
llvm-svn: 141300
2011-10-06 18:29:37 +00:00
Peter Collingbourne 5bad4afa2f CUDA: set proper calling conventions for PTX
llvm-svn: 141296
2011-10-06 16:49:54 +00:00
Eric Christopher fab289a47d When constructing debug information for synthesized variables for the
non-fragile ABI we may not be able to lay out the type and the debugger
would ignore us even if we did put in the offset. Go ahead and just
put any value there and don't look up the offset since it may not exist.

rdar://10210157

llvm-svn: 141261
2011-10-06 00:31:18 +00:00
Eric Christopher 8c552308c6 Reformat comment.
llvm-svn: 141260
2011-10-06 00:30:52 +00:00
Justin Holewinski 38031978b5 PTX: Set proper calling conventions for PTX in OpenCL mode.
llvm-svn: 141193
2011-10-05 17:58:44 +00:00
David Chisnall cdd207e43e Add bitmaps for strong / weak ivar layout (GNUstep runtime).
llvm-svn: 141085
2011-10-04 15:35:30 +00:00
John McCall ff61303bd0 Mark calls to objc_retainBlock that don't result from casts
to id so that we can still optimize them appropriately.

llvm-svn: 141064
2011-10-04 06:23:45 +00:00
Rafael Espindola 70107f989c Propagate __attribute__((returns_twice)) from C to IL.
llvm-svn: 141002
2011-10-03 14:59:42 +00:00
Argyrios Kyrtzidis b8c3aaf479 Allow getting all source locations of selector identifiers in a ObjCMethodDecl.
Instead of always storing all source locations for the selector identifiers
we check whether all the identifiers are in a "standard" position; "standard" position is

  -Immediately before the arguments: -(id)first:(int)x second:(int)y;
  -With a space between the arguments: -(id)first: (int)x second: (int)y;
  -For nullary selectors, immediately before ';': -(void)release;

In such cases we infer the locations instead of storing them.

llvm-svn: 140989
2011-10-03 06:37:04 +00:00
Argyrios Kyrtzidis dfd6570643 Pass from the parser the locations of selector identifiers when creating
objc method decls.

They are not stored in the AST yet.

llvm-svn: 140984
2011-10-03 06:36:36 +00:00
John McCall 9b0a7cea0f Make -fobjc-nonfragile-abi the -cc1 default, since it's the
increasingly prevailing case to the point that new features
like ARC don't even support the fragile ABI anymore.

This required a little bit of reshuffling with exceptions
because a check was assuming that ObjCNonFragileABI was
only being set in ObjC mode, and that's actually a bit
obnoxious to do.

Most, though, it involved a perl script to translate a ton
of test cases.

Mostly no functionality change for driver users, although
there are corner cases with disabling language-specific
exceptions that we should handle more correctly now.

llvm-svn: 140957
2011-10-02 01:16:38 +00:00
John McCall 248512a573 When performing an @throw in ARC, retain + autorelease
the pointer, being sure to do so before running cleanups
associated with that full-expression.  rdar://10042689

llvm-svn: 140945
2011-10-01 10:32:24 +00:00
Fariborz Jahanian 0c78427d50 objc gc: assigning to an objc object struct member through an ivar
pointer to this struct must go through the none ivar writer barrier.

llvm-svn: 140867
2011-09-30 18:23:36 +00:00
Eli Friedman 1b87b29bfd Minor cleanup.
llvm-svn: 140866
2011-09-30 18:19:16 +00:00
Eric Christopher 2f45aaa755 Change "Regions" to be "LexicalBlocks" since that's what they
correspond to.

llvm-svn: 140740
2011-09-29 00:00:45 +00:00
Eric Christopher bfa4dc5512 Rename EmitStopPoint in CGDebugInfo to EmitLocation. "stop points" don't
exist anymore.

llvm-svn: 140739
2011-09-29 00:00:41 +00:00
Eric Christopher 4fd315ffbd Reorder functions in the file.
llvm-svn: 140738
2011-09-29 00:00:37 +00:00
Eric Christopher e655657c94 Call UpdateLineDirectiveRegion every time we want to emit a stop
point in the code. Ensures that we don't miss any places and the
check is reasonably cheap.

llvm-svn: 140737
2011-09-29 00:00:35 +00:00
Eric Christopher 250511bc75 Update comment.
llvm-svn: 140736
2011-09-29 00:00:31 +00:00
Benjamin Kramer 76399eb2ad de-tmpify clang.
llvm-svn: 140637
2011-09-27 21:06:10 +00:00
Eric Christopher 9c13eeac99 Update comments.
llvm-svn: 140531
2011-09-26 15:03:22 +00:00
Eric Christopher 22e157009c Fix comment to reflect reality.
llvm-svn: 140530
2011-09-26 15:03:19 +00:00
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