summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/MicrosoftMangle.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* MS ABI: Correctly mangle CV qualifiers from typedefsWill Wilson2014-11-051-1/+1
| | | | llvm-svn: 221344
* Add frontend support for __vectorcallReid Kleckner2014-10-241-0/+2
| | | | | | | | | | | | | Wire it through everywhere we have support for fastcall, essentially. This allows us to parse the MSVC "14" CTP headers, but we will miscompile them because LLVM doesn't support __vectorcall yet. Reviewed By: Aaron Ballman Differential Revision: http://reviews.llvm.org/D5808 llvm-svn: 220573
* Rename TemplateArgument::getTypeForDecl to getParamTypeForDecl for clarityDavid Blaikie2014-10-171-1/+1
| | | | | | Code review feedback from Richard Smith on r219900. llvm-svn: 220060
* PR21246: DebugInfo: Emit the appropriate type (cv qualifiers, ↵David Blaikie2014-10-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | reference-ness, etc) for non-type template parameters Plumb through the full QualType of the TemplateArgument::Declaration, as it's insufficient to only know whether the type is a reference or pointer (that was necessary for mangling, but insufficient for debug info). This shouldn't increase the size of TemplateArgument as TemplateArgument::Integer is still longer by another 32 bits. Several bits of code were testing that the reference-ness of the parameters matched, but this seemed to be insufficient (various other features of the type could've mismatched and wouldn't've been caught) and unnecessary, at least insofar as removing those tests didn't cause anything to fail. (Richard - perchaps you can hypothesize why any of these checks might need to test reference-ness of the parameters (& explain why reference-ness is part of the mangling - I would've figured that for the reference-ness to be different, a prior template argument would have to be different). I'd be happy to add them in/beef them up and add test cases if there's a reason for them) llvm-svn: 219900
* MS ABI: Make comment more accurateDavid Majnemer2014-10-051-1/+1
| | | | | | The ABI for function-scope statics changed in VS "14", not MSVC 2013. llvm-svn: 219076
* MS ABI: Use '1' (instead of '0') relative scope discriminatorsDavid Majnemer2014-10-051-1/+1
| | | | | | | | This changes the scope discriminator's behavior to start at '1' instead of '0'. Symbol table diffing, for ABI compatibility testing, kept finding these as false positives. llvm-svn: 219075
* MS ABI: Avoid hashing back reference keys in manglerDavid Majnemer2014-09-251-17/+8
| | | | | | | | | | | | | | | | | | | | This patch replaces the back reference StringMap from the MS mangler with a SmallVector of strings. My previous patches reduced the number of hashes involved in back reference lookups, this one removes them completely. The back reference map contains at most 10 entries, which are likely to be of varying sizes and different initial subsequences, and which can easily became huge (due to templates and namespaces). The solution presented is the simplest possible one. Nevertheless, it's enough to reduce compilation times for a particular test case from 11.1s to 9s, versus 8.58s for the Itanium ABI. Possible further improvements include using a sorted vector (carefully to not introduce an extra comparison), storing the string contents in a common arena, and/or keep the string storage in the context for reuse. Patch by Agustín Bergé. llvm-svn: 218461
* Add support for putting constructors and destructos in explicit comdats.Rafael Espindola2014-09-161-0/+2
| | | | | | | | | | | | | | | | | | There are situations when clang knows that the C1 and C2 constructors or the D1 and D2 destructors are identical. We already optimize some of these cases, but cannot optimize it when the GlobalValue is weak_odr. The problem with weak_odr is that an old TU seeing the same code will have a C1 and a C2 comdat with the corresponding symbols. We cannot suddenly start putting the C2 symbol in the C1 comdat as we cannot guarantee that the linker will not pick a .o with only C1 in it. The solution implemented by GCC is to expand the ABI to have a comdat whose name uses a C5/D5 suffix and always has both symbols. That is what this patch implements. llvm-svn: 217874
* MS ABI: Update alias template mangling for VC "14" CTP 3David Majnemer2014-08-191-3/+2
| | | | | | | | MSVC "14" CTP 3 has fixed it's mangling for alias templates when used as template-template arguments; update clang to be compatible with this mangling. llvm-svn: 215972
* MS ABI: Mangle this qualifiers on function typesDavid Majnemer2014-08-121-9/+14
| | | | | | | | | | | C++11 allows this qualifiers to exist on function types when used in template arguments. Previously, I believed it wasn't possible because MSVC rejected declarations like: S<int () const &> s; However, it turns out MSVC properly allows them in using declarations; updated clang to be compatible with this mangling. llvm-svn: 215464
* MS ABI: Mangle lambdas which are given the same mangling numberDavid Majnemer2014-08-061-4/+1
| | | | | | | | It is possible for lambdas to get the same mangling number because they may exist in different mangling contexts. To handle this correctly, mangle the context into the name as well. llvm-svn: 214947
* MS ABI: Mangle empty type parameter packs compatiblyDavid Majnemer2014-08-051-5/+18
| | | | | | | | | | | The MS mangling scheme apparently has separate manglings for type and non-type parameter packs when they are empty. Match template arguments with parameters during mangling; check the parameter to see if it was destined to hold type-ish things or nontype-ish things. Differential Revision: http://reviews.llvm.org/D4792 llvm-svn: 214932
* MS ABI: Make the alias template mangling more correctDavid Majnemer2014-08-051-1/+1
| | | | llvm-svn: 214847
* MS ABI: Mangle alias templates used as template-template argumentsDavid Majnemer2014-07-301-3/+13
| | | | | | | | | | | | | A templated using declaration may be used as a template-template argument. Unfortunately, the VS "14" chooses '?' as the sole marker for the argument. This is problematic because it presupposes the possibility of using more than one template-aliases as arguments to the same template. This fixes PR20047. llvm-svn: 214290
* Import MutableArrayRef into clang namespace.Craig Topper2014-06-281-2/+2
| | | | llvm-svn: 211988
* Remove llvm:: from uses of ArrayRef.Craig Topper2014-06-281-1/+1
| | | | llvm-svn: 211987
* Avoid extra back reference key lookup in msmanglerReid Kleckner2014-06-261-19/+17
| | | | | | | | | | | | | | | Avoid a second key lookup when the back reference key is going to be inserted in the StringMap. The string lookups in the msmangler are the main responsible for the huge overhead when compared to the itanium mangler. This patch makes a small but noticeable improvement. Reviewed by: rnk Differential Revision: http://reviews.llvm.org/D4130 Patch by Agustín Bergé! llvm-svn: 211813
* Don't go through the TypeSourceInfo when getting the SourceRange.Zachary Turner2014-06-251-3/+3
| | | | | | | | | | | | VarDecl provides a method getSourceRange(), which provides a more robust way of getting the SourceRange since the TypeSourceInfo can be null in certain cases. Reviewed by: majnemer Differential Revision: http://reviews.llvm.org/D4281 llvm-svn: 211667
* MS ABI: Only class templates get complex nullptr pointer-to-member-functionsDavid Majnemer2014-06-111-4/+7
| | | | | | | | | | | r210637 regressed CodeGenCXX/mangle-ms-templates-memptrs.cpp because it did not believe that there is a distinction between class templates and function templates. Sadly, there is. Function templates should behave in a compatible manner with MSVC. llvm-svn: 210642
* MS ABI: Mangle null pointer-to-member-functions compatiblyDavid Majnemer2014-06-111-24/+25
| | | | | | | | | | | | | | | | | | | | | Summary: Previously, we would mangle nullptr pointer-to-member-functions in class templates with a mangling we invented because contemporary versions of MSVC would crash when trying to compile such code. However, VS "14" can successfully compile these sorts of template instantiations. This commit updates our mangling to be compatible with theirs. Reviewers: rnk Reviewed By: rnk Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D4059 llvm-svn: 210637
* Fix mangling of __uuidof after two levels of template instantiationReid Kleckner2014-06-101-0/+3
| | | | llvm-svn: 210570
* MS ABI: Simplify microsoft mangling of template instantiationsDavid Majnemer2014-06-081-28/+18
| | | | | | | | | | | Use mangled template instantiation name as key for back references. Templates have their own context for back references, so their mangling is always the same regardless of context. This avoids mangling template instantiations twice. Patch by Agustín Bergé! llvm-svn: 210416
* MS-ABI: Mangle empty template parameter packs correctlyDavid Majnemer2014-06-041-4/+9
| | | | | | Tested for compatibility with VS2013. llvm-svn: 210198
* MS-ABI: Implement user defined literalsDavid Majnemer2014-06-041-5/+2
| | | | | | | | | Straightforward implementation of UDLs, it's compatible with VS "14". This nearly completes our implementation of C++ name mangling for the MS-ABI. llvm-svn: 210197
* [MS-ABI] Implements MS-compatible RTTIWarren Hunt2014-05-231-5/+5
| | | | | | | | | | | | | Enables the emission of MS-compatible RTTI data structures for use with typeid, dynamic_cast and exceptions. Does not implement dynamic_cast or exceptions. As an artiface, typeid works in some cases but proper support an testing will coming in a subsequent patch. majnemer has fuzzed the results. Test cases included. Differential Revision: http://reviews.llvm.org/D3833 llvm-svn: 209523
* MS ABI: Tighten RTTI manglingDavid Majnemer2014-05-131-21/+21
| | | | | | r208661 contained WIP code, commit the *actual* manglings. llvm-svn: 208668
* MS ABI: Preliminary RTTI manglingDavid Majnemer2014-05-131-14/+69
| | | | | | | | Implement what we currently believe is the mangling scheme for RTTI data. Tests will be added in a later commit which actually generate RTTI data. llvm-svn: 208661
* [C++11] Use 'nullptr'. AST edition.Craig Topper2014-05-121-11/+13
| | | | llvm-svn: 208517
* Make DiagnosticsEngine non-copyableAlp Toker2014-05-111-2/+2
| | | | | | | | Also provide an out-of-line dtor for CompilerInvocation. Cleanup work that may help reduce header inclusion for IntrusiveRefCntPtr. llvm-svn: 208512
* AST: Mangle reference temporaries reliablyDavid Majnemer2014-05-011-1/+3
| | | | | | | | | | | | | | | Summary: Previously, we would generate a single name for all reference temporaries and allow LLVM to rename them for us. Instead, number the reference temporaries as we build them in Sema. Reviewers: rsmith Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D3554 llvm-svn: 207776
* MS ABI: Implement mangling for ref-qualifiers on methodsDavid Majnemer2014-04-231-0/+20
| | | | | | | | Mangle ref-qualifiers like the Nov 2013 CTP. This fixes PR19361. llvm-svn: 206946
* MS ABI: Use range-based for loops in the manglerDavid Majnemer2014-04-231-16/+9
| | | | | | No functional change. llvm-svn: 206945
* MS ABI: Cleanup some egregious style violationsDavid Majnemer2014-04-231-39/+33
| | | | | | No functional change. llvm-svn: 206944
* Mangle the vbptr offset into pointers to member functionsReid Kleckner2014-04-071-6/+7
| | | | | | | | This can actually be non-zero if you override a function from a virtual base and you have forced the most_general pointer to member representation. llvm-svn: 205727
* MS ABI: Support mangling of return-types deducing to local typesDavid Majnemer2014-04-011-3/+12
| | | | | | | | | | | | | | | | | | The MS ABI forces us into catch-22 when it comes to functions which return types which are local: - A function is mangled with it's return type. - A type is mangled with it's surrounding context. Avoid this by mangling auto and decltype(autp) directly into the function's return type. Using this mangling has the double advantage of being compatible with the C++ standard without crashing the compiler. N.B. For the curious, the MSVC mangling leads to collisions amongst template functions and either crashes when faced with local types or is otherwise incapable of returning them. llvm-svn: 205282
* MS ABI: Simplify MangleByte furtherDavid Majnemer2014-04-011-6/+3
| | | | | | | | | | | It turns out that the ranges where the '?' <letter> manglings occur are identical to the ranges of ASCII characters OR'd with 0x80. Thanks to Richard Smith for the insight! No functional change. llvm-svn: 205270
* MS ABI: Simplify endian swapping codeDavid Majnemer2014-03-311-20/+4
| | | | | | No functionality change. llvm-svn: 205250
* MS ABI: mangleStringLiteral shouldn't rely on the host's endiannessDavid Majnemer2014-03-311-16/+38
| | | | | | | No test case is needed, the one in-tree is sufficient. The build-bot never emailed me because something else had upset it. llvm-svn: 205225
* MS ABI: Document the '\xc1' to '\xda' manglingsDavid Majnemer2014-03-311-0/+1
| | | | | | No functionality change. llvm-svn: 205223
* MS ABI: Correct typo in mangleStringLiteralDavid Majnemer2014-03-301-1/+1
| | | | | | No functionality change. llvm-svn: 205156
* MS ABI: Simplify mangleTemplateArgsDavid Majnemer2014-03-301-7/+3
| | | | | | No functionality change. llvm-svn: 205154
* MS ABI: Simplify MangleByteDavid Majnemer2014-03-301-3/+2
| | | | | | | | | | The delta between '\xe1' and '\xc1' is equivalent to the one between 'a' and 'A'. This allows us to reuse the computation between '\xe1' and '\xfa' for the '\xc1' to '\xda' case. No functionality change. llvm-svn: 205128
* MS ABI: Eliminate Duplicate StringsDavid Majnemer2014-03-241-0/+174
| | | | | | | | | | | | | | | | | | | | | | | | COFF doesn't have mergeable sections so LLVM/clang's normal tactics for string deduplication will not have any effect. To remedy this we place each string inside it's own section and mark the section as IMAGE_COMDAT_SELECT_ANY. However, we can only do this if the string has an external name that we can generate from it's contents. To be compatible with MSVC, we must use their scheme. Otherwise identical strings in translation units from clang may not be deduplicated with translation units in MSVC. This fixes PR18248. N.B. We will not attempt to do anything with a string literal which is not of type 'char' or 'wchar_t' because their compiler does not support unicode string literals as of this date. Further, we avoid doing this if either -fwritable-strings or -fsanitize=address are present. This reverts commit r204596. llvm-svn: 204675
* Revert r204562,204566,204586,204587 as they broke ASan on WindowsTimur Iskhodzhanov2014-03-241-174/+0
| | | | llvm-svn: 204596
* MS ABI: Add tests, other cleanups for r204562David Majnemer2014-03-241-55/+60
| | | | | | | | | | | | | This commit cleans up a few accidents: - Do not rely on the order in which StringLiteral lays out bytes. - Use a more efficient mechanism for handling so-called "special-mappings" when mangling string literals. - There is no need to allocate a copy of the mangled name. - Add the test written for r204562. Thanks to Richard Smith for pointing these out! llvm-svn: 204586
* MS ABI: Eliminate Duplicate StringsDavid Majnemer2014-03-231-0/+169
| | | | | | | | | | | | | | | | | | | | | COFF doesn't have mergeable sections so LLVM/clang's normal tactics for string deduplication will not have any effect. To remedy this we place each string inside it's own section and mark the section as IMAGE_COMDAT_SELECT_ANY. However, we can only do this if the string has an external name that we can generate from it's contents. To be compatible with MSVC, we must use their scheme. Otherwise identical strings in translation units from clang may not be deduplicated with translation units in MSVC. This fixes PR18248. N.B. We will not attempt to do anything with a string literal which is not of type 'char' or 'wchar_t' because their compiler does not support unicode string literals as of this date. llvm-svn: 204562
* remove a bunch of unused private methodsNuno Lopes2014-03-231-1/+0
| | | | | | | | | | | | | | | | | | found with a smarter version of -Wunused-member-function that I'm playwing with. Appologies in advance if I removed someone's WIP code. ARCMigrate/TransProperties.cpp | 8 ----- AST/MicrosoftMangle.cpp | 1 Analysis/AnalysisDeclContext.cpp | 5 --- Analysis/LiveVariables.cpp | 14 ---------- Index/USRGeneration.cpp | 10 ------- Sema/Sema.cpp | 33 +++++++++++++++++++++--- Sema/SemaChecking.cpp | 3 -- Sema/SemaDecl.cpp | 20 ++------------ StaticAnalyzer/Checkers/GenericTaintChecker.cpp | 1 9 files changed, 34 insertions(+), 61 deletions(-) llvm-svn: 204561
* [C++11] Replacing FunctionProtoType iterators param_type_begin() and ↵Aaron Ballman2014-03-171-5/+2
| | | | | | param_type_end() with iterator_range param_types(). Updating all of the usages of the iterators with range-based for loops. llvm-svn: 204045
* [C++11] Add 'override' keyword to virtual methods that override their base ↵Craig Topper2014-03-111-28/+26
| | | | | | class. llvm-svn: 203543
* MS ABI: Disambiguate the manglings for global guard variablesDavid Majnemer2014-03-061-5/+9
| | | | | | | | | If a guard variable will be created for an entity at global scope, then we cannot rely on the scope depth to disambiguate names for us. Instead, mangle the entire variable into the guard to ensure it's uniqueness. llvm-svn: 203151
OpenPOWER on IntegriCloud