summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGenCXX
Commit message (Collapse)AuthorAgeFilesLines
* clang-cl: Handle dll attributes in explicit class template specialization ↵Hans Wennborg2015-05-272-0/+17
| | | | | | | | | | definitions (PR23667) Previously, we wouldn't call checkDLLAttribute() after the class template specialization definition if the class template was already instantiated by an explicit class template specialization declaration. llvm-svn: 238266
* [MS ABI, DebugInfo] Omit the size for model-less pointers-to-membersDavid Majnemer2015-05-261-2/+12
| | | | | | | | | | | | | | The representation of a pointer-to-member in the MS ABI is governed by the layout of the relevant class or if a model has been explicitly specified. If no model is specified, then an appropriate "worst-case-scenario" model is implicitly chosen if, and only, if the pointer-to-member type's representation was needed. Debug info cannot force a pointer-to-member type to have a representation so do not try to query the size of such a type unless we know it is safe to do so. llvm-svn: 238259
* [CodeGen] Handle flexible array members containing pointers to membersDavid Majnemer2015-05-261-0/+8
| | | | | | | | | | Types can be classified as being zero-initializable or non-zero-initializable. We used to classify array types by giving them the classification of their base element type. However, incomplete array types are never initialized directly and thus are always zero-initializable. llvm-svn: 238256
* [MIPS] Re-land the change r238200 to fix extension of integer typesPetar Jovanovic2015-05-261-4/+4
| | | | | | | | Re-land the change r238200, but with modifications in the tests that should prevent new failures in some environments as reported with the original change on the mailing list. llvm-svn: 238253
* __declspec is not a core Clang language extension. Instead, require ↵Aaron Ballman2015-05-266-20/+20
| | | | | | | -fms-extensions or -fborland to enable the language extension. Note: __declspec is also temporarily enabled when compiling for a CUDA target because there are implementation details relying on __declspec(property) support currently. When those details change, __declspec should be disabled for CUDA targets. llvm-svn: 238238
* Revert r238200: "[MIPS] fix extension of integer types (function calls)"Hans Wennborg2015-05-261-4/+4
| | | | | | mips-unsigned-ext-var.c and mips-unsigned-extend.c fail in some builds. llvm-svn: 238237
* [MIPS] fix extension of integer types (function calls)Petar Jovanovic2015-05-261-4/+4
| | | | | | | | | | On MIPS unsigned int type should not be zero extended but sign-extended. Patch by Strahinja Petrovic. Differential Revision: http://reviews.llvm.org/D9198 llvm-svn: 238200
* [MS ABI] Implement restrict qualified referencesDavid Majnemer2015-05-261-0/+4
| | | | | | MSVC 2015 supports '__restrict' qualified reference types. llvm-svn: 238166
* Itanium mangler: don't trip an assertion when unresolved members have ↵Douglas Gregor2015-05-211-0/+12
| | | | | | | | | | | | implicit bases. When we find a member of the current instantation, the base of the unresolved member expression is implicit; use nullptr for such bases. This is not a change in behavior: the AST already contains null in such cases, so non-asserts builds do the right thing already. Fixes rdar://problem/21020559. llvm-svn: 237929
* [MSVC] Handle out-of-line definition of static data member correctly (fix ↵Alexey Bataev2015-05-202-29/+52
| | | | | | | | | | | | | | | | | | for http://llvm.org/PR21164), by Alexey Frolov There are 3 cases of defining static const member: initialized inside the class, not defined outside the class. initialized inside the class, defined outside the class. not initialized inside the class, defined outside the class. Revision r213304 was supposed to fix the linkage problem of case (1), but mistakenly it made case (2) behave the same. As a result, out-of-line definition of static data member is not handled correctly. Proposed patch distinguishes between cases (1) and (2) and allows to properly emit static const members under –fms-compatibility option. This fixes http://llvm.org/PR21164. Differential Revision: http://reviews.llvm.org/D9850 llvm-svn: 237787
* Revert changes to DefaultABIInfo accidentally introduced in r208733Reid Kleckner2015-05-181-0/+12
| | | | | | | | | | | | Also add trivial handling of transparent unions. PPC32, MSP430, and XCore apparently all rely on DefaultABIInfo. This should worry you, because DefaultABIInfo is not implementing the rules of any particular ABI. Fixes PR23097, patch by Andy Gibbs. llvm-svn: 237630
* Detect uses of mismatching forms of 'new' and 'delete'Ismail Pazarbasi2015-05-181-2/+2
| | | | | | | | | | | | | | | | | Emit warning when operand to `delete` is allocated with `new[]` or operand to `delete[]` is allocated with `new`. rev 2 update: `getNewExprFromInitListOrExpr` should return `dyn_cast_or_null` instead of `dyn_cast`, since `E` might be null. Reviewers: rtrieu, jordan_rose, rsmith Subscribers: majnemer, cfe-commits Differential Revision: http://reviews.llvm.org/D4661 llvm-svn: 237608
* [MS ABI] Give __attribute__((overloadable)) functions pretty namesDavid Majnemer2015-05-181-0/+3
| | | | | | | | It turns out that there is a mangling for 'extern "C"', it's only used by MSVC in /clr mode. Co-opt this mangling so that extern "C" functions marked overloadable get demangled nicely. llvm-svn: 237548
* [MS ABI] Function encodings are always encoded in template argumentsDavid Majnemer2015-05-181-0/+6
| | | | llvm-svn: 237547
* Implement no_sanitize attribute.Peter Collingbourne2015-05-151-3/+19
| | | | | | Differential Revision: http://reviews.llvm.org/D9631 llvm-svn: 237463
* Revert r237385, "[CodeGen] Reuse stack space from unused function results"NAKAMURA Takumi2015-05-151-125/+0
| | | | | | It broke clang stage2, at least tblgen. llvm-svn: 237418
* Revert "Detect uses of mismatching forms of 'new' and 'delete'"Diego Novillo2015-05-141-2/+2
| | | | | | | | | This reverts commit 742dc9b6c9686ab52860b7da39c3a126d8a97fbc. This is generating multiple segfaults in our internal builds. Test case coming up shortly. llvm-svn: 237391
* [CodeGen] Reuse stack space from unused function resultsSergey Dmitrouk2015-05-141-0/+125
| | | | | | | | | | | | | | | | | | | | Summary: Space on stack allocated for unused structures returned by functions was unused even when it's lifetime didn't intersect with lifetime of any other objects that could use the same space. The test added also checks for named and auto objects. It seems to make sense to have this all in one place. Reviewers: aadg, rsmith, rjmccall, rnk Reviewed By: rnk Subscribers: asl, cfe-commits Differential Revision: http://reviews.llvm.org/D9743 llvm-svn: 237385
* Detect uses of mismatching forms of 'new' and 'delete'Ismail Pazarbasi2015-05-141-2/+2
| | | | | | | | | | | | | Emit warning when operand to `delete` is allocated with `new[]` or operand to `delete[]` is allocated with `new`. Reviewers: rtrieu, jordan_rose, rsmith Subscribers: majnemer, cfe-commits Differential Revision: http://reviews.llvm.org/D4661 llvm-svn: 237368
* [AArch64 ACLE] Allow to define poly64_t as 'unsigned long long' on LLP64 system.Kevin Qin2015-05-141-0/+2
| | | | | | This fixes PR23414 as well. llvm-svn: 237348
* Changed renaming of local symbols by inserting a dot vefore the numeric suffixSunil Srivastava2015-05-1210-36/+36
| | | | | | | details in http://reviews.llvm.org/D9483 goes with llvm checkin r237150 llvm-svn: 237151
* [MS ABI] Import move assignment operatorsDavid Majnemer2015-05-111-2/+4
| | | | | | | MSVC 2015 changed behavior from 2013; it imports move assignment operators. llvm-svn: 236966
* [MS ABI] Form member pointers from virtual funcs overriding vbasesDavid Majnemer2015-05-101-0/+12
| | | | | | | | | | | | | | | We didn't supporting taking the address of virtual member functions which overrode a method in a virtual base. We simply need to encode the virtual base index in the member pointer. This fixes PR23452. N.B. There is no data member pointer side to this change because taking the address of a virtual bases' data member gives you a member pointer whose type is derived from the virtual bases' type, not the most derived type. llvm-svn: 236962
* [MS ABI] Update EH emission for MSVC 2015 compatibilityDavid Majnemer2015-05-101-0/+15
| | | | | | | | | | | | | MSVC 2015 renamed the symbol found by name lookup for 'std::terminate' so we cannot rely on using '?terminate@@YAXXZ'. Furthermore, it seems that 2015 will be the first release of MSVC which permits inlining a function which is noexcept into a function which isn't. This is implemented by creating a cleanup for the invoker which jumps to __std_terminate. Clang's implementation of this aspect of the MSVC scheme is slightly less efficient in this respect because we use a catch handler configured as a catch-all handler instead. llvm-svn: 236961
* Revert r236879, "Do not emit thunks with available_externally linkage in ↵NAKAMURA Takumi2015-05-091-26/+1
| | | | | | | | comdats" It broke pecoff, at least i686-cygwin. llvm-svn: 236937
* Do not emit thunks with available_externally linkage in comdatsDerek Schuff2015-05-081-1/+26
| | | | | | | | | | | | | | Functions with available_externally linkage will not be emitted to object files (they will just be undefined symbols), so it does not make sense to put them in comdats. Creates a second overload of maybeSetTrivialComdat that uses the GlobalObject instead of the Decl, and uses that in several places that had the faulty logic. Differential Revision: http://reviews.llvm.org/D9580 llvm-svn: 236879
* [MS ABI] Make sure we number thread_local statics seperatelyDavid Majnemer2015-05-071-1/+11
| | | | | | | The thread_local variables need their own numbers, they can't share with the other static local variables. llvm-svn: 236774
* Mark clang/test/CodeGenCXX/microsoft-abi-thread-safe-statics.cpp as ↵NAKAMURA Takumi2015-05-071-0/+2
| | | | | | REQUIRES:asserts. It relies on label names. llvm-svn: 236709
* Fix for http://llvm.org/PR23392: magick/feature.c from ImageMagick-6.9.1-2 ICEs.Alexey Bataev2015-05-071-4/+10
| | | | | | | Fix for codegen of static variables declared inside of captured statements. Captured statements are actually a transparent DeclContexts, so we have to skip them when trying to get a mangled name for statics. Differential Revision: http://reviews.llvm.org/D9522 llvm-svn: 236701
* [MS ABI] Implement thread-safe initialization using the MSVC 2015 ABIDavid Majnemer2015-05-074-13/+94
| | | | | | | | | The MSVC 2015 ABI utilizes a rather straightforward adaptation of the algorithm found in the appendix of N2382. While we are here, implement support for emitting cleanups if an exception is thrown while we are intitializing a static local variable. llvm-svn: 236697
* Update testcase to match r236539David Majnemer2015-05-051-1/+1
| | | | llvm-svn: 236542
* [MS ABI] Fix a crash in vptr path calculationDavid Majnemer2015-05-042-1/+30
| | | | | | | | | | | | | I discovered a case where the old algorithm would crash. Instead of trying to patch the algorithm, rewrite it. The new algorithm operates in three phases: 1. Find all paths to the subobject with the vptr. 2. Remove paths which are subsets of other paths. 3. Select the best path where 'best' is defined as introducing the most covariant overriders. If two paths introduce different overriders, raise a diagnostic. llvm-svn: 236444
* [MS ABI] Add testcase which was missing from r236354David Majnemer2015-05-021-0/+44
| | | | | | | This test verifies that we can detect when the inheritance paths are ambiguous due to covariant thunks, ensuring we don't regress PR16759. llvm-svn: 236381
* [MS ABI] NV bases may indirectly contain covariant thunks from V BasesDavid Majnemer2015-05-012-2/+19
| | | | | | | | | | | | A class might contain multiple ways of getting to a vbase, some of which are virtual and other non-virtual. It may be the case that a non-virtual base contains an override of a method in a vbase. This means that we must carefully pick between a set of nvbases to determine which is the best. As a consequence, the findPathForVPtr algorithm is considerably simpler. llvm-svn: 236353
* PR22354: Add a test that we emit copy-ctors for captures in generic lambdas.Richard Smith2015-04-301-0/+13
| | | | | | The bug was fixed by r235921. llvm-svn: 236254
* [MS ABI] Correctly make paths through covariant virtual basesDavid Majnemer2015-04-302-1/+28
| | | | | | | | | | | | There can be multiple virtual bases which are on the path to a vfptr when one vbase virtually inherits from another. We should prefer the most derived virtual base which covariantly overrides a method in the vfptr class; if we do not lengthen the path this way, we will end up with too few vftable entries. This fixes PR21073. llvm-svn: 236239
* Remove XFAIL now that this test passes (fixed by r236184).Richard Smith2015-04-301-1/+0
| | | | llvm-svn: 236194
* Update clang/test/CodeGenCXX/copy-constructor-synthesis-2.cpp to pass for ↵NAKAMURA Takumi2015-04-291-3/+3
| | | | | | | | targeting i686. r236155 missed the suffix in "@llvm.memcpy.p0i8.p0i8.i32". llvm-svn: 236184
* XFAIL Hexagon until more codegen in place.Rick Foos2015-04-291-0/+1
| | | | | | | | | | | | | | | | | | Summary: Hexagon is being updated, but there is not enough to pass these tests. These sections are now on top of Colin's list. Test Plan: Ran changes on hexagon-build-03. Reviewers: colinl, rfoos Reviewed By: rfoos Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D9356 llvm-svn: 236173
* Stop assuming a 64-bit target here.Richard Smith2015-04-291-3/+3
| | | | llvm-svn: 236155
* PR23373: A defaulted union copy constructor that is not trivial must still beRichard Smith2015-04-291-1/+21
| | | | | | emitted as a memcpy. llvm-svn: 236142
* Debug Info: Represent local anonymous unions as anonymous unionsAdrian Prantl2015-04-291-0/+18
| | | | | | | | | | | | | | | | and as artificial local variables in the debug info. This is a follow-up to r236059. We can't get rid of the local variables entirely because the gdb buildbot depends on them, but we can mark them as artificial while still emitting the correct debug info. As I learned from review comments other compilers also follow this model. A paired commit in LLVM temporarily relaxes the debug info verifier to not check the integrity of DW_OP_bit_pieces of artificial variables. rdar://problem/20730771 llvm-svn: 236125
* DebugInfo: Metadata constructs now start with DI*Duncan P. N. Exon Smith2015-04-2967-455/+455
| | | | | | | | | | LLVM r236120 renamed debug info IR constructs to use a `DI` prefix, now that the `DIDescriptor` hierarchy has been gone for about a week. This commit was generated using the rename-md-di-nodes.sh upgrade script attached to PR23080, followed by running clang-format-diff.py on the `lib/` portion of the patch. llvm-svn: 236121
* Revert "Debug Info: Represent local anonymous unions as anonymous unions"Adrian Prantl2015-04-291-18/+0
| | | | | | This reverts commit r236059 as it breaks the gdb buildbot. llvm-svn: 236110
* Debug Info: Represent local anonymous unions as anonymous unionsAdrian Prantl2015-04-281-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | in the debug info. This patch deletes a hack that emits the members of local anonymous unions as local variables. Besides being morally wrong, the existing representation using local variables breaks internal assumptions about the local variables' storage size. Compiling ``` void fn1() { union { int i; char c; }; i = c; } ``` with -g -O3 -verify will cause the verifier to fail after SROA splits the 32-bit storage for the "local variable" c into two pieces because the second piece is clearly outside the 8-bit range that is expected for a variable of type char. Given the choice I'd rather fix the debug representation than weaken the verifier. Debuggers generally already know how to deal with anonymous unions when they are members of C++ record types, but they may have problems finding the local anonymous struct members in the expression evaluator. rdar://problem/20730771 llvm-svn: 236059
* Fix assertion failure if a lambda array-capture is followed by a this capture.Richard Smith2015-04-281-0/+9
| | | | llvm-svn: 236043
* ms_struct does not imply the MS base-layout ABI; separate theseJohn McCall2015-04-281-0/+33
| | | | | | | | conditions in the IRGen struct layout code. rdar://20636558 llvm-svn: 235949
* [MS ABI] Use 'continue' instead of 'return false' where intendedReid Kleckner2015-04-271-0/+38
| | | | | | | | | | | | This was a bug in r218285 that prevented us from seeing subsequent virtual bases in the class hierarchy, leading to crashes later. Also add some comments to this function, now that we better understand what it's trying to do. Fixes PR21062 and PR21064. llvm-svn: 235899
* Correctly handle zero-sized but non-empty base classes in IRGen.John McCall2015-04-261-0/+16
| | | | | | | | | | | | | | | | Fixes rdar://20621065. A more elegant fix would preclude this case by defining the rules such that zero-size classes are always formally empty. I believe the only extensions which create zero-size classes right now are flexible arrays and zero-length arrays; it's not abstractly unreasonable to say that those don't count as members for the purposes of emptiness, just as zero-width bitfields don't count. But that's an ABI-affecting change and requires further discussion; in the meantime, let's not assert / miscompile. llvm-svn: 235815
* [MS ABI] Fix the preferred alignment of member pointersDavid Majnemer2015-04-241-29/+29
| | | | | | | Member pointers in the MS ABI have different alignment depending on whether they were created on the stack or live in a record. llvm-svn: 235681
OpenPOWER on IntegriCloud