summaryrefslogtreecommitdiffstats
path: root/test/CodeGenCXX/mangle.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Per discussion on cxx-abi-dev, don't drop leading zeroes from theJohn McCall2012-01-301-0/+8
| | | | | | | | | mangling of floating-point literals. I just went ahead and reimplemented toString() here; if someone wants to generalize the library routine to do this, or feels strongly that we should be post-processing, please feel free. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149256 91177308-0d34-0410-b5e6-96231b3b80d8
* constexpr: converted constant expression handling for enumerator values, caseRichard Smith2012-01-181-3/+0
| | | | | | | | | | | values and non-type template arguments of integral and enumeration types. This change causes some legal C++98 code to no longer compile in C++11 mode, by enforcing the C++11 rule that narrowing integral conversions are not permitted in the final implicit conversion sequence for the above cases. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148439 91177308-0d34-0410-b5e6-96231b3b80d8
* Update all tests other than Driver/std.cpp to use -std=c++11 rather thanRichard Smith2011-10-131-1/+1
| | | | | | | -std=c++0x. Patch by Ahmed Charles! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141900 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix PR10531. Attach an initializer to anonymous unions, since the default ↵Richard Smith2011-09-181-11/+0
| | | | | | constructor might not be trivial (if there is an in-class initializer for some member) and might be deleted. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139991 91177308-0d34-0410-b5e6-96231b3b80d8
* Improve name mangling for instantiation-dependent types that are notDouglas Gregor2011-07-121-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | dependent. This covers an odd class of types such as int (&)[sizeof(sizeof(T() + T()))]; which involve template parameters but, because of some trick typically involving a form of expression that is never type-dependent, resolve down to a non-dependent type. Such types need to be mangled essentially as they were written in the source code (involving template parameters), rather than via their canonical type. In general, instantiation-dependent types should be mangled as they were written in the source. However, since we can't do that now without non-trivial refactoring of the AST (see the new FIXME), I've gone for this partial solution: only use the as-written-in-the-source mangling for these strange types that are instantiation-dependent but not dependent. This provides better compatibility with previous incarnations of Clang and with GCC. In the future, we'd like to get this right. Fixes <rdar://problem/9663282>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134984 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement name mangling for sizeof...(function parameter pack).Douglas Gregor2011-07-121-0/+10
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134974 91177308-0d34-0410-b5e6-96231b3b80d8
* Mangle dependent template names of unknown arityDouglas Gregor2011-07-121-0/+13
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134967 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement the Itanium C++ ABI's mangling rule forDouglas Gregor2011-07-121-0/+16
| | | | | | | non-instantiation-dependent sizeof and alignof expressions. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134963 91177308-0d34-0410-b5e6-96231b3b80d8
* Allow us to compute linkage et al for instantiation-dependent types.Douglas Gregor2011-07-111-0/+8
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134932 91177308-0d34-0410-b5e6-96231b3b80d8
* Just mangle substituted template parameter types as unresolved types.John McCall2011-07-011-0/+32
| | | | | | | | | This is kindof questionable but seems to do more-or-less the right thing. This is not a particularly friendly part of the ABI. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134227 91177308-0d34-0410-b5e6-96231b3b80d8
* Introduce the notion of instantiation dependence into Clang's AST. ADouglas Gregor2011-07-011-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | type/expression/template argument/etc. is instantiation-dependent if it somehow involves a template parameter, even if it doesn't meet the requirements for the more common kinds of dependence (dependent type, type-dependent expression, value-dependent expression). When we see an instantiation-dependent type, we know we always need to perform substitution into that instantiation-dependent type. This keeps us from short-circuiting evaluation in places where we shouldn't, and lets us properly implement C++0x [temp.type]p2. In theory, this would also allow us to properly mangle instantiation-dependent-but-not-dependent decltype types per the Itanium C++ ABI, but we aren't quite there because we still mangle based on the canonical type in cases like, e.g., template<unsigned> struct A { }; template<typename T> void f(A<sizeof(sizeof(decltype(T() + T())))>) { } template void f<int>(A<sizeof(sizeof(int))>); and therefore get the wrong answer. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134225 91177308-0d34-0410-b5e6-96231b3b80d8
* Change the mangling of enclosing template template parametersJohn McCall2011-07-011-3/+1
| | | | | | | | | that serve as the base template name of an unresolved-name to be mangled as a substitution. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134213 91177308-0d34-0410-b5e6-96231b3b80d8
* Be more thorough about mangling unresolved types.John McCall2011-06-281-0/+42
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134011 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix the mangling of dependent-scope decl ref expressions so that theyJohn McCall2011-06-211-5/+5
| | | | | | | | use the unresolved-name production correctly. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133554 91177308-0d34-0410-b5e6-96231b3b80d8
* Type prefixes of unresolved-names should only be mangled as unresolved-typesJohn McCall2011-05-041-4/+39
| | | | | | | | | | if they match that production, i.e. if they're template type parameters or decltypes (or, as an obvious case not yet described in the ABI document, if they're template template parameters applied to template arguments). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130824 91177308-0d34-0410-b5e6-96231b3b80d8
* t/clang/type-traitsJohn Wiegley2011-04-271-10/+10
| | | | | | | | | | Patch authored by John Wiegley. These type traits are used for parsing code that employs certain features of the Embarcadero C++ compiler. Several of these constructs are also desired by libc++, according to its project pages (such as __is_standard_layout). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130342 91177308-0d34-0410-b5e6-96231b3b80d8
* GCC seems to create address-of expression manglings when passing *any*John McCall2011-04-241-0/+12
| | | | | | | | | function as a template argument where a pointer to function is wanted. Just extend the existing hack. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130084 91177308-0d34-0410-b5e6-96231b3b80d8
* Update the mangler for some of the "new" unresolved-name manglings.John McCall2011-04-241-7/+10
| | | | | | | | | | | | I've sent off an email requesting clarification on a few things that I wasn't sure how to handle. This also necessitated making prefixes and unresolved-prefixes get mangled separately. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130083 91177308-0d34-0410-b5e6-96231b3b80d8
* The ABI settled on mangling float literals with lowercase hex dumps.John McCall2011-04-241-1/+1
| | | | | | | | | APInt::toString doesn't do those, but it's easy to postprocess that output, and that's probably better than adding another knob to that method. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130081 91177308-0d34-0410-b5e6-96231b3b80d8
* File-scope static functions need to be mangled with 'L' so thatJohn McCall2011-03-221-1/+15
| | | | | | | | | | they don't collide with file-scope extern functions from the same translation unit. This is basically a matter of applying the same logic to FunctionDecls as we were previously applying to VarDecls. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128072 91177308-0d34-0410-b5e6-96231b3b80d8
* When mangling a qualified array type, push the qualifiers down to theJohn McCall2011-01-261-0/+12
| | | | | | | | element type. Fixes rdar://problem/8913416. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124315 91177308-0d34-0410-b5e6-96231b3b80d8
* Mangle std::nullptr_t as specified by the Itanium C++ ABI.Anders Carlsson2010-11-041-0/+5
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118236 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a crash mangling decayed val argument-typed function.Fariborz Jahanian2010-11-021-0/+6
| | | | | | | // rdar: //8620510 and PR7666 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118019 91177308-0d34-0410-b5e6-96231b3b80d8
* Mangle explicit template arguments in dependent or overloaded names.John McCall2010-08-201-3/+42
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111591 91177308-0d34-0410-b5e6-96231b3b80d8
* Contextual arity is a feature of mangling expressions; kill offJohn McCall2010-08-181-0/+28
| | | | | | | | | | mangleCallExpression. Also, operator names with unknown arity should be mangled as binary operators; this is actually covered by an oddly- positioned sentence in the ABI document. Fixes PR7891. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111395 91177308-0d34-0410-b5e6-96231b3b80d8
* Whoops. Don't fall through into the overload case when mangling aJohn McCall2010-08-171-0/+17
| | | | | | | | dependent call expression. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111300 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't crash when mangling empty anonymous unions. We never actually *need*John McCall2010-08-051-0/+11
| | | | | | | | | these, but it's convenient to mangle them when deferring them (in the 99.99% case where it's not an anonymous union, of course). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110381 91177308-0d34-0410-b5e6-96231b3b80d8
* Mangle enum constant expressions. Fixes rdar://problem/8204122John McCall2010-07-241-0/+11
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109315 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix mangling for static member variables of classes inside an extern "C"Eli Friedman2010-07-181-0/+11
| | | | | | | | | linkage specification. Not sure if this is the ideal fix, but I'm reasonably sure it's correct vs. gcc. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108656 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix the mangling of template template arguments, which do not alwaysJohn McCall2010-07-141-1/+12
| | | | | | | | | | follow <name>; instead they follow <type>, which has <name> as a subset. Fixes PR7446. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108326 91177308-0d34-0410-b5e6-96231b3b80d8
* Correctly mangle unsigned integer literals where the high bit is set.Anders Carlsson2010-06-021-0/+7
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105312 91177308-0d34-0410-b5e6-96231b3b80d8
* Correctly mangle variadic functions that don't have any other parameters.Anders Carlsson2010-06-021-0/+12
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105311 91177308-0d34-0410-b5e6-96231b3b80d8
* Provide manglings for bool and character literal expressions. These areJohn McCall2010-04-091-0/+9
| | | | | | | | | | just integer-literal expressions with special case implementations in the AST. Fixes rdar://problem/7825453. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100905 91177308-0d34-0410-b5e6-96231b3b80d8
* Turn access control on by default in -cc1.John McCall2010-04-091-1/+1
| | | | | | | | | | Remove -faccess-control from -cc1; add -fno-access-control. Make the driver pass -fno-access-control by default. Update a bunch of tests to be correct under access control. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100880 91177308-0d34-0410-b5e6-96231b3b80d8
* Correctly mangle dependent TypenameType.Rafael Espindola2010-03-171-0/+15
| | | | | | | | Fixes PR6625. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98707 91177308-0d34-0410-b5e6-96231b3b80d8
* Give explicit template instantiations weak ODR linkage. FormerDouglas Gregor2010-03-131-10/+10
| | | | | | | | | | iterations of this patch gave explicit template instantiation link-once ODR linkage, which permitted the back end to eliminate unused symbols. Weak ODR linkage still requires the symbols to be generated. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98441 91177308-0d34-0410-b5e6-96231b3b80d8
* Re-revert the explicit template instantiation linkage patch. I am beginning ↵Douglas Gregor2010-03-131-8/+8
| | | | | | to look incompetent git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98425 91177308-0d34-0410-b5e6-96231b3b80d8
* Reinstate patch to turn explicit template instantiations into weak symbolsDouglas Gregor2010-03-131-8/+8
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98424 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert the linkage change for explicit template instantiations; something is ↵Douglas Gregor2010-03-121-8/+8
| | | | | | amiss git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98332 91177308-0d34-0410-b5e6-96231b3b80d8
* Give explicit template instantiations weak linkage (but don't deferDouglas Gregor2010-03-121-8/+8
| | | | | | | them). Fixes PR6578. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98328 91177308-0d34-0410-b5e6-96231b3b80d8
* Correctly mangle address of member in template arguments. Fixes PR6460Rafael Espindola2010-03-111-0/+39
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98254 91177308-0d34-0410-b5e6-96231b3b80d8
* Split out types that are non-canonical unless dependent as their ownJohn McCall2010-03-011-1/+39
| | | | | | | | | | | | | category. Use this in a few places to eliminate unnecessary TST cases and do some future-proofing. Provide terrible manglings for typeof. Mangle decltype with some hope of accuracy. Our manglings for some of the cases covered in the testcase are different from gcc's, which I've raised as an issue with the ABI list. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97523 91177308-0d34-0410-b5e6-96231b3b80d8
* The latest draft uses 'dt' to mangle member expressions, and now so do we.John McCall2010-03-011-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97479 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert the ctor/dtor alias optimization for now; the buildbots can detectJohn McCall2010-02-181-2/+1
| | | | | | | | some failure here that I can't. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96612 91177308-0d34-0410-b5e6-96231b3b80d8
* Emit complete constructors and destructors as aliases to base constructorsJohn McCall2010-02-171-1/+2
| | | | | | | | | | and destructors when the two entities are semantically identical, i.e. when the class has no virtual base classes. We only do this for linkage types for which aliases are supported, i.e. internal and external, i.e. not linkonce. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96451 91177308-0d34-0410-b5e6-96231b3b80d8
* Only append 'L' for internal variable declarations, not all declarations. ↵Anders Carlsson2010-02-061-0/+4
| | | | | | (Found by the mangle checker, yay) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95485 91177308-0d34-0410-b5e6-96231b3b80d8
* Implement name mangling for template template parametersDouglas Gregor2010-02-051-0/+7
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95427 91177308-0d34-0410-b5e6-96231b3b80d8
* Mangle member expressions. Also invented.John McCall2010-02-041-0/+8
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95284 91177308-0d34-0410-b5e6-96231b3b80d8
* Add mangling support for calls, sizeof/alignof, constructor calls,John McCall2010-02-041-0/+35
| | | | | | | | float literals, and unresolved lookups (which required hand-wavey extensions). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95273 91177308-0d34-0410-b5e6-96231b3b80d8
* Mangle static variables with an extra name to distinguish them from ↵Sean Hunt2010-01-241-5/+13
| | | | | | | | | non-static variables in the same TU. Fixes PR5966 for real this time; also reverts r92911, which had a incorrect fix. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94352 91177308-0d34-0410-b5e6-96231b3b80d8