summaryrefslogtreecommitdiff
path: root/tools/llvm-mc/AsmParser.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-07-31 17:47:16 +0000
committerChris Lattner <sabre@nondot.org>2009-07-31 17:47:16 +0000
commit56594f98848ac6d1885662644b5652c04c0d0831 (patch)
treef5dfb3ecf44bd901f18e4eaa1a552675ef1d1c93 /tools/llvm-mc/AsmParser.cpp
parentf26e03bc7e30162197641406e37e662a15d80f7e (diff)
downloadllvm-56594f98848ac6d1885662644b5652c04c0d0831.tar.gz
llvm-56594f98848ac6d1885662644b5652c04c0d0831.tar.bz2
llvm-56594f98848ac6d1885662644b5652c04c0d0831.tar.xz
fix a bunch of failing tests now that MCContext::GetSection doesn't create sections.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77689 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-mc/AsmParser.cpp')
-rw-r--r--tools/llvm-mc/AsmParser.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/tools/llvm-mc/AsmParser.cpp b/tools/llvm-mc/AsmParser.cpp
index 3cd2b8e754..8348479240 100644
--- a/tools/llvm-mc/AsmParser.cpp
+++ b/tools/llvm-mc/AsmParser.cpp
@@ -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 @@ bool AsmParser::ParseDirectiveDarwinSection() {
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 @@ bool AsmParser::ParseDirectiveSectionSwitch(const char *Section,
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;
}