summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGenCXX
Commit message (Collapse)AuthorAgeFilesLines
* Add a triple to this IRgen test to unbreak the ARM bots.Richard Smith2013-12-101-1/+1
| | | | llvm-svn: 196953
* Implement DR1460: fix handling of default initializers in unions; don't allowRichard Smith2013-12-101-1/+31
| | | | | | | | | more than one such initializer in a union, make mem-initializers override default initializers for other union members, handle anonymous unions with anonymous struct members better. Fix a couple of semi-related bugs exposed by the tests for same. llvm-svn: 196892
* Output destructors and constructors in a more natural order.Rafael Espindola2013-12-0917-83/+83
| | | | | | | | | | | | | | | | With this patch we output the in the order C2 C1 D2 D1 D0 Which means that a destructor or constructor that call another is output after the callee. This is a bit easier to read IHMO and a tiny bit more efficient as we don't put a decl in DeferredDeclsToEmit. llvm-svn: 196784
* [-cxx-abi microsoft] Mangle large integral constants correctlyDavid Majnemer2013-12-091-0/+38
| | | | | | | | | | | | | | | | | | | Testing has revealed that large integral constants (i.e. > INT64_MAX) are always mangled as-if they are negative, even in places where it would not make sense for them to be negative (like non-type template parameters of type unsigned long long). To address this, we change the way we model number mangling: always mangle as-if our number is an int64_t. This should result in correct results when we have large unsigned numbers. N.B. Bizarrely, things that are 32-bit displacements like vbptr offsets are mangled as-if they are unsigned 32-bit numbers. This is a pretty egregious waste of space, it would be a 4x savings if we could mangle it like a signed 32-bit number. Instead, we explicitly cast these displacements to uint32_t and let the mangler proceed. llvm-svn: 196771
* [-cxx-abi microsoft] Properly mangle enumsDavid Majnemer2013-12-091-0/+81
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While testing our ability to mangle large constants (PR18175), I incidentally discovered that we did not properly mangle enums correctly. Previously, we would append the width of the enum in bytes after the type-tag differentiator. This would mean "enum : short" would be mangled as 'W2' while "enum : char" would be mangled as 'W1'. Upon testing this with several versions of MSVC, I found that this did not match their behavior: they always use 'W4'. N.B. Quick testing uncovered that undname allows different numbers to follow the 'W' in the following way: 'W0' -> "enum char" 'W1' -> "enum unsigned char" 'W2' -> "enum short" 'W3' -> "enum unsigned short" 'W4' -> "enum" 'W5' -> "enum unsigned int" 'W6' -> "enum long" 'W7' -> "enum unsigned long" However this scheme appears abandoned, I cannot get MSVC to trigger it. Furthermore, it's incomplete: it doesn't handle "bool" or "long long". llvm-svn: 196752
* Remove duplicated -cc1 in testsAlp Toker2013-12-081-1/+1
| | | | llvm-svn: 196728
* Fix pr18174.Rafael Espindola2013-12-081-0/+14
| | | | | | | | | | | | | | | Clang outputs LLVM one top level decl at a time. This combined with the visibility computation code looking for the newest NamespaceDecl would cause it to produce different results for nested namespaces. The two options for producing consistent results are * Delay codegen of anything inside a namespace until the end of the file. * Don't look for the newest NamespaceDecl. This patch implements the second option. This matches the gcc behavior too. llvm-svn: 196712
* CodeGen: Don't emit linkage on thunks that aren't emitted because they're ↵Benjamin Kramer2013-12-071-0/+22
| | | | | | | | | | | | vararg. This can happen when we're trying to emit a thunk with available_externally linkage with optimization enabled but bail because it doesn't make sense for vararg functions. PR18098. llvm-svn: 196658
* [ms-cxxabi] bitcast to i8* to deref a data member pointerReid Kleckner2013-12-051-0/+20
| | | | | | | | This was causing us to miscompile llvm::SymbolTableListTraits::getListOwner(), which uses data member pointers. llvm-svn: 196545
* Fix a tranche of comment, test and doc typosAlp Toker2013-12-052-2/+2
| | | | llvm-svn: 196510
* PR17983: Fix crasher bug in C++1y mode when performing a non-global arrayRichard Smith2013-12-051-8/+28
| | | | | | | delete on a class which has no array cookie and has no class-specific operator new. llvm-svn: 196488
* [ms-cxxabi] Construct and destroy call arguments in the correct orderReid Kleckner2013-12-041-0/+41
| | | | | | | | | | | | | | | | | | | Summary: MSVC destroys arguments in the callee from left to right. Because C++ objects have to be destroyed in the reverse order of construction, Clang has to construct arguments from right to left and destroy arguments from left to right. This patch fixes the ordering by reversing the order of evaluation of all call arguments under the MS C++ ABI. Fixes PR18035. Reviewers: rsmith Differential Revision: http://llvm-reviews.chandlerc.com/D2275 llvm-svn: 196402
* Fix test case due to r196394 and improve it to not rely on LLVM code ↵David Blaikie2013-12-041-4/+3
| | | | | | generation either. llvm-svn: 196399
* Sema: Propagate the mangling number into instantiationsDavid Majnemer2013-12-041-0/+22
| | | | | | | | | | | | | | | | | | We would lose track of the mangling number assigned to the original declaration which would cause us to create manglings that didn't match the Itanium C++ specification. e.g. Two static fields with the same name inside of a function template would receive the same mangling with LLVM fixing up the second field so they wouldn't collide. This would create an incompatibility with other compilers following the Itanium ABI. I've confirmed that the new mangling is identical to the ones generated by icc and gcc. N.B. This was uncovered while working on Microsoft mangler. llvm-svn: 196368
* clang/test: REQUIRES: s/x86-64-registered-target/x86-registered-target/NAKAMURA Takumi2013-12-044-4/+4
| | | | llvm-svn: 196350
* Check IR on this test.Rafael Espindola2013-12-031-9/+8
| | | | llvm-svn: 196286
* Check IR on this test.Rafael Espindola2013-12-031-8/+5
| | | | llvm-svn: 196285
* Check IR on this test.Rafael Espindola2013-12-031-10/+6
| | | | llvm-svn: 196284
* Check IR on this test.Rafael Espindola2013-12-031-11/+6
| | | | llvm-svn: 196282
* check IR in this testRafael Espindola2013-12-031-8/+5
| | | | llvm-svn: 196281
* check IR in this test.Rafael Espindola2013-12-031-12/+7
| | | | llvm-svn: 196280
* check IR in this test.Rafael Espindola2013-12-031-12/+7
| | | | llvm-svn: 196279
* Check IR in this test.Rafael Espindola2013-12-031-18/+10
| | | | llvm-svn: 196278
* Check IR in this test.Rafael Espindola2013-12-031-8/+5
| | | | llvm-svn: 196277
* Check IR in this test.Rafael Espindola2013-12-031-9/+5
| | | | llvm-svn: 196276
* Check IR instead of assembly in this test.Rafael Espindola2013-12-031-10/+5
| | | | llvm-svn: 196275
* [-cxx-abi microsoft] Create backrefs for <unnamed-type-`id'>David Majnemer2013-11-251-2/+10
| | | | | | | | | | | | | | | It wasn't possible for an anonymous type to show up inside of function arguments. However, decltype (which MSVC added support for in 2010) makes this possible. Further, backrefs to these anonymous types can now be formed. This fixes PR18022. N.B. We do not, and very likely _will not_, support MSVC's bug where subsequent typedefs of anonymous types leak into the linkage name; this is a gross violation of the ABI. A warning should be introduced to inform our users of this particular shortcoming. llvm-svn: 195669
* [test] Add test case I forgot to add for r195564.Argyrios Kyrtzidis2013-11-241-0/+10
| | | | llvm-svn: 195572
* Adjust r194296 to not apply the alias replacement for externallyJoerg Sonnenberger2013-11-221-0/+32
| | | | | | | | available always-inline functions. This breaks libc++'s locale implementation. Code generation for this case should be fixed, but this is a stop gap fix for clang 3.4. llvm-svn: 195501
* [-cxx-abi microsoft] Emit linkonce_odr definitions for declarations of ↵Hans Wennborg2013-11-211-0/+35
| | | | | | | | | | | | | | | static data members with inline initializers (PR17689) This makes Clang emit a linkonce_odr definition for 'val' in the code below, to be compatible with MSVC-compiled code: struct Foo { static const int val = 1; }; Differential Revision: http://llvm-reviews.chandlerc.com/D2233 llvm-svn: 195283
* Implement the newly added AArch64 ACLE functions for ld1/st1 with 2/3/4 vectors.Hao Liu2013-11-181-0/+13
| | | | | | The functions are like: vst1_s8_x2 ... llvm-svn: 194991
* [-cxx-abi microsoft] Emit thunks for pointers to virtual member functionsHans Wennborg2013-11-151-0/+108
| | | | | | | | | | | | | | | | Instead of storing the vtable offset directly in the function pointer and doing a branch to check for virtualness at each call site, the MS ABI generates a thunk for calling the function at a specific vtable offset, and puts that in the function pointer. This patch adds support for emitting such thunks. However, it doesn't support pointers to virtual member functions that are variadic, have an incomplete aggregate return type or parameter, or are overriding a function in a virtual base class. Differential Revision: http://llvm-reviews.chandlerc.com/D2104 llvm-svn: 194827
* Makes A Microsoft Layout CodeGen Test ExplicitWarren Hunt2013-11-141-0/+10
| | | | | | | | | | This patch tests introduces a proper codegen test in place of the "codegen no longer crashes" test introduced in r193664. The test is also moved from layout to CodeGenCXX. Differential Revision: http://llvm-reviews.chandlerc.com/D2174 llvm-svn: 194739
* Don't use alias from derived dtor to base dtor at -O0.Rafael Espindola2013-11-133-3/+9
| | | | | | | | | | This patch disables aliasing (and rauw) of derived dtors to base dtors at -O0. This optimization can have a negative impact on the debug quality. This was a latent bug for some time with local classes, but got noticed when it was generalized and broke gdb's destrprint.exp. llvm-svn: 194618
* Avoid producing mismatched comdats.Rafael Espindola2013-11-121-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | | The problem was that given template<typename T> struct foo { ~foo() {} }; template class foo<int>; We would produce a alias, creating a comdat with D0 and D1, since the symbols have to be weak. Another TU is not required to have a explicit template instantiation definition or an explict template instantiation declaration and for template<typename T> struct foo { ~foo() {} }; foo<int> a; we would produce a comdat with only one symbol in it. llvm-svn: 194520
* Keep the old function order in CodeGenModule::applyReplacements.Rafael Espindola2013-11-121-8/+8
| | | | | | | | | | | | | | The original decls are created when used. The replacements are created at the end of the TU in reverse order. This makes the original order far better for testing. This is particularly important since the replacement logic could be used even when -mconstructor-aliases is not used, but that would make many tests hard to read. This is a fixed version of r194357 which handles replacing a destructor with another which is an alias to a third one. llvm-svn: 194452
* Add a testcase where we replace a destructor with an alias.Rafael Espindola2013-11-111-0/+16
| | | | | | This is a reduced testcase from a cast to Function failing during bootstrap. llvm-svn: 194430
* Fix pr17875.Rafael Espindola2013-11-111-0/+15
| | | | | | | | The assert this patch deletes was valid only when aliasing D2 to D1, not when looking at a base class. Since the assert was in the path where we had already decided to not produce an alias, just drop it. llvm-svn: 194411
* Revert "Keep the old function order in CodeGenModule::applyReplacements."Rafael Espindola2013-11-111-8/+8
| | | | | | | | This reverts commit r194357. Debugging a cast failure during bootstrap. llvm-svn: 194358
* Keep the old function order in CodeGenModule::applyReplacements.Rafael Espindola2013-11-101-8/+8
| | | | | | | | | | | The original decls are created when used. The replacements are created at the end of the TU in reverse order. This makes the original order far better for testing. This is particularly important since the replacement logic could be used even when -mconstructor-aliases is not used, but that would make many tests hard to read. llvm-svn: 194357
* Add -mconstructor aliases to some tests.Rafael Espindola2013-11-095-7/+7
| | | | | | | | clang-cl adds these, so this makes the tests a bit more realistic. These are the tests where it would make a difference if the windows specific handling were removed. llvm-svn: 194336
* Don't emit an internal destructor that is identical to an external one.Rafael Espindola2013-11-091-0/+15
| | | | | | | It is not safe to emit alias to undefined (not supported by ELF or COFF), but it is safe to rauw when the alias would have been internal or linkonce_odr. llvm-svn: 194307
* Use rauw for all discardable aliases, not just linkonce_odr.Rafael Espindola2013-11-082-22/+23
| | | | llvm-svn: 194296
* Remove an incorrect optimization inside Clang's IRGen. Its check to determineNick Lewycky2013-11-081-0/+9
| | | | | | | | | | | whether we can safely lower a conditional operator to select was insufficient. I've left a large comment in place to explaining the sort of problems that this transform can encounter in clang in the hopes of discouraging others from reimplementing it wrongly again in the future. (The test should also help with that, but it's easy to work around any single test I might add and think that your particular implementation doesn't miscompile any code.) llvm-svn: 194289
* If a linkonce_odr dtor/ctor is identical to another one, just rauw.Rafael Espindola2013-11-082-3/+4
| | | | | | | Unlike an alias a rauw is always safe, so we don't need to avoid this optimization when the replacement is not know to be available in every TU. llvm-svn: 194288
* Make -fdump-vtable-layouts print to stdout, not stderrReid Kleckner2013-11-085-11/+11
| | | | | | | | | | | | | This makes it consistent with -fdump-record-layouts, which was moved to outs() in r186219. My reasoning for going with stdout is that when one of these options is present, the layouts are really a program output, and shouldn't be interleaved with diagnostics, which are on stderr. Reviewers: timurrrr Differential Revision: http://llvm-reviews.chandlerc.com/D2127 llvm-svn: 194279
* Fix tests effected by r194221David Majnemer2013-11-082-2/+2
| | | | | | | GEP expressions were folded differently from before, change the tests to reflect this. llvm-svn: 194243
* Fix the -cxx-abi microsoft -mconstructor-aliases combination.Rafael Espindola2013-11-061-0/+9
| | | | | | | | | | On the microsoft ABI clang is producing one weak_odr and one linkonce_odr destructor, which is reasonable since only one is required. The fix is simply to move the assert past the special case treatment of linkonce_odr. llvm-svn: 194158
* Fix PR17738 - add support for vtordisp thunks when using -cxx-abi microsoftTimur Iskhodzhanov2013-11-063-2/+407
| | | | llvm-svn: 194132
* Produce direct calls instead of alias to linkonce_odr functions.Rafael Espindola2013-11-052-10/+9
| | | | | | | This is a small optimization on linux, but should help more on windows where msvc only outputs one destructor if there would be two identical ones. llvm-svn: 194095
OpenPOWER on IntegriCloud