summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/MicrosoftMangle.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* [-cxx-abi microsoft] Unnamed types are mangled less wrongDavid Majnemer2013-08-261-2/+2
| | | | llvm-svn: 189208
* Parse: Do not 'HandleTopLevelDecl' on templated functions.David Majnemer2013-08-161-7/+3
| | | | | | | | | | | | | | | | Summary: HandleTopLevelDecl on a templated function leads us to try and mangle it. Reviewers: rsmith Reviewed By: rsmith CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D1412 llvm-svn: 188536
* [-cxx-abi microsoft] Mangle member pointers betterDavid Majnemer2013-08-151-14/+24
| | | | | | | | | | | | | | | | | | | | Summary: There were several things going wrong: - We mangled in useless qualifiers like "volatile void" return types. - We didn't propagate 64-bit pointer markers sufficiently. - We mangled qualifiers belonging to the pointee incorrectly. This fixes PR16844 and PR16848. Reviewers: rnk, whunt Reviewed By: rnk CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D1353 llvm-svn: 188450
* Fix typo in comment.David Majnemer2013-08-131-1/+1
| | | | | | Thanks Kim Gräsman! llvm-svn: 188257
* [-cxx-abi microsoft] Mangle __uuidof correctly into template parametersDavid Majnemer2013-08-131-0/+28
| | | | | | | | | | | | | | | | | | | | | | | Summary: It seems that __uuidof introduces a global extern "C" declaration of type __s_GUID. However, our implementation of __uuidof does not provide such a declaration and thus must open-code the mangling for __uuidof in template parameters. This allows us to codegen scoped COM pointers and other such things. This fixes PR16836. Depends on D1356. Reviewers: rnk, cdavis5x, rsmith Reviewed By: rnk CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D1357 llvm-svn: 188252
* [-cxx-abi microsoft] Mangle TemplateArgument::Declaration for referencesDavid Majnemer2013-08-131-2/+4
| | | | | | | | | | | | | | | | Summary: Properly mangle declarations showing up in template arguments that are reference parameters. Fun-fact: undname cannot handle these! Reviewers: rnk, cdavis5x Reviewed By: rnk CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D1356 llvm-svn: 188245
* Revert "[-cxx-abi microsoft] Mangle UUIDs correctly, stick them in the ↵David Majnemer2013-08-091-1/+4
| | | | | | | | | | proper section" This commit reverts r188053. It is breaking the build bots. llvm-svn: 188055
* [-cxx-abi microsoft] Mangle UUIDs correctly, stick them in the proper sectionDavid Majnemer2013-08-091-4/+1
| | | | | | | | | | | | We mangled them like: L___uuid_12345678-1234-1234-1234-123456789abc We should've mangled them like: __GUID_12345678_1234_1234_1234_123456789abc Furthermore, they are external symbols. llvm-svn: 188053
* [ms-cxxabi] Properly mangle member pointersDavid Majnemer2013-08-051-1/+9
| | | | | | | | | | There were three things missing from the original implementation: - We would omit the 'E' qualifier for members int 64-bit mode. - We would not exmaine the qualifiers in 'IsMember' mode. - We didn't generate the correct backref to the base class. llvm-svn: 187753
* [ms-cxxabi] Handle template-template argumentsDavid Majnemer2013-08-051-7/+10
| | | | | | | Template-template arguments appear to be a rather simple encoding of the template's templated tag type. llvm-svn: 187751
* [ms-cxxabi] Mangle nullptr template argumentsDavid Majnemer2013-08-051-2/+4
| | | | | | MSVC mangles nullptr template arguments identically to zero literals. llvm-svn: 187741
* Add MicrosoftVFTableContext to ASTTimur Iskhodzhanov2013-07-301-6/+23
| | | | llvm-svn: 187409
* [ms-cxxabi] Emit linkonce complete dtors in TUs that need themReid Kleckner2013-07-221-13/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Based on Peter Collingbourne's destructor patches. Prior to this change, clang was considering ?1 to be the complete destructor and the base destructor, which was wrong. This lead to crashes when clang tried to emit two LLVM functions with the same name. In this ABI, TUs with non-inline dtors might not emit a complete destructor. They are emitted as inline thunks in TUs that need them, and they always delegate to the base dtors of the complete class and its virtual bases. This change uses the DeferredDecls machinery to emit complete dtors as needed. Currently in clang try body destructors can catch exceptions thrown by virtual base destructors. In the Microsoft C++ ABI, clang may not have the destructor definition, in which case clang won't wrap the virtual virtual base destructor calls in a try-catch. Diagnosing this in user code is TODO. Finally, for classes that don't use virtual inheritance, MSVC always calls the base destructor (?1) directly. This is a useful code size optimization that avoids emitting lots of extra thunks or aliases. Implementing it also means our existing tests continue to pass, and is consistent with MSVC's output. We can do the same for Itanium by tweaking GetAddrOfCXXDestructor, but it will require further testing. Reviewers: rjmccall CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D1066 llvm-svn: 186828
* [ms-cxxabi] Don't consider function templates for name backrefsReid Kleckner2013-07-131-1/+10
| | | | | | | | | | | | | | They don't seem to be used for back references, presumably because a function template is unlikely to reoccur, while a class template name may reoccur as a type. This fixes a mangling issue for llvm::hash_combine() in Hashing.h. Reviewers: timurrrr Differential Revision: http://llvm-reviews.chandlerc.com/D1078 llvm-svn: 186233
* Get rid of dead/useless code for block mangling.Eli Friedman2013-07-101-1/+8
| | | | llvm-svn: 185989
* [ms-cxxabi] Mangle variadic template parameter packsReid Kleckner2013-07-021-35/+49
| | | | | | | | | | | | | | Unlike Itanium, there is no code to indicate the beginning of a parameter pack. I tested this with MSVC 2013, which is the only version that implements variadic templates so far. This is needed to compile APInt.cpp for the MS C++ ABI. Reviewers: timurrrr Differential Revision: http://llvm-reviews.chandlerc.com/D1077 llvm-svn: 185454
* [ms-cxxabi] Use sugared types in the mangler instead of canonical typesReid Kleckner2013-06-241-34/+39
| | | | | | | | | | | | | | | | | | | | | At this point, it's clear that the MSVC mangler uses the type-as-written instead of the canonical type, so this should bring us closer to MSVC. The main thrust of this change is to fix the way we mangle decayed array parameters of function pointer parameters. With a DecayedType sugar node, this code can now be much simpler. Fixes PR16096. This also fixes a separate issue that Richard spotted in review. Because separate declarations of the same entity can be spelled and mangled differently, MSVC always mangles the earliest declaration in an attempt to avoid link errors. Clang now does the same. Reviewers: rsmith Differential Revision: http://llvm-reviews.chandlerc.com/D844 llvm-svn: 184777
* [ms-cxxabi] Emit and install appropriately mangled vbtablesReid Kleckner2013-06-191-8/+28
| | | | | | | | | | | | | | | | | | | | | | | | | In Itanium, dynamic classes have one vtable with several different address points for dynamic base classes that can't share vtables. In the MS C++ ABI, each vbtable that can't be shared gets its own symbol, similar to how ctor vtables work in Itanium. However, instead of mangling the subobject offset into the symbol, the unique portions of the inheritance path are mangled into the symbol to make it unique. This patch implements the MSVC 2012 scheme for forming unique vbtable symbol names. MSVC 2010 use the same mangling with a different subset of the path. Implementing that mangling and possibly others is TODO. Each vbtable is an array of i32 offsets from the vbptr that points to it to another virtual base subobject. The first entry of a vbtable always points to the base of the current subobject, implying that it is the same no matter which parent class contains it. Reviewers: rjmccall Differential Revision: http://llvm-reviews.chandlerc.com/D636 llvm-svn: 184309
* Remove unused #include <map>Reid Kleckner2013-05-221-1/+0
| | | | llvm-svn: 182500
* Use StringMap in MicrosoftMangle to resolve FIXME.Reid Kleckner2013-05-221-3/+2
| | | | llvm-svn: 182488
* Fix clang -Werror build due to -Wreorder violation introduced in r181825David Blaikie2013-05-141-4/+4
| | | | llvm-svn: 181834
* [ms-cxxabi] Mangle in an implicit 'E' for certain types on win64Reid Kleckner2013-05-141-32/+58
| | | | | | | | | | | | Most of the complexity of this patch is figuring out which types get the qualifier and which don't. If we implement __ptr32/64, then we should check the qualifier instead of assuming all pointers are 64-bit. This fixes PR13792. Patch by Warren Hunt! llvm-svn: 181825
* Cleanup handling of UniqueExternalLinkage.Rafael Espindola2013-05-131-1/+1
| | | | | | | | | | | | | This patch renames getLinkage to getLinkageInternal. Only code that needs to handle UniqueExternalLinkage specially should call this. Linkage, as defined in the c++ standard, is provided by getFormalLinkage. It maps UniqueExternalLinkage to ExternalLinkage. Most places in the compiler actually want isExternallyVisible, which handles UniqueExternalLinkage as internal. llvm-svn: 181677
* CodeGen for CapturedStmtsBen Langmuir2013-05-091-0/+4
| | | | | | | | | | | | | | | | | EmitCapturedStmt creates a captured struct containing all of the captured variables, and then emits a call to the outlined function. This is similar in principle to EmitBlockLiteral. GenerateCapturedFunction actually produces the outlined function. It is based on GenerateBlockFunction, but is much simpler. The function type is determined by the parameters that are in the CapturedDecl. Some changes have been added to this patch that were reviewed as part of the serialization patch and moving the parameters to the captured decl. Differential Revision: http://llvm-reviews.chandlerc.com/D640 llvm-svn: 181536
* [ms-cxxabi] Fix a number of bugs in the mangler.Peter Collingbourne2013-04-251-91/+98
| | | | | | | | | | | | | | This includes the following fixes: - Implement 4 subtly different variants of qualifier mangling and use them in what I believe are the right places. - Fix handling of array types. Previously we were always decaying them, which is wrong if the type appears as a template argument, pointee, referent etc. Fixes PR13182. Differential Revision: http://llvm-reviews.chandlerc.com/D709 llvm-svn: 180250
* [ms-cxxabi] Add "$$C" when mangling template arg QualTypesReid Kleckner2013-04-091-2/+6
| | | | | | Credit goes to Timur Iskhodzhanov for finding the problem and solution. llvm-svn: 179093
* [ms-cxxabi] Mangle vector typesReid Kleckner2013-03-261-5/+31
| | | | | | | | | | | | | | | | | Summary: The only vector types a user can pass from MSVC code to clang code are the ones from *mmintrin.h, so we only have to match the MSVC mangling for these types. MSVC mangles the __m128 family of types as tag types, which we match. For other vector types, we emit a unique tag type mangling that won't match anything produced by MSVC. Reviewers: rjmccall CC: chandlerc, timurrrr, cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D576 llvm-svn: 178036
* [ms-cxxabi] Mangle function pointer template arguments correctlyReid Kleckner2013-03-201-1/+3
| | | | | | | | | | Reviewers: rjmccall CC: timurrrr, llvm-commits Differential Revision: http://llvm-reviews.chandlerc.com/D554 llvm-svn: 177589
* [ms-cxxabi] Fix assertion on unhandled function template arg typesReid Kleckner2013-03-201-49/+22
| | | | | | | | | | | | This code was changed in r158376 to get template argument source info for better diagnostics, but the current code asserts for any kind of unsupported template argument before it can issue a diagnostic. This change goes back to the Itanium implementation of isTemplate() and puts the argument index into the diagnostic instead of a source location. Review URL: http://llvm-reviews.chandlerc.com/D553 llvm-svn: 177471
* Better support for constructors with -cxx-abi microsoft, partly fixes PR12784Timur Iskhodzhanov2013-02-271-0/+4
| | | | llvm-svn: 176186
* Replace TypeLoc llvm::cast support to be well-defined.David Blaikie2013-02-181-1/+1
| | | | | | | | | | | | | | The TypeLoc hierarchy used the llvm::cast machinery to perform undefined behavior by casting pointers/references to TypeLoc objects to derived types and then using the derived copy constructors (or even returning pointers to derived types that actually point to the original TypeLoc object). Some context is in this thread: http://lists.cs.uiuc.edu/pipermail/llvmdev/2012-December/056804.html Though it's spread over a few months which can be hard to read in the mail archive. llvm-svn: 175462
* Emit virtual/deleting destructors properly with -cxx-abi microsoft, PR15058Timur Iskhodzhanov2013-02-131-5/+60
| | | | llvm-svn: 175045
* Add OpenCL samplers as Clang builtin types and check sampler related ↵Guy Benyei2013-02-071-0/+1
| | | | | | restrictions. llvm-svn: 174601
* Implement OpenCL event_t as Clang builtin type, including event_t related ↵Guy Benyei2013-01-201-0/+1
| | | | | | OpenCL restrictions (OpenCL 1.2 spec 6.9) llvm-svn: 172973
* Re-commit r170428 changes with Linux style file endings.Guy Benyei2012-12-181-0/+7
| | | | | | Add OpenCL images as clang builtin types. llvm-svn: 170432
* Revert changes from r170428, as I accidentally changed the line endings of ↵Guy Benyei2012-12-181-1725/+1718
| | | | | | these files to Windows style. llvm-svn: 170431
* Add OpenCL images as clang builtin types.Guy Benyei2012-12-181-1718/+1725
| | | | llvm-svn: 170428
* Pull the Attr iteration parts out of Attr.h, so including DeclBase.h doesn't ↵Benjamin Kramer2012-12-011-1/+1
| | | | | | | | | pull in all the generated Attr code. Required to pull some functions out of line, but this shouldn't have a perf impact. No functionality change. llvm-svn: 169092
* [-cxx-abi microsoft] Also spill the argument-back-references context when ↵Timur Iskhodzhanov2012-11-291-3/+7
| | | | | | mangling templates llvm-svn: 168862
* Fix PR14413 - incorrect mangling of anonymous namespaces with -cxx-abi microsoftTimur Iskhodzhanov2012-11-261-1/+1
| | | | llvm-svn: 168583
* Fix PR14321, a crash when Clang is built with GCC 4.7 at -O1 or greater.Matt Beaumont-Gay2012-11-161-1/+1
| | | | | | | | | GCC 4.7 reuses stack slots fairly aggressively, which exposes more temporary lifetime bugs. No new test, this was caught by the existing CodeGenCXX/mangle-ms-templates.cpp. llvm-svn: 168124
* [ms] Make mangleIntegerLiteral less aware of exact type of the literal.Nico Weber2012-11-131-7/+8
| | | | | | | | | | | | | Integer literal mangling does not actually depend on exact type of the literal. This will simplify calling mangleIntegerLiteral when literal type is not known, for example, when sizes or offsets are mangled as integer literals. Also, call mangleNumber instead of directly printing mangled values of 0/1, to avoid this knowledge from being in multiple places. Patch from Evgeny Eltsin! llvm-svn: 167878
* [ms] Implement int64_t version of mangleNumber() in terms of the APSInt version.Nico Weber2012-11-091-24/+8
| | | | | | No intended functionality change. llvm-svn: 167602
* [Windows] Fix mangling of number literal '0'Nico Weber2012-11-081-2/+2
| | | | | | | | | | Do this by making the mangleNumber(APSInt) overload look like the int64_t version. (The latter should probably just delegate to the former). Test from Evgeny Eltsin! llvm-svn: 167599
* Make DiagnosticOptions intrusively reference-counted, and make sureDouglas Gregor2012-10-231-0/+1
| | | | | | | the various stakeholders bump up the reference count. In particular, the diagnostics engine now keeps the DiagnosticOptions object alive. llvm-svn: 166508
* When mangling an APSInt with the ms abi, make sure to look at all nibbles.Nico Weber2012-10-031-1/+1
| | | | | | Currently, it's ignored if the number of set bits isn't divisible by 4. llvm-svn: 165116
* While I'm here, resync a %select with the enum definition it selects on.Nico Weber2012-10-031-2/+2
| | | | | | | | | | | | | * nullptr used to be mapped to ERROR, now mapped to nullptr * integral was missing * expressions now have their own error message, so they won't reach this. Map them to ERROR. Note that clang usually crashes before emitting this diagnostic anyway (see PR13984), so this change alone doesn't have an observable effect. It makes the code more correct though. llvm-svn: 165095
* Move expression mangling in the microsoft mangler to its own function.Nico Weber2012-10-031-10/+21
| | | | | | | | | | This matches what's done in ItaniumMangle and makes it a bit easier to implement mangling for more expressions. Also use the slightly nicer "not yet implemented" error message from there. No functionality change (except for the different error message). llvm-svn: 165093
* Replace a default: with an explicit list of cases. No functionality change.Nico Weber2012-10-031-1/+6
| | | | llvm-svn: 165091
* Fix PR13444 - wrong mangling of "const char * const *" and friends with ↵Timur Iskhodzhanov2012-09-031-66/+76
| | | | | | "-cxx-abi microsoft" llvm-svn: 163110
OpenPOWER on IntegriCloud