summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/MicrosoftMangle.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [c++2a] P0515R3: Support for overloaded operator<=>.Richard Smith2017-12-011-0/+9
| | | | | | No CodeGen support for MSABI yet, we don't know how to mangle this there. llvm-svn: 319513
* Dependent Address Space SupportAndrew Gozillon2017-10-021-0/+9
| | | | | | | | | | | | | | This patch relates to: https://reviews.llvm.org/D33666 This adds support for template parameters to be passed to the address_space attribute. The main goal is to add further flexibility to the attribute and allow for it to be used easily with templates. The main additions are a new type (DependentAddressSpaceType) alongside its TypeLoc and its mangling. As well as the logic required to support dependent address spaces which mainly resides in TreeTransform.h and SemaType.cpp. llvm-svn: 314649
* Recommit "Add _Float16 as a C/C++ source language type"Sjoerd Meijer2017-09-081-0/+1
| | | | | | | | This is a recommit of r312781; in some build configurations variable names are omitted, so changed the new regression test accordingly. llvm-svn: 312794
* Revert "Add _Float16 as a C/C++ source language type"Sjoerd Meijer2017-09-081-1/+0
| | | | | | | The clang-with-lto-ubuntu bot didn't like the new regression test, revert while I investigate the issue. llvm-svn: 312784
* Add _Float16 as a C/C++ source language typeSjoerd Meijer2017-09-081-0/+1
| | | | | | | | | | | This adds _Float16 as a source language type, which is a 16-bit floating point type defined in C11 extension ISO/IEC TS 18661-3. In follow up patches documentation and more tests will be added. Differential Revision: https://reviews.llvm.org/D33719 llvm-svn: 312781
* ObjC++: decorate ObjC interfaces in MSABI properlySaleem Abdulrasool2017-08-231-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | `id` needs to be handled specially since it is a `TypedefType` which is sugar for an `ObjCObjectPointerType` whose pointee is an `ObjCObjectType` with base `BuiltinType::ObjCIdType` and no protocols and the first level of pointer gets it own type implementation. `Class` is similar with the `ObjCClassType` as the base instead. The qualifiers on the base type of the `ObjCObjectType` need to be dropped because the innermost `mangleType` will handle the qualifiers itself. `id` is desugared to `struct objc_object *` which should be encoded as `PAUobjc_object@@`. `Class` is desugared to `struct objc_class *` which should be encoded as `PAUobjc_class@@`. We were previously applying an extra modifier `A` which will be handled during the recursive call. This now properly decorates interface types as well as `Class` and `id`. This corrects the interactions between C++ and ObjC++ for the type specifier decoration. llvm-svn: 311617
* [AArch64] Add support for __builtin_ms_va_list on aarch64Martin Storsjo2017-07-171-1/+1
| | | | | | | | | | | Move builtins from the x86 specific scope into the global scope. Their use is still limited to x86_64 and aarch64 though. This allows wine on aarch64 to properly handle variadic functions. Differential Revision: https://reviews.llvm.org/D34475 llvm-svn: 308218
* AST: enhance mangling for blocks with MS ABISaleem Abdulrasool2017-06-261-10/+65
| | | | | | | | | | | | When generating the decorated name for a static variable inside a BlockDecl, construct a scope for the block invocation function that homes the parameter. This allows for arbitrary nesting of the blocks even if the variables are shadowed. Furthermore, using this for the name allows for undname to properly undecorated the name for us. It shows up as the synthetic __block_invocation function that the compiler emitted in the local scope. llvm-svn: 306347
* Update MS mangling EBNF, NFCReid Kleckner2017-05-261-0/+2
| | | | llvm-svn: 304006
* [OpenCL] Correct ndrange_t implementationAnastasia Stulova2017-02-161-4/+0
| | | | | | | | | | | | | | | Removed ndrange_t as Clang builtin type and added as a struct type in the OpenCL header. Use type name to do the Sema checking in enqueue_kernel and modify IR generation accordingly. Review: D28058 Patch by Dmitry Borisenkov! llvm-svn: 295311
* Fix spelling mistake - paramater -> parameter. NFCI.Simon Pilgrim2017-02-151-1/+1
| | | | llvm-svn: 295183
* [MS ABI] Correctly mangling vbase destructorsDavid Majnemer2017-02-141-11/+22
| | | | | | | | | | | | | They are a little bit of a special case in the mangling. They are always mangled without taking into account their virtual-ness of the destructor. They are also mangled to return void, unlike the actual destructor. This fixes PR31931. Differential Revision: https://reviews.llvm.org/D29912 llvm-svn: 295010
* P0091R3: Implement basic parsing support for C++17 deduction-guides.Richard Smith2017-02-071-0/+3
| | | | | | | | | | | We model deduction-guides as functions with a new kind of name that identifies the template whose deduction they guide; the bulk of this patch is adding the new name kind. This gives us a clean way to attach an extensible list of guides to a class template in a way that doesn't require any special handling in AST files etc (and we're going to need these functions we come to performing deduction). llvm-svn: 294266
* PR0091R3: Implement parsing support for using templates as types.Richard Smith2017-01-261-0/+11
| | | | | | | | | | | | | | | This change adds a new type node, DeducedTemplateSpecializationType, to represent a type template name that has been used as a type. This is modeled around AutoType, and shares a common base class for representing a deduced placeholder type. We allow deduced class template types in a few more places than the standard does: in conditions and for-range-declarators, and in new-type-ids. This is consistent with GCC and with discussion on the core reflector. This patch does not yet support deduced class template types being named in typename specifiers. llvm-svn: 293207
* Remove unused lambda captures. NFCMalcolm Parsons2017-01-131-2/+2
| | | | llvm-svn: 291939
* Follow up to r291448: use isStructorDecl in one more placeReid Kleckner2017-01-091-1/+1
| | | | | | | This pointer comparison has shown to be error-prone, so use the standard helper for it. NFC llvm-svn: 291450
* [MS] Fix function type mangling of default ctor closuresReid Kleckner2017-01-091-6/+10
| | | | | | | | | Use the canonical decl in pointer comparisons with the default constructor closure decl. Otherwise we don't produce the correct "@@QAEXXZ" mangling, which essentially means "void(void) thiscall public instance method". llvm-svn: 291448
* [MS ABI] Mangle unnamed enums correctlyDavid Majnemer2016-12-251-2/+9
| | | | | | Unnamed enums take the name of the first enumerator they define. llvm-svn: 290509
* [MS ABI] Implement more of the Itanium mangling rulesDavid Majnemer2016-12-061-21/+52
| | | | | | | | | | | | We didn't implement handle corner cases like: - lambdas used to initialize a field - lambdas in default argument initializers This fixes PR31197. Differential Revision: https://reviews.llvm.org/D27226 llvm-svn: 288826
* regcall: Implement regcall Calling Conv in clangErich Keane2016-11-021-0/+2
| | | | | | | | | | This patch implements the register call calling convention, which ensures as many values as possible are passed in registers. CodeGen changes were committed in https://reviews.llvm.org/rL284108. Differential Revision: https://reviews.llvm.org/D25204 llvm-svn: 285849
* [Coroutines] Add proper mangling for operator co_await for MicrosoftABIGor Nishanov2016-09-281-8/+2
| | | | | | | | | | Reviewers: rnk, rsmith Subscribers: mehdi_amini, cfe-commits Differential Revision: https://reviews.llvm.org/D25045 llvm-svn: 282645
* P0217R3: code generation support for decomposition declarations.Richard Smith2016-08-151-1/+17
| | | | llvm-svn: 278642
* [MS ABI] Support throwing/catching __unaligned typesDavid Majnemer2016-07-121-3/+6
| | | | | | | | We need to mark the appropriate bits in ThrowInfo and HandlerType so that the personality routine can correctly handle qualification conversions. llvm-svn: 275154
* [MSVC2015] Fix mangling for static variables initialization guardsDmitry Polukhin2016-05-271-0/+1
| | | | | | | | | It seems that suffix '@4HA' was omitted for unknown reason. It is non-cont non-volatile 'int' type of normal variable TSS. Differential revision: http://reviews.llvm.org/D20683 llvm-svn: 270974
* [MSVC] Support for __unaligned qualifier in functionsAndrey Bokhanko2016-05-261-2/+3
| | | | | | | | | | | | | | | This implements support for MS-specific __unaligned qualifier in functions and makes the following test case both compile and mangle correctly: struct S { void f() __unaligned; }; void S::f() __unaligned { } Differential Revision: http://reviews.llvm.org/D20437 llvm-svn: 270834
* [MS ABI] Ignore transparent contexts when determining the effective contextDavid Majnemer2016-05-191-1/+1
| | | | | | | We didn't skip over extern "C++" contexts, causing us to mangle things which don't need to be mangled. llvm-svn: 270089
* [MSVC] Implementation of __unaligned as a proper type qualifierAndrey Bokhanko2016-05-111-0/+5
| | | | | | | | | | | This patch implements __unaligned (MS extension) as a proper type qualifier (before that, it was implemented as an ignored attribute). It also fixes PR27367 and PR27666. Differential Revision: http://reviews.llvm.org/D20103 llvm-svn: 269220
* Enable support for __float128 in Clang and enable it on pertinent platformsNemanja Ivanovic2016-05-091-0/+1
| | | | | | | | | | | | | | | | | | This patch corresponds to reviews: http://reviews.llvm.org/D15120 http://reviews.llvm.org/D19125 It adds support for the __float128 keyword, literals and target feature to enable it. Based on the latter of the two aforementioned reviews, this feature is enabled on Linux on i386/X86 as well as SystemZ. This is also the second attempt in commiting this feature. The first attempt did not enable it on required platforms which caused failures when compiling type_traits with -std=gnu++11. If you see failures with compiling this header on your platform after this commit, it is likely that your platform needs to have this feature enabled. llvm-svn: 268898
* Revert r268727, it caused PR27666.Nico Weber2016-05-061-5/+0
| | | | llvm-svn: 268736
* [MSVC] Implementation of __unaligned as a proper type qualifierAndrey Bokhanko2016-05-061-0/+5
| | | | | | | | | | | This patch implements __unaligned (MS extension) as a proper type qualifier (before that, it was implemented as an ignored attribute). It also fixes PR27367. Differential Revision: http://reviews.llvm.org/D19654 llvm-svn: 268727
* Revert 266186 as it breaks anything that includes type_traits on some platformsNemanja Ivanovic2016-04-151-1/+0
| | | | | | | | | | Since this patch provided support for the __float128 type but disabled it on all platforms by default, some platforms can't compile type_traits with -std=gnu++11 since there is a specialization with __float128. This reverts the patch until D19125 is approved (i.e. we know which platforms need this support enabled). llvm-svn: 266460
* Revert r266415, it broke parsing SDK headers (PR27367).Nico Weber2016-04-151-5/+0
| | | | llvm-svn: 266431
* [MSVC Compat] Implementation of __unaligned (MS extension) as a type qualifierAndrey Bokhanko2016-04-151-0/+5
| | | | | | | | | | | This patch implements __unaligned as a type qualifier; before that, it was modeled as an attribute. Proper mangling of __unaligned is implemented as well. Some OpenCL code/tests are tangenially affected, as they relied on existing number and sizes of type qualifiers. Differential Revision: http://reviews.llvm.org/D18596 llvm-svn: 266415
* Enable support for __float128 in ClangNemanja Ivanovic2016-04-131-0/+1
| | | | | | | | | | | | | | | | This patch corresponds to review: http://reviews.llvm.org/D15120 It adds support for the __float128 keyword, literals and a target feature to enable it. This support is disabled by default on all targets and any target that has support for this type is free to add it. Based on feedback that I've received from target maintainers, this appears to be the right thing for most targets. I have not heard from the maintainers of X86 which I believe supports this type. I will subsequently investigate the impact of enabling this on X86. llvm-svn: 266186
* [OpenCL] Move OpenCLImageTypes.def from clangAST to clangBasic library.Alexey Bader2016-04-131-1/+1
| | | | | | | | | | Putting OpenCLImageTypes.def to clangAST library violates layering requirement: "It's not OK for a Basic/ header to include an AST/ header". This fixes the modules build. Differential revision: http://reviews.llvm.org/D18954 Reviewers: Richard Smith, Vassil Vassilev. llvm-svn: 266180
* [OpenCL] Complete image types support.Alexey Bader2016-04-081-47/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I. Current implementation of images is not conformant to spec in the following points: 1. It makes no distinction with respect to access qualifiers and therefore allows to use images with different access type interchangeably. The following code would compile just fine: void write_image(write_only image2d_t img); kernel void foo(read_only image2d_t img) { write_image(img); } // Accepted code which is disallowed according to s6.13.14. 2. It discards access qualifier on generated code, which leads to generated code for the above example: call void @write_image(%opencl.image2d_t* %img); In OpenCL2.0 however we can have different calls into write_image with read_only and wite_only images. Also generally following compiler steps have no easy way to take different path depending on the image access: linking to the right implementation of image types, performing IR opts and backend codegen differently. 3. Image types are language keywords and can't be redeclared s6.1.9, which can happen currently as they are just typedef names. 4. Default access qualifier read_only is to be added if not provided explicitly. II. This patch corrects the above points as follows: 1. All images are encapsulated into a separate .def file that is inserted in different points where image handling is required. This avoid a lot of code repetition as all images are handled the same way in the code with no distinction of their exact type. 2. The Cartesian product of image types and image access qualifiers is added to the builtin types. This simplifies a lot handling of access type mismatch as no operations are allowed by default on distinct Builtin types. Also spec intended access qualifier as special type qualifier that are combined with an image type to form a distinct type (see statement above - images can't be created w/o access qualifiers). 3. Improves testing of images in Clang. Author: Anastasia Stulova Reviewers: bader, mgrang. Subscribers: pxli168, pekka.jaaskelainen, yaxunl. Differential Revision: http://reviews.llvm.org/D17821 llvm-svn: 265783
* Fix serialization/deserialization for __uuidofDavid Majnemer2016-03-281-1/+1
| | | | | | | | I broke this back in r264529 because I forgot to serialize the UuidAttr member. Fix this by replacing the UuidAttr with a StringRef which is properly serialized and deserialized. llvm-svn: 264562
* Improve the representation of CXXUuidofExprDavid Majnemer2016-03-271-1/+1
| | | | | | | | Keep a pointer to the UuidAttr that the CXXUuidofExpr corresponds to. This makes translating from __uuidof to the underlying constant a lot more straightforward. llvm-svn: 264529
* [MS ABI] Mangle symbols names longer than 4096 characters correctlyDavid Majnemer2016-03-071-42/+104
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Really long symbols are hashed using MD5 and prefixed/suffixed with the usual sigils. There is an additional reason beyond the usual compatibility with MSVC, it is important to keep COFF symbols shorter than 0xFFFF because the CodeView debugging format has a maximum symbol/record size of 0xFFFF. There are some quirks worth noting: - Some mangled names reference other entities which are mangled separately. A quick example: int I; template <int *> struct S {}; S<I> s; In this case, the mangling for 's' doesn't depend directly on the mangling for 'I'. While 's' would need an MD5 hash if 'I' also needed one, the hash for 's' applied to the fully realized mangled name. In other words, the mangled name for 's' will not depend on the MD5 of the mangled name for 'I'. - Some mangled names, like the venerable CatchableType, embed the MD5 verbatim. - Finally, the complete object locator is handled as a special case. A complete object locators are mangled exactly like a VFTable except for a small deviation in the prefix sigils. However, complete object locators for hashed vftables result in a complete object locator whose name is identical to the vftable except for an additional suffix. llvm-svn: 262818
* [OPENMP 4.0] Initial support for 'omp declare reduction' construct.Alexey Bataev2016-03-031-2/+4
| | | | | | | | | | | | | | | | | Add parsing, sema analysis and serialization/deserialization for 'declare reduction' construct. User-defined reductions are defined as #pragma omp declare reduction( reduction-identifier : typename-list : combiner ) [initializer ( initializer-expr )] These custom reductions may be used in 'reduction' clauses of OpenMP constructs. The combiner specifies how partial results can be combined into a single value. The combiner can use the special variable identifiers omp_in and omp_out that are of the type of the variables being reduced with this reduction-identifier. Each of them will denote one of the values to be combined before executing the combiner. It is assumed that the special omp_out identifier will refer to the storage that holds the resulting combined value after executing the combiner. As the initializer-expr value of a user-defined reduction is not known a priori the initializer-clause can be used to specify one. Then the contents of the initializer-clause will be used as the initializer for private copies of reduction list items where the omp_priv identifier will refer to the storage to be initialized. The special identifier omp_orig can also appear in the initializer-clause and it will refer to the storage of the original variable to be reduced. Differential Revision: http://reviews.llvm.org/D11182 llvm-svn: 262582
* Revert "Revert r260388 "[MS ABI] Never reference dllimport'd vtables""David Majnemer2016-02-111-1/+4
| | | | | | | | | | | | | This reverts commit r260449. We would supress our emission of vftable definitions if we thought another translation unit would provide the definition because we saw an explicit instantiation declaration. This is not the case with dllimport, we want to synthesize a definition of the vftable regardless. This fixes PR26569. llvm-svn: 260548
* Revert r260388 "[MS ABI] Never reference dllimport'd vtables"Hans Wennborg2016-02-101-4/+1
| | | | | | | This caused the compiler to fail with "invalid linkage type for global declaration" (PR26569). llvm-svn: 260449
* [MS ABI] Never reference dllimport'd vtablesDavid Majnemer2016-02-101-1/+4
| | | | | | | | | | | | | Referencing a dllimported vtable is impossible in a constexpr constructor. It would be friendlier to C++ programmers if we synthesized a copy of the vftable which referenced imported virtual functions. This would let us initialize the object in a way which preserves both the intent to import functionality from another DLL while also making constexpr work. Differential Revision: http://reviews.llvm.org/D17061 llvm-svn: 260388
* [MS ABI] Don't crash while mangling recursive lambdasDavid Majnemer2016-01-171-4/+12
| | | | | | | | | | | | | | | We might get into bad situations where we try to embed the signature of an inner lambda into an outer lambda which cannot work: the inner lambda wants to embed the name of the outer lambda! Instead, omit the return type for lambdas. This fixes PR26105. N.B. While we are here, make lambdas nested within functions use an artificial scope so that they can get demangled. llvm-svn: 258003
* [OpenCL] Pipe type supportXiuli Pan2016-01-091-0/+9
| | | | | | | | | | | | | | | Summary: Support for OpenCL 2.0 pipe type. This is a bug-fix version for bader's patch reviews.llvm.org/D14441 Reviewers: pekka.jaaskelainen, Anastasia Subscribers: bader, Anastasia, cfe-commits Differential Revision: http://reviews.llvm.org/D15603 llvm-svn: 257254
* [MS ABI] Remove mangleCXXCatchHandlerTypeDavid Majnemer2015-12-311-11/+0
| | | | | | It's dead code, no functional change is intended. llvm-svn: 256664
* [MS ABI] Change the ArgBackRefMap to hold const qualified pointersDavid Majnemer2015-12-311-2/+2
| | | | | | Just a cleanup, no functional change is intended. llvm-svn: 256663
* [MS ABI] Replace dead code with an assertionDavid Majnemer2015-12-311-2/+4
| | | | | | | As per C++ [dcl.ref]p1, cv-qualified references are not valid. As such, change the mangler to assert that this event does not happen. llvm-svn: 256662
* Silencing a -Wcast-qual warning; NFC.Aaron Ballman2015-12-301-1/+1
| | | | llvm-svn: 256644
* [MS ABI] Add variable templates to the NameBackReferencesDavid Majnemer2015-12-301-1/+1
| | | | | | | | Only function template specializations are exempt from being added to the NameBackReferences. Redundant variable template specializations should be appropriately substituted. llvm-svn: 256623