[llvm-commits] [llvm] r166762 - /llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp

Nicolas Geoffray nicolas.geoffray at gmail.com
Fri Oct 26 12:42:01 PDT 2012


Hi Rafael,

That would be great! Somehow compiling the c++ output, run it and compare
with the original source. I don't know if llvm has some existing testing
framework for doing that, but it is certainly feasible.

Nicolas

On Fri, Oct 26, 2012 at 8:33 PM, Rafael EspĂ­ndola <
rafael.espindola at gmail.com> wrote:

> should we start adding tests for the cpp backend?
>
> On 26 October 2012 05:14, Nicolas Geoffray <nicolas.geoffray at lip6.fr>
> wrote:
> > Author: geoffray
> > Date: Fri Oct 26 04:14:38 2012
> > New Revision: 166762
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=166762&view=rev
> > Log:
> > Fix CPP backend for method attributes by creating a block where a new
> AttrBuilder is defined for each attribute.
> >
> >
> > Modified:
> >     llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp
> >
> > Modified: llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp
> > URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp?rev=166762&r1=166761&r2=166762&view=diff
> >
> ==============================================================================
> > --- llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp (original)
> > +++ llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp Fri Oct 26 04:14:38
> 2012
> > @@ -476,11 +476,11 @@
> >        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 @@
> >        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);
> >
> >
> > _______________________________________________
> > llvm-commits mailing list
> > llvm-commits at cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20121026/6c07ad2f/attachment.html>


More information about the llvm-commits mailing list