1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 19:12:56 +02:00

Fix CPP backend for method attributes by creating a block where a new AttrBuilder is defined for each attribute.

llvm-svn: 166762
This commit is contained in:
Nicolas Geoffray 2012-10-26 09:14:38 +00:00
parent 7877df8be1
commit 4945aaa7dd

View File

@ -476,11 +476,11 @@ void CppWriter::printAttributes(const AttrListPtr &PAL,
unsigned index = PAL.getSlot(i).Index;
AttrBuilder attrs(PAL.getSlot(i).Attrs);
Out << "PAWI.Index = " << index << "U;\n";
Out << " AttrBuilder B;\n";
Out << " {\n AttrBuilder B;\n";
#define HANDLE_ATTR(X) \
if (attrs.hasAttribute(Attributes::X)) \
Out << " B.addAttribute(Attributes::" #X ");\n"; \
Out << " B.addAttribute(Attributes::" #X ");\n"; \
attrs.removeAttribute(Attributes::X);
HANDLE_ATTR(SExt);
@ -509,11 +509,10 @@ void CppWriter::printAttributes(const AttrListPtr &PAL,
HANDLE_ATTR(NonLazyBind);
#undef HANDLE_ATTR
if (attrs.hasAttribute(Attributes::StackAlignment))
Out << "B.addStackAlignmentAttr(" << attrs.getStackAlignment() << ")";
nl(Out);
Out << " B.addStackAlignmentAttr(" << attrs.getStackAlignment() << ")\n";
attrs.removeAttribute(Attributes::StackAlignment);
assert(!attrs.hasAttributes() && "Unhandled attribute!");
Out << "PAWI.Attrs = Attributes::get(mod->getContext(), B);";
Out << " PAWI.Attrs = Attributes::get(mod->getContext(), B);\n }";
nl(Out);
Out << "Attrs.push_back(PAWI);";
nl(Out);