Skip to content

Commit

Permalink
Merge pull request #8295 from swiftix/wip-gsb-layout-constrains-fixes
Browse files Browse the repository at this point in the history
[mangling] Define a mangling for _Class and _NativeClass layout constraints
  • Loading branch information
swiftix committed Mar 23, 2017
2 parents d90032c + e7503b1 commit 415736b
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/ABI.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1173,6 +1173,8 @@ Property behaviors are implemented using private protocol conformances.
LAYOUT-CONSTRAINT ::= 'N' // NativeRefCountedObject
LAYOUT-CONSTRAINT ::= 'R' // RefCountedObject
LAYOUT-CONSTRAINT ::= 'T' // Trivial
LAYOUT-CONSTRAINT ::= 'C' // Class
LAYOUT-CONSTRAINT ::= 'D' // NativeClass
LAYOUT-CONSTRAINT ::= 'E' LAYOUT-SIZE-AND-ALIGNMENT // Trivial of exact size
LAYOUT-CONSTRAINT ::= 'e' LAYOUT-SIZE // Trivial of exact size
LAYOUT-CONSTRAINT ::= 'M' LAYOUT-SIZE-AND-ALIGNMENT // Trivial of size at most N bits
Expand Down
6 changes: 6 additions & 0 deletions lib/AST/ASTMangler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1765,6 +1765,12 @@ void ASTMangler::appendOpParamForLayoutConstraint(LayoutConstraint layout) {
case LayoutConstraintKind::NativeRefCountedObject:
appendOperatorParam("N");
break;
case LayoutConstraintKind::Class:
appendOperatorParam("C");
break;
case LayoutConstraintKind::NativeClass:
appendOperatorParam("D");
break;
case LayoutConstraintKind::Trivial:
appendOperatorParam("T");
break;
Expand Down
2 changes: 2 additions & 0 deletions lib/AST/ASTPrinter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4342,6 +4342,8 @@ void LayoutConstraintInfo::print(ASTPrinter &Printer,
case LayoutConstraintKind::UnknownLayout:
case LayoutConstraintKind::RefCountedObject:
case LayoutConstraintKind::NativeRefCountedObject:
case LayoutConstraintKind::Class:
case LayoutConstraintKind::NativeClass:
case LayoutConstraintKind::Trivial:
return;
case LayoutConstraintKind::TrivialOfAtMostSize:
Expand Down
4 changes: 4 additions & 0 deletions lib/Demangling/Demangler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1837,6 +1837,10 @@ NodePointer Demangler::demangleGenericRequirement() {
name = "R";
} else if (c == 'N') {
name = "N";
} else if (c == 'C') {
name = "C";
} else if (c == 'D') {
name = "D";
} else if (c == 'T') {
name = "T";
} else if (c == 'E') {
Expand Down
4 changes: 4 additions & 0 deletions lib/Demangling/NodePrinter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1561,6 +1561,10 @@ void NodePrinter::print(NodePointer pointer, bool asContext, bool suppressType)
name = "_RefCountedObject";
} else if (c == 'N') {
name = "_NativeRefCountedObject";
} else if (c == 'C') {
name = "_Class";
} else if (c == 'D') {
name = "_NativeClass";
} else if (c == 'T') {
name = "_Trivial";
} else if (c == 'E' || c == 'e') {
Expand Down

0 comments on commit 415736b

Please sign in to comment.