summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/ItaniumMangle.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* [SEH] Re-land r234532, but use internal linkage for all SEH helpersReid Kleckner2015-04-101-0/+12
| | | | | | | | | | Even though these symbols are in a comdat group, the Microsoft linker really wants them to have internal linkage. I'm planning to tweak the mangling in a follow-up change. This is a straight revert with a 1-line fix. llvm-svn: 234613
* Revert r234532 for a bit, it very likely caused http://crbug.com/475768Nico Weber2015-04-101-12/+0
| | | | llvm-svn: 234563
* [SEH] Outline finally blocks using the new variable capture supportReid Kleckner2015-04-091-0/+12
| | | | | | | | | | | | | | | WinEHPrepare was going to have to pattern match the control flow merge and split that the old lowering used, and that wasn't really feasible. Now we can teach WinEHPrepare to pattern match this, which is much simpler: %fp = call i8* @llvm.frameaddress(i32 0) call void @func(iN [01], i8* %fp) This prototype happens to match the prototype used by the Win64 SEH personality function, so this is really simple. llvm-svn: 234532
* MS ABI: Implement copy-ctor closures, finish implementing throwDavid Majnemer2015-03-111-0/+3
| | | | | | | | | | | | | | | This adds support for copy-constructor closures. These are generated when the C++ runtime has to call a copy-constructor with a particular calling convention or with default arguments substituted in to the call. Because the runtime has no mechanism to call the function with a different calling convention or know-how to evaluate the default arguments at run-time, we create a thunk which will do all the appropriate work and package it in a way the runtime can use. Differential Revision: http://reviews.llvm.org/D8225 llvm-svn: 231952
* For PR22870: produce an error rather than asserting if a designated ↵Richard Smith2015-03-111-1/+1
| | | | | | initializer appears in a signature. llvm-svn: 231892
* Teach raw_ostream to accept SmallString.Yaron Keren2015-03-101-1/+1
| | | | | | | | | | | | | | Saves adding .str() call to any raw_ostream << SmallString usage and a small step towards making .str() consistent in the ADTs by removing one of the SmallString::str() use cases, discussion at http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20141013/240026.html I'll update the Phabricator patch http://reviews.llvm.org/D6372 for review of the Twine SmallString support, it's more complex than this one. llvm-svn: 231763
* Implement Control Flow Integrity for virtual calls.Peter Collingbourne2015-02-201-0/+18
| | | | | | | | | | | | | | | This patch introduces the -fsanitize=cfi-vptr flag, which enables a control flow integrity scheme that checks that virtual calls take place using a vptr of the correct dynamic type. More details in the new docs/ControlFlowIntegrity.rst file. It also introduces the -fsanitize=cfi flag, which is currently a synonym for -fsanitize=cfi-vptr, but will eventually cover all CFI checks implemented in Clang. Differential Revision: http://reviews.llvm.org/D7424 llvm-svn: 230055
* Itanium ABI: Pack expansions change the arity of expressions to unknownDavid Majnemer2015-02-191-3/+8
| | | | llvm-svn: 229918
* CXXNameMangler::mangleUnresolvedPrefix(): Prune an obsolete \param, ↵NAKAMURA Takumi2015-02-191-2/+0
| | | | | | according to r229809. [-Wdocumentation] llvm-svn: 229823
* Itanium ABI: Don't pass nullptr to a bool argumentDavid Majnemer2015-02-191-1/+1
| | | | llvm-svn: 229822
* Itanium ABI: Properly qualify the destructor-nameDavid Majnemer2015-02-191-206/+169
| | | | | | | 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: Write a character instead of a string literalDavid Majnemer2015-02-181-1/+1
| | | | | | No functional change intended. llvm-svn: 229726
* Itanium ABI: Properly mangle extern "C" template argumentsDavid Majnemer2015-02-181-0/+8
| | | | | | | | | extern "C" declarations should be considered like global declarations for mangling purposes. Differential Revision: http://reviews.llvm.org/D7718 llvm-svn: 229724
* Itanium ABI: Mangle <mangled-name> according to the ABIDavid Majnemer2015-02-181-12/+6
| | | | | | | | | | | | | | | 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-42/+90
| | | | | | | | | | | | | 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-25/+63
| | | | | | | | | | 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
* PR22465: when performing list-initialization for a class type C, if we see anRichard Smith2015-02-051-3/+13
| | | | | | | | | | initializer of the form {x}, where x is of type C or a type derived from C, perform *non-list* initialization of the entity from x, but create a CXXConstructExpr that knows that we used list-initialization syntax. Plus some fixes to ensure we mangle correctly in this and related cases. llvm-svn: 228276
* Various fixes to mangling of list-initialization.Richard Smith2015-02-051-15/+56
| | | | llvm-svn: 228274
* Initial support for Win64 SEH IR emissionReid Kleckner2015-01-221-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The lowering looks a lot like normal EH lowering, with the exception that the exceptions are caught by executing filter expression code instead of matching typeinfo globals. The filter expressions are outlined into functions which are used in landingpad clauses where typeinfo would normally go. Major aspects that still need work: - Non-call exceptions in __try bodies won't work yet. The plan is to outline the __try block in the frontend to keep things simple. - Filter expressions cannot use local variables until capturing is implemented. - __finally blocks will not run after exceptions. Fixing this requires work in the LLVM SEH preparation pass. The IR lowering looks like this: // C code: bool safe_div(int n, int d, int *r) { __try { *r = normal_div(n, d); } __except(_exception_code() == EXCEPTION_INT_DIVIDE_BY_ZERO) { return false; } return true; } ; LLVM IR: define i32 @filter(i8* %e, i8* %fp) { %ehptrs = bitcast i8* %e to i32** %ehrec = load i32** %ehptrs %code = load i32* %ehrec %matches = icmp eq i32 %code, i32 u0xC0000094 %matches.i32 = zext i1 %matches to i32 ret i32 %matches.i32 } define i1 zeroext @safe_div(i32 %n, i32 %d, i32* %r) { %rr = invoke i32 @normal_div(i32 %n, i32 %d) to label %normal unwind to label %lpad normal: store i32 %rr, i32* %r ret i1 1 lpad: %ehvals = landingpad {i8*, i32} personality i32 (...)* @__C_specific_handler catch i8* bitcast (i32 (i8*, i8*)* @filter to i8*) %ehptr = extractvalue {i8*, i32} %ehvals, i32 0 %sel = extractvalue {i8*, i32} %ehvals, i32 1 %filter_sel = call i32 @llvm.eh.seh.typeid.for(i8* bitcast (i32 (i8*, i8*)* @filter to i8*)) %matches = icmp eq i32 %sel, %filter_sel br i1 %matches, label %eh.except, label %eh.resume eh.except: ret i1 false eh.resume: resume } Reviewers: rjmccall, rsmith, majnemer Differential Revision: http://reviews.llvm.org/D5607 llvm-svn: 226760
* Fix the issue of mangling of local anonymous unions (Itanium C++ ABI):Evgeny Astigeevich2014-12-121-24/+9
| | | | | | | | | | | | | | | | | | | | | | A discriminator is used for the first occurrence of a name. inline int f1 () { static union { int a; long int b; }; static union { int c; double d; }; return a+c; } The name of the second union is mangled as _ZZ2f1vE1c_0 instead of _ZZ2f1vE1c. Differential Revision: http://reviews.llvm.org/D6295 llvm-svn: 224131
* AST: Consider pseudo-struct builtin types as substitutableDavid Majnemer2014-11-281-1/+14
| | | | | | | | We didn't consider types like ObjCSel as a substitution candidate. This fixes PR21688. llvm-svn: 222941
* When mangling member-expressions, skip implicit accesses of anonymous unionRichard Smith2014-11-201-0/+12
| | | | | | objects. This is consistent with GCC's behavior. Patch by Tomasz Miąsko! llvm-svn: 222402
* Update fold-expression mangling to match cxx-abi-dev discussion.Richard Smith2014-11-101-5/+3
| | | | llvm-svn: 221623
* [c++1z] N4295: fold-expressions.Richard Smith2014-11-081-2/+25
| | | | | | | | | | | | | | | | This is a new form of expression of the form: (expr op ... op expr) where one of the exprs is a parameter pack. It expands into (expr1 op (expr2onwards op ... op expr)) (and likewise if the pack is on the right). The non-pack operand can be omitted; in that case, an empty pack gives a fallback value or an error, depending on the operator. llvm-svn: 221573
* Add the initial TypoExpr AST node for delayed typo correction.Kaelyn Takata2014-10-271-0/+1
| | | | llvm-svn: 220692
* Itanium ABI: Template template parameters are usable as substitutionsDavid Majnemer2014-10-241-10/+7
| | | | | | | | | | | | | 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
* 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-extensions: Implement __super scope specifier (PR13236).Nikola Smiljanic2014-09-261-0/+6
| | | | | | | | | We build a NestedNameSpecifier that records the CXXRecordDecl in which __super appeared. Name lookup is performed in all base classes of the recorded CXXRecordDecl. Use of __super is allowed only inside class and member function scope. llvm-svn: 218484
* Patch to allow mangling of microsoft’s __uuidof expression for the Itanium ↵Fariborz Jahanian2014-09-241-1/+14
| | | | | | | | | ABI when under -fms-extensions. Reviewed by John McCall. //rdar://17784718 llvm-svn: 218384
* AST: Mangle cast expression encoding more accuratelyDavid Majnemer2014-09-231-6/+23
| | | | | | | | | | | Don't mangle all casts in expressions as "cv", use the appropriate encoding which corresponds to a specific cast. This fixes PR21034. Differential Revision: http://reviews.llvm.org/D5453 llvm-svn: 218293
* Add support for putting constructors and destructos in explicit comdats.Rafael Espindola2014-09-161-3/+21
| | | | | | | | | | | | | | | | | | 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
* AST: Fix the mangling for unqualified-blocksDavid Majnemer2014-08-041-2/+2
| | | | | | | | | | | | | | | | CXXNameMangler::mangleUnqualifiedBlock believed that MangleContext::getBlockId returned something that used Itanium-style discriminator numbers. Discriminator numbers start their numberign from 1 and the first mangling that actually gets any sort of number mangled in is the second discriminator. However, Block IDs start from zero. The logic for omitting the mangling number did a ' > 1' instead of a ' > 0' comparison; this could potentially cause mangling conflicts. llvm-svn: 214699
* AArch64: update Clang for merged arm64/aarch64 triples.Tim Northover2014-07-231-3/+1
| | | | | | | | | | | | | | The main subtlety here is that the Darwin tools still need to be given "-arch arm64" rather than "-arch aarch64". Fortunately this already goes via a custom function to handle weird edge-cases in other architectures, and it tested. I removed a few arm64_be tests because that really isn't an interesting thing to worry about. No-one using big-endian is also referring to the target as arm64 (at least as far as toolchains go). Mostly they date from when arm64 was a separate target and we *did* need a parallel name simply to test it at all. Now aarch64_be is sufficient. llvm-svn: 213744
* Added the pack_elements range accessor. Refactoring some for loops to use ↵Aaron Ballman2014-07-151-4/+2
| | | | | | range-based for loops instead. No functional changes intended. llvm-svn: 213095
* Import MutableArrayRef into clang namespace.Craig Topper2014-06-281-2/+2
| | | | llvm-svn: 211988
* Remove old proposal noticesAlp Toker2014-06-051-3/+0
| | | | | | Let's just go ahead and assume the answer was 'I do' llvm-svn: 210295
* AArch64/ARM64: update Clang after AArch64 removal.Tim Northover2014-05-241-4/+4
| | | | | | | | | | | A few (mostly CodeGen) parts of Clang were tightly coupled to the AArch64 backend. Now that it's gone, they will not even compile. I've also deduplicated RUN lines in many of the AArch64 tests. This might improve "make check-all" time noticably: some of those NEON tests were monsters. llvm-svn: 209578
* [C++11] Use 'nullptr'. AST edition.Craig Topper2014-05-121-25/+27
| | | | llvm-svn: 208517
* AST: Update reference temporary manglingDavid Majnemer2014-05-061-24/+26
| | | | | | | | | | | | | | | Summary: Update our mangling to match the discussion on cxx-abi-dev. This involves using a seq-id instead of an optional number. Reviewers: rsmith Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D3631 llvm-svn: 208140
* AST: Mangle reference temporaries reliablyDavid Majnemer2014-05-011-1/+6
| | | | | | | | | | | | | | | 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
* [ARM64] Add arm64_be where it was accidentally missed from a bunch of ↵James Molloy2014-04-301-0/+1
| | | | | | | | | if-conditions. I think this is the last commit for ARM64 big endian in clang. This commit makes arm_neon.h compile correctly. llvm-svn: 207624
* Add mangling for attribute enable_if. The demangling patch for libcxxabi is ↵Nick Lewycky2014-04-261-0/+19
| | | | | | still in review. llvm-svn: 207296
* AST: Elaborated type specifier mangling occurs before nested-nameDavid Majnemer2014-04-151-2/+2
| | | | | | The Ts/Tu/Te manglings should occur before the nested-name's N. llvm-svn: 206247
* Replace llvm::array_endof with C++11's std::end.Benjamin Kramer2014-04-121-4/+2
| | | | | | No functionality change. llvm-svn: 206111
* Remove Unicode introduced in r205943David Majnemer2014-04-101-4/+4
| | | | llvm-svn: 205945
* AST: Implement proposal for dependent elaborated type specifiersDavid Majnemer2014-04-101-1/+28
| | | | | | | | | 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
* ARM64: initial clang support commit.Tim Northover2014-03-291-4/+18
| | | | | | | | | | | This adds Clang support for the ARM64 backend. There are definitely still some rough edges, so please bring up any issues you see with this patch. As with the LLVM commit though, we think it'll be more useful for merging with AArch64 from within the tree. llvm-svn: 205100
* MS ABI: Eliminate Duplicate StringsDavid Majnemer2014-03-241-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | 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-10/+0
| | | | llvm-svn: 204596
OpenPOWER on IntegriCloud