summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/ItaniumMangle.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Improve name mangling for instantiation-dependent types that are notDouglas Gregor2011-07-121-15/+51
| | | | | | | | | | | | | | | | | | | | | | | | | 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-9/+2
| | | | llvm-svn: 134974
* Mangle dependent template names of unknown arityDouglas Gregor2011-07-121-10/+4
| | | | llvm-svn: 134967
* Implement the Itanium C++ ABI's mangling rule forDouglas Gregor2011-07-121-2/+23
| | | | | | non-instantiation-dependent sizeof and alignof expressions. llvm-svn: 134963
* Centralize the getCanonicalType() calls in the Itanium C++ manglingDouglas Gregor2011-07-121-9/+4
| | | | | | code so that they only occur in a single place. No functionality change. llvm-svn: 134961
* Just mangle substituted template parameter types as unresolved types.John McCall2011-07-011-10/+3
| | | | | | | 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
* Change the mangling of enclosing template template parametersJohn McCall2011-07-011-19/+73
| | | | | | | that serve as the base template name of an unresolved-name to be mangled as a substitution. llvm-svn: 134213
* No, actually, we do need to be able to mangle substituted template names.John McCall2011-06-301-3/+10
| | | | llvm-svn: 134195
* Preserve that a TemplateName was arrived at by substitutingJohn McCall2011-06-301-0/+4
| | | | | | | | | | | for a template template parameter. Uses to follow. I've also made the uniquing of SubstTemplateTemplateParmPacks use a ContextualFoldingSet as a minor space efficiency. llvm-svn: 134137
* Be more thorough about mangling unresolved types.John McCall2011-06-281-56/+101
| | | | llvm-svn: 134011
* Fix the mangling of dependent-scope decl ref expressions so that theyJohn McCall2011-06-211-20/+8
| | | | | | use the unresolved-name production correctly. llvm-svn: 133554
* Introduce a new AST node describing reference binding to temporaries.Douglas Gregor2011-06-211-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | MaterializeTemporaryExpr captures a reference binding to a temporary value, making explicit that the temporary value (a prvalue) needs to be materialized into memory so that its address can be used. The intended AST invariant here is that a reference will always bind to a glvalue, and MaterializeTemporaryExpr will be used to convert prvalues into glvalues for that binding to happen. For example, given const int& r = 1.0; The initializer of "r" will be a MaterializeTemporaryExpr whose subexpression is an implicit conversion from the double literal "1.0" to an integer value. IR generation benefits most from this new node, since it was previously guessing (badly) when to materialize temporaries for the purposes of reference binding. There are likely more refactoring and cleanups we could perform there, but the introduction of MaterializeTemporaryExpr fixes PR9565, a case where IR generation would effectively bind a const reference directly to a bitfield in a struct. Addresses <rdar://problem/9552231>. llvm-svn: 133521
* Objective-C++ ARC: do not mangle __unsafe_unretained lifetimeDouglas Gregor2011-06-171-2/+7
| | | | | | | | | | qualifiers, so that an __unsafe_unretained-qualified type T in ARC code will have the same mangling as T in non-ARC code, improving ABI interoperability. This works now because we infer or require a lifetime qualifier everywhere one can appear in an external interface. Another part of <rdar://problem/9595486>. llvm-svn: 133306
* Automatic Reference Counting.John McCall2011-06-151-2/+40
| | | | | | | | | | Language-design credit goes to a lot of people, but I particularly want to single out Blaine Garst and Patrick Beard for their contributions. Compiler implementation credit goes to Argyrios, Doug, Fariborz, and myself, in no particular order. llvm-svn: 133103
* Don't add objc method name mangling to locally declared function.Fariborz Jahanian2011-06-091-0/+6
| | | | | | // rdar://9566314 llvm-svn: 132791
* Add name mangling for expr .* expr. Fixes PR9983 / <rdar://problem/9486332>.Douglas Gregor2011-06-051-2/+6
| | | | llvm-svn: 132659
* Add support for builtin astype:Tanya Lattner2011-06-041-1/+3
| | | | | | | __builtin_astype(): Used to reinterpreted as another data type of the same size using for both scalar and vector data types. Added test case. llvm-svn: 132612
* Implement a new type node, UnaryTransformType, designed to represent aAlexis Hunt2011-05-241-0/+16
| | | | | | | | type that turns one type into another. This is used as the basis to implement __underlying_type properly - with TypeSourceInfo and proper behavior in the face of templates. llvm-svn: 132017
* Type prefixes of unresolved-names should only be mangled as unresolved-typesJohn McCall2011-05-041-15/+92
| | | | | | | | 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
* Store a parameter index and function prototype depth in everyJohn McCall2011-05-011-19/+143
| | | | | | | | | | parameter node and use this to correctly mangle parameter references in function template signatures. A follow-up patch will improve the storage usage of these fields; here I've just done the lazy thing. llvm-svn: 130669
* Implement the mangling for non-ADL call expressions that we justJohn McCall2011-04-281-2/+47
| | | | | | worked out. llvm-svn: 130376
* Implementation of Embarcadero array type traitsJohn Wiegley2011-04-281-0/+1
| | | | | | | | | | Patch authored by John Wiegley. These are array type traits used for parsing code that employs certain features of the Embarcadero C++ compiler: __array_rank(T) and __array_extent(T, Dim). llvm-svn: 130351
* Make yet another placeholder type, this one marking that an expression is a ↵John McCall2011-04-261-0/+1
| | | | | | | | | | | bound member function, i.e. something of the form 'x.f' where 'f' is a non-static member function. Diagnose this in the general case. Some of the new diagnostics are probably worse than the old ones, but we now get this right much more universally, and there's certainly room for improvement in the diagnostics. llvm-svn: 130239
* t/clang/expr-traitsJohn Wiegley2011-04-251-0/+1
| | | | | | | | | Patch authored by David Abrahams. These two expression traits (__is_lvalue_expr, __is_rvalue_expr) are used for parsing code that employs certain features of the Embarcadero C++ compiler. llvm-svn: 130122
* GCC seems to create address-of expression manglings when passing *any*John McCall2011-04-241-2/+1
| | | | | | | 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-77/+206
| | | | | | | | | | 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-5/+18
| | | | | | | 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
* Support for C++11 (non-template) alias declarations.Richard Smith2011-04-151-1/+1
| | | | llvm-svn: 129567
* fix a bunch of comment typos found by codespell. Patch byChris Lattner2011-04-151-1/+1
| | | | | | Luis Felipe Strano Moraes! llvm-svn: 129559
* C1X: implement generic selectionsPeter Collingbourne2011-04-151-0/+1
| | | | | | | As an extension, generic selection support has been added for all supported languages. The syntax is the same as for C1X. llvm-svn: 129554
* Basic, untested implementation for an "unknown any" type requested by LLDB.John McCall2011-04-071-0/+1
| | | | | | | | | | | | The idea is that you can create a VarDecl with an unknown type, or a FunctionDecl with an unknown return type, and it will still be valid to access that object as long as you explicitly cast it at every use. I'm still going back and forth about how I want to test this effectively, but I wanted to go ahead and provide a skeletal implementation for the LLDB folks' benefit and because it also improves some diagnostic goodness for placeholder expressions. llvm-svn: 129065
* Do not use IR marker for LLVM intrinsicsPeter Collingbourne2011-04-061-2/+3
| | | | llvm-svn: 129001
* File-scope static functions need to be mangled with 'L' so thatJohn McCall2011-03-221-4/+6
| | | | | | | | 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. llvm-svn: 128072
* Add support for the OpenCL vec_step operator, by generalising andPeter Collingbourne2011-03-111-4/+16
| | | | | | | extending the existing support for sizeof and alignof. Original patch by Guy Benyei. llvm-svn: 127475
* Add a missing break, from John WiegleyDouglas Gregor2011-03-031-0/+1
| | | | llvm-svn: 126919
* When we encounter a dependent template name within aDouglas Gregor2011-02-281-1/+12
| | | | | | | | | | | | nested-name-specifier, e.g., T::template apply<U>:: represent the dependent template name specialization as a DependentTemplateSpecializationType, rather than a TemplateSpecializationType with a dependent TemplateName. llvm-svn: 126593
* Teach NestedNameSpecifier to keep track of namespace aliases the sameDouglas Gregor2011-02-241-0/+3
| | | | | | | | way it keeps track of namespaces. Previously, we would map from the namespace alias to its underlying namespace when building a nested-name-specifier, losing source information in the process. llvm-svn: 126358
* Mangling of undeduced 'auto' types, as specified by Itanium C++ ABI.Richard Smith2011-02-211-2/+5
| | | | llvm-svn: 126140
* Implement the C++0x deduced 'auto' feature.Richard Smith2011-02-201-3/+6
| | | | | | This fixes PR 8738, 9060 and 9132. llvm-svn: 126069
* Change the representation of GNU ?: expressions to use a different expressionJohn McCall2011-02-171-0/+12
| | | | | | | | | | | | | | | | | | | | | | class and to bind the shared value using OpaqueValueExpr. This fixes an unnoticed problem with deserialization of these expressions where the deserialized form would lose the vital pointer-equality trait; or rather, it fixes it because this patch also does the right thing for deserializing OVEs. Change OVEs to not be a "temporary object" in the sense that copy elision is permitted. This new representation is not totally unawkward to work with, but I think that's really part and parcel with the semantics we're modelling here. In particular, it's much easier to fix things like the copy elision bug and to make the CFG look right. I've tried to update the analyzer to deal with this in at least some obvious cases, and I think we get a much better CFG out, but the printing of OpaqueValueExprs probably needs some work. llvm-svn: 125744
* Add a hack to avoid adding '\01' to asm names when possible. It would beRafael Espindola2011-02-151-1/+12
| | | | | | | better for clang to always compute the right name, but for now this hack fixes PR9177 and lets us build firefox with LTO :-) llvm-svn: 125607
* For consistency, use llvm::raw_ostream in the rest of the mangle api.Rafael Espindola2011-02-111-32/+19
| | | | llvm-svn: 125360
* Use raw_ostream instead of raw_svector_ostream.Rafael Espindola2011-02-111-11/+11
| | | | llvm-svn: 125330
* Use raw_svector_ostream in more places in the mangler.Rafael Espindola2011-02-101-27/+37
| | | | llvm-svn: 125321
* AST, Sema, Serialization: add CUDAKernelCallExpr and related semantic actionsPeter Collingbourne2011-02-091-1/+2
| | | | llvm-svn: 125217
* Remove vtables from the Stmt hierarchy; this was pretty easy asJohn McCall2011-02-091-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | there were only three virtual methods of any significance. The primary way to grab child iterators now is with Stmt::child_range children(); Stmt::const_child_range children() const; where a child_range is just a std::pair of iterators suitable for being llvm::tie'd to some locals. I've left the old child_begin() and child_end() accessors in place, but it's probably a substantial penalty to grab the iterators individually now, since the switch-based dispatch is kindof inherently slower than vtable dispatch. Grabbing them together is probably a slight win over the status quo, although of course we could've achieved that with vtables, too. I also reclassified SwitchCase (correctly) as an abstract Stmt class, which (as the first such class that wasn't an Expr subclass) required some fiddling in a few places. There are somewhat gross metaprogramming hooks in place to ensure that new statements/expressions continue to implement getSourceRange() and children(). I had to work around a recent clang bug; dgregor actually fixed it already, but I didn't want to introduce a selfhosting dependency on ToT. llvm-svn: 125183
* When mangling a qualified array type, push the qualifiers down to theJohn McCall2011-01-261-11/+25
| | | | | | element type. Fixes rdar://problem/8913416. llvm-svn: 124315
* Rvalue references for *this: add name mangling for ref-qualifiers,Douglas Gregor2011-01-261-4/+28
| | | | | | | | using rules that I just made up this morning. This encoding has now been proposed to the Itanium C++ ABI group for inclusion, but of course it's still possible that the mangling will change. llvm-svn: 124296
* Change QualType::getTypePtr() to return a const pointer, then change aJohn McCall2011-01-191-1/+2
| | | | | | thousand other things which were (generally inadvertantly) relying on that. llvm-svn: 123814
* Introduce a new kind of TemplateName that captures a substitutedDouglas Gregor2011-01-151-0/+6
| | | | | | | | | | | | | | | template template parameter pack that cannot be fully expanded because its enclosing pack expansion could not be expanded. This form of TemplateName plays the same role as SubstTemplateTypeParmPackType and SubstNonTypeTemplateParmPackExpr do for template type parameter packs and non-type template parameter packs, respectively. We should now handle these multi-level pack expansion substitutions anywhere. The largest remaining gap in our variadic-templates support is that we cannot cope with non-type template parameter packs whose type is a pack expansion. llvm-svn: 123521
OpenPOWER on IntegriCloud