[llvm-commits] [PATCH]: fix platform dependency in AsmParser

Jim Grosbach grosbach at apple.com
Mon Jan 14 10:57:19 PST 2013


Me too.

-j
On Jan 14, 2013, at 10:53 AM, Daniel Dunbar <daniel at zuster.org> wrote:

> LGTM
> 
>  - Daniel
> 
> 
> On Mon, Jan 14, 2013 at 9:43 AM, Eli Bendersky <eliben at google.com> wrote:
> The aim of this patch is to fix the following piece of code in the
> platform-independent AsmParser:
> 
> void AsmParser::CheckForValidSection() {
>   if (!ParsingInlineAsm && !getStreamer().getCurrentSection()) {
>     TokError("expected section directive before assembly directive");
>     Out.SwitchSection(Ctx.getMachOSection(
>                         "__TEXT", "__text",
>                         MCSectionMachO::S_ATTR_PURE_INSTRUCTIONS,
>                         0, SectionKind::getText()));
>   }
> }
> 
> This was added for the "-n" option of llvm-mc.
> 
> The proposed fix adds another virtual method to MCStreamer, called
> InitToTextSection. Conceptually, it's similar to the existing
> InitSections which initializes all common sections and switches to
> text. The new method is implemented by each platform streamer in a way
> that it sees fit. So AsmParser can now do this:
> 
> void AsmParser::CheckForValidSection() {
>   if (!ParsingInlineAsm && !getStreamer().getCurrentSection()) {
>     TokError("expected section directive before assembly directive");
>     Out.InitToTextSection();
>   }
> }
> 
> Which is much more reasonable.
> 
> Please take a look.
> 
> P.S.: some streamers like the Asm streamer and Pure streamer still do
> the MachO-specific thing. This should also be fixed, but probably in a
> separate patch.
> 
> Eli
> 
> _______________________________________________
> 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/20130114/e3aeed8c/attachment.html>


More information about the llvm-commits mailing list