summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGenCXX/mangle.cpp
Commit message (Collapse)AuthorAgeFilesLines
* IR: print value numbers for unnamed function argumentsTim Northover2019-08-031-4/+4
| | | | | | | | | | For consistency with normal instructions and clarity when reading IR, it's best to print the %0, %1, ... names of function arguments in definitions. Also modifies the parser to accept IR in that form for obvious reasons. llvm-svn: 367755
* Implement C++ [basic.link]p8.Richard Smith2017-09-201-1/+2
| | | | | | | | | | | | | | If a function or variable has a type with no linkage (and is not extern "C"), any use of it requires a definition within the same translation unit; the idea is that it is not possible to define the entity elsewhere, so any such use is necessarily an error. There is an exception, though: some types formally have no linkage but nonetheless can be referenced from other translation units (for example, this happens to anonymous structures defined within inline functions). For entities with those types, we suppress the diagnostic except under -pedantic. llvm-svn: 313729
* Strengthen test from r292632 to also check we get the mangling correct for ↵Richard Smith2017-01-241-2/+3
| | | | | | this case. llvm-svn: 292978
* Fix actually-reachable llvm_unreachable.Richard Smith2017-01-201-0/+11
| | | | llvm-svn: 292632
* Fix bug where one of the cases where we mangle a <bare-unresolved-name> failedRichard Smith2016-10-241-0/+7
| | | | | | | | to emit the <template-args> portion. Refactor so that mangleUnresolvedName actually emits the entire <unresolved-name>, so this mistake is harder to make again. llvm-svn: 285022
* Fix mangling of implicit calls to operator-> to only include a single "pt",Richard Smith2016-10-241-0/+7
| | | | | | rather than including an extra one for each level of 'operator->()' invoked. llvm-svn: 285015
* [ItaniumMangle] Mangle dependent __underlying_type correctlyDavid Majnemer2016-06-081-0/+10
| | | | | | | | | | We attempted to use the UnaryTransformType's UnderlyingType instead of it's BaseType. This is not correct for dependent UnaryTransformType because the have no underlying type. This fixes PR28045. llvm-svn: 272079
* Sema: Properly track mangling number/name for linkage for using declsDavid Majnemer2015-03-111-0/+30
| | | | | | | | | | | | Using declarations which are aliases to struct types have their name used as the struct type's name for linkage purposes. Otherwise, make sure to give an anonymous struct defined inside a using declaration a mangling number to disambiguate it from other anonymous structs in the same context. This fixes PR22809. llvm-svn: 231909
* Update Clang tests to handle explicitly typed load changes in LLVM.David Blaikie2015-02-271-1/+1
| | | | llvm-svn: 230795
* Itanium ABI: Pack expansions change the arity of expressions to unknownDavid Majnemer2015-02-191-0/+9
| | | | llvm-svn: 229918
* Itanium ABI: Properly qualify the destructor-nameDavid Majnemer2015-02-191-1/+15
| | | | | | | We didn't have enough qualificaiton before the scope specifier and we had too much qualification in the destructor name itself. llvm-svn: 229809
* Itanium ABI: Mangle <mangled-name> according to the ABIDavid Majnemer2015-02-181-1/+1
| | | | | | | | | | | | | | | We attempted to be compatible with GCC's buggy mangling for templates with a declaration for a template argument. However, we weren't completely successful in copying their bug in cases like: char foo; template <char &C> decltype(C) f() { return foo; }; template char &f<foo>(); Instead, just follow the ABI specification. This fixes PR22621. llvm-svn: 229644
* Itanium ABI: Improve our mangling of <destructor-name>David Majnemer2015-02-181-0/+11
| | | | | | | | | | | | | Our mangling of <destructor-name> wasn't quite right: we'd introduce mangling substitutions where one shouldn't be possible. We also didn't correctly handle the case where the destroyed type was not dependent but still a TemplateSpecializationType. N.B. There isn't a mangling for a template-template parameter showing up as the destroyed type. We do the 'obvious' thing and mangle the index of the parameter. llvm-svn: 229615
* ItaniumMangle: Correctly mangle <base-unresolved-name>David Majnemer2015-02-141-8/+32
| | | | | | | | | | We had two bugs: - We were missing the "on" prefix for unresolved operators. - We didn't handle the mangling of destructors at all. This fixes PR22584. llvm-svn: 229255
* Itanium ABI: Template template parameters are usable as substitutionsDavid Majnemer2014-10-241-0/+22
| | | | | | | | | | | | | Template template parameters weren't added to the list of substitutions. This would make the substitution map contain inaccurate mappings, leading to Clang violating the Itanium ABI and breaking compatibility with GCC. This fixes PR21351. Differential Revision: http://reviews.llvm.org/D5959 llvm-svn: 220588
* Mark C++ reference parameters as dereferenceableHal Finkel2014-07-181-4/+4
| | | | | | | | | | | | | | Because references must be initialized using some evaluated expression, they must point to something, and a callee can assume the reference parameter is dereferenceable. Taking advantage of a new attribute just added to LLVM, mark them as such. Because dereferenceability in addrspace(0) implies nonnull in the backend, we don't need both attributes. However, we need to know the size of the object to use the dereferenceable attribute, so for incomplete types we still emit only nonnull. llvm-svn: 213386
* Add 'nonnull' parameter or return attribute when producing an llvm pointer ↵Nick Lewycky2014-05-281-5/+5
| | | | | | type in a function type where the C++ type is a reference. Update the tests. llvm-svn: 209723
* AST: Elaborated type specifier mangling occurs before nested-nameDavid Majnemer2014-04-151-4/+4
| | | | | | The Ts/Tu/Te manglings should occur before the nested-name's N. llvm-svn: 206247
* AST: Implement proposal for dependent elaborated type specifiersDavid Majnemer2014-04-101-0/+40
| | | | | | | | | cxx-abi-dev came up with a way to disambiguate between different keywords used in elaborated type specifiers. This resolves certain collisions during mangling. llvm-svn: 205943
* Output destructors and constructors in a more natural order.Rafael Espindola2013-12-091-1/+1
| | | | | | | | | | | | | | | | 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
* Sema: Do not allow overloading between methods based on restrictDavid Majnemer2013-11-031-0/+9
| | | | | | | | | | | | | | | | If the sole distinction between two declarations is that one has a __restrict qualifier then we should not consider it to be an overload. Instead, we will consider it as an incompatible redeclaration which is similar to how MSVC, ICC and GCC would handle it. This fixes PR17786. N.B. We must not mangle in __restrict into method qualifiers becase we don't allow overloading between such declarations anymore. To do otherwise would be a violation of the Itanium ABI. llvm-svn: 193964
* AST: Mangle fields in anonymous structs/unionsDavid Majnemer2013-10-231-0/+9
| | | | | | | | | | | | | The Itanium mangler couldn't cope with mangling an IndirectFieldDecl. Instead, mangle the field the IndirectFieldDecl refers to. Further, give IndirectFieldDecl no linkage just like FieldDecl. N.B. Decl.cpp:getLVForNamespaceScopeDecl tried to calculate linkage for data members of anonymous structs/unions. However, this seems impossible so turn it into an assertion. llvm-svn: 193269
* Switch the semantic DeclContext for a block-scope declaration of a function orRichard Smith2013-09-201-6/+6
| | | | | | | | | | | | | | variable from being the function to being the enclosing namespace scope (in C++) or the TU (in C). This allows us to fix a selection of related issues where we would build incorrect redeclaration chains for such declarations, and fail to notice type mismatches. Such declarations are put into a new IdentifierNamespace, IDNS_LocalExtern, which is only found when searching scopes, and not found when searching DeclContexts. Such a declaration is only made visible in its DeclContext if there are no non-LocalExtern declarations. llvm-svn: 191064
* Sema: Subst type default template args earlierDavid Majnemer2013-08-281-0/+23
| | | | | | | | | | | | | | | | | Summary: We would not perform substitution at an appropriate point, allowing strange results to appear. We would accepts things that we shouldn't or mangle things incorrectly. Note that this hasn't fixed the other cases like template-template parameters or non-type template parameters. Reviewers: doug.gregor, rjmccall, rsmith Reviewed By: rsmith CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D1507 llvm-svn: 189540
* CHECK-LABEL-ify some code gen tests to improve diagnostic experience when ↵Stephen Lin2013-08-151-84/+84
| | | | | | tests fail. llvm-svn: 188447
* More local mangling fixes.Eli Friedman2013-07-101-1/+14
| | | | | | | | | | | | Compute mangling numbers for externally visible local variables and tags. Change the mangler to consistently use discriminators where necessary. Tweak the scheme we use to number decls which are not externally visible to avoid unnecessary discriminators in common cases now that we request them more consistently. Fixes <rdar://problem/14204721>. llvm-svn: 185986
* Fix a crash when we were trying to compute the linkage too early.Rafael Espindola2013-05-281-0/+22
| | | | llvm-svn: 182773
* Use the target address space value when mangling names.Tanya Lattner2013-02-081-0/+3
| | | | llvm-svn: 174688
* Provide the correct mangling and linkage for certain unnamed nested classes.David Blaikie2012-11-141-1/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | This corrects the mangling and linkage of classes (& their member functions) in cases like this: struct foo { struct { void func() { ... } } x; }; we were accidentally giving this nested unnamed struct 'no' linkage where it should've had the linkage of the outer class. The mangling was incorrecty too, mangling as TU-wide unnamed type mangling of $_X rather than class-scoped mangling of UtX_. This also fixes -Wunused-member-function which would incorrectly diagnose 'func' as unused due to it having no linkage & thus appearing to be TU-local when in fact it might be correctly used in another TU. Similar mangling should be applied to function local classes in similar cases but I've deferred that for a subsequent patch. Review/discussion by Richard Smith, John McCall, & especially Eli Friedman. llvm-svn: 167906
* Revert r163829. The world (or libstdc++, at least) is not ready.Richard Smith2012-09-131-2/+2
| | | | llvm-svn: 163846
* Remove speculative fix for C++ core issue 1407, since it was resolved as NAD.Richard Smith2012-09-131-2/+2
| | | | llvm-svn: 163829
* 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. llvm-svn: 149256
* 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. llvm-svn: 148439
* 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! llvm-svn: 141900
* 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. llvm-svn: 139991
* 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>. llvm-svn: 134984
* Implement name mangling for sizeof...(function parameter pack).Douglas Gregor2011-07-121-0/+10
| | | | llvm-svn: 134974
* Mangle dependent template names of unknown arityDouglas Gregor2011-07-121-0/+13
| | | | llvm-svn: 134967
* Implement the Itanium C++ ABI's mangling rule forDouglas Gregor2011-07-121-0/+16
| | | | | | non-instantiation-dependent sizeof and alignof expressions. llvm-svn: 134963
* Allow us to compute linkage et al for instantiation-dependent types.Douglas Gregor2011-07-111-0/+8
| | | | llvm-svn: 134932
* 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. llvm-svn: 134227
* 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. llvm-svn: 134225
* 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. llvm-svn: 134213
* Be more thorough about mangling unresolved types.John McCall2011-06-281-0/+42
| | | | llvm-svn: 134011
* Fix the mangling of dependent-scope decl ref expressions so that theyJohn McCall2011-06-211-5/+5
| | | | | | use the unresolved-name production correctly. llvm-svn: 133554
* 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). llvm-svn: 130824
* 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). llvm-svn: 130342
* 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. llvm-svn: 130084
* 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. llvm-svn: 130083
* 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. llvm-svn: 130081
OpenPOWER on IntegriCloud