Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion clang/include/clang/Basic/Attr.td
Original file line number Diff line number Diff line change
Expand Up @@ -1794,6 +1794,14 @@ def NoUniqueAddress : InheritableAttr, TargetSpecificAttr<TargetItaniumCXXABI> {
let SimpleHandler = 1;
}

def UseCompressionMangling : InheritableAttr, TargetSpecificAttr<TargetItaniumCXXABI> {
let Spellings = [CXX11<"itanium", "use_compression_mangling">];
let Args = [VariadicStringArgument<"Manglings">];
let Subjects = SubjectList<[CXXRecord], ErrorDiag>;
let Documentation = [UseCompressionManglingDocs];
let SimpleHandler = 1;
}

def ReturnsTwice : InheritableAttr {
let Spellings = [GCC<"returns_twice">];
let Subjects = SubjectList<[Function]>;
Expand Down Expand Up @@ -4198,4 +4206,3 @@ def AvailableOnlyInDefaultEvalMethod : InheritableAttr {
let Subjects = SubjectList<[TypedefName], ErrorDiag>;
let Documentation = [Undocumented];
}

27 changes: 27 additions & 0 deletions clang/include/clang/Basic/AttrDocs.td
Original file line number Diff line number Diff line change
Expand Up @@ -5223,6 +5223,33 @@ declarations with `preferred_name`. This is intended to be fixed in the future.
}];
}

def UseCompressionManglingDocs : Documentation {
let Category = DocCatDecl;
let Content = [{
The ``itanium::use_compression_mangling`` attribute is used to enable compression
mangling for certain types. If the compression mangling is not known or does not
belong to the type that is annotated and the annotation is inside a versioned
``namespace std``, an error is produced. Otherwise a warning is produced. This
is to avoid silently ignoring the attribute and causing an ABI break later. For
example
.. code-block:: c++
namespace std::inline __2c {
template <class>
class [[itanium::use_compression_mangling("aA")]] allocator { /*...*/ };

template <class, size_t>
class array { /*...*/ };
}

// This function is mangled as _Z5func1NS2cT5arrayIiLm1EEE despite there being a
// compressed mangling scheme present
void func1(std::array<int, 1>) {}

// This function is mangled as _Z5func2NS2caAIiEE
void func2(std::allocator<int>) {}
}];
}

def PreserveMostDocs : Documentation {
let Category = DocCatCallingConvs;
let Content = [{
Expand Down
Loading