[llvm-commits] [llvm] r77689 - in /llvm/trunk/tools/llvm-mc: AsmParser.cpp llvm-mc.cpp

Chris Lattner sabre at nondot.org
Fri Jul 31 10:47:16 PDT 2009


Author: lattner
Date: Fri Jul 31 12:47:16 2009
New Revision: 77689

URL: http://llvm.org/viewvc/llvm-project?rev=77689&view=rev
Log:
fix a bunch of failing tests now that MCContext::GetSection doesn't create sections.

Modified:
    llvm/trunk/tools/llvm-mc/AsmParser.cpp
    llvm/trunk/tools/llvm-mc/llvm-mc.cpp

Modified: llvm/trunk/tools/llvm-mc/AsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmParser.cpp?rev=77689&r1=77688&r2=77689&view=diff

==============================================================================
--- llvm/trunk/tools/llvm-mc/AsmParser.cpp (original)
+++ llvm/trunk/tools/llvm-mc/AsmParser.cpp Fri Jul 31 12:47:16 2009
@@ -17,6 +17,7 @@
 #include "llvm/ADT/Twine.h"
 #include "llvm/MC/MCContext.h"
 #include "llvm/MC/MCInst.h"
+#include "llvm/MC/MCSection.h"
 #include "llvm/MC/MCStreamer.h"
 #include "llvm/MC/MCSymbol.h"
 #include "llvm/Support/SourceMgr.h"
@@ -641,7 +642,12 @@
     return TokError("unexpected token in '.section' directive");
   Lexer.Lex();
 
-  Out.SwitchSection(Ctx.GetSection(Section.c_str()));
+  // FIXME: Arch specific.
+  MCSection *S = Ctx.GetSection(Section);
+  if (S == 0)
+    S = MCSection::Create(Section, Ctx);
+  
+  Out.SwitchSection(S);
   return false;
 }
 
@@ -657,7 +663,12 @@
     SectionStr += Directives;
   }
   
-  Out.SwitchSection(Ctx.GetSection(Section));
+  // FIXME: Arch specific.
+  MCSection *S = Ctx.GetSection(Section);
+  if (S == 0)
+    S = MCSection::Create(Section, Ctx);
+  
+  Out.SwitchSection(S);
   return false;
 }
 

Modified: llvm/trunk/tools/llvm-mc/llvm-mc.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/llvm-mc.cpp?rev=77689&r1=77688&r2=77689&view=diff

==============================================================================
--- llvm/trunk/tools/llvm-mc/llvm-mc.cpp (original)
+++ llvm/trunk/tools/llvm-mc/llvm-mc.cpp Fri Jul 31 12:47:16 2009
@@ -13,6 +13,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/MC/MCContext.h"
+#include "llvm/MC/MCSection.h"
 #include "llvm/MC/MCStreamer.h"
 #include "llvm/ADT/OwningPtr.h"
 #include "llvm/Support/CommandLine.h"
@@ -189,8 +190,8 @@
   OwningPtr<MCStreamer> Str(createAsmStreamer(Ctx, outs()));
 
   // FIXME: Target hook & command line option for initial section.
-  Str.get()->SwitchSection(Ctx.GetSection("__TEXT,__text,"
-                                          "regular,pure_instructions"));
+  Str.get()->SwitchSection(MCSection::Create("__TEXT,__text,"
+                                             "regular,pure_instructions", Ctx));
 
   AsmParser Parser(SrcMgr, Ctx, *Str.get());
   OwningPtr<TargetAsmParser> TAP(GetTargetAsmParser(ProgName, Parser));





More information about the llvm-commits mailing list