From 21aedc4b83ef555e197edb0e50d3d7d522c7b333 Mon Sep 17 00:00:00 2001 From: Reid Kleckner Date: Mon, 11 Aug 2014 18:34:43 +0000 Subject: MC: Diagnose an unexpected token in COFF .section instead of asserting This can easily arise when trying to assemble and ELF style .section directive for a COFF object file. llvm-svn: 215373 --- llvm/lib/MC/MCParser/COFFAsmParser.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'llvm/lib/MC') diff --git a/llvm/lib/MC/MCParser/COFFAsmParser.cpp b/llvm/lib/MC/MCParser/COFFAsmParser.cpp index 5ecf9e5c64b..6f82e6ef3e4 100644 --- a/llvm/lib/MC/MCParser/COFFAsmParser.cpp +++ b/llvm/lib/MC/MCParser/COFFAsmParser.cpp @@ -364,6 +364,10 @@ bool COFFAsmParser::ParseDirectiveSection(StringRef, SMLoc) { Flags |= COFF::IMAGE_SCN_LNK_COMDAT; + if (!getLexer().is(AsmToken::Identifier)) + return TokError("expected comdat type such as 'discard' or 'largest' " + "after protection bits"); + if (parseCOMDATType(Type)) return true; -- cgit v1.2.3