X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FMC%2FMCParser%2FDarwinAsmParser.cpp;h=9029c6d08515d5509cdc066c744d6fc73a2fe4ef;hb=cddd236e8a5acb80e9a0e79dc63f6cfaa8205b86;hp=7fda7ac5e150bd08fa24cf81020b0a0310fd1063;hpb=bfdcc70d34f9c2bf3d4815c6d29fd43f01db8b76;p=oota-llvm.git diff --git a/lib/MC/MCParser/DarwinAsmParser.cpp b/lib/MC/MCParser/DarwinAsmParser.cpp index 7fda7ac5e15..9029c6d0851 100644 --- a/lib/MC/MCParser/DarwinAsmParser.cpp +++ b/lib/MC/MCParser/DarwinAsmParser.cpp @@ -87,6 +87,8 @@ public: AddDirectiveHandler< &DarwinAsmParser::ParseSectionDirectiveLazySymbolPointers>( ".lazy_symbol_pointer"); + AddDirectiveHandler<&DarwinAsmParser::ParseDirectiveLinkerOption>( + ".linker_option"); AddDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveLiteral16>( ".literal16"); AddDirectiveHandler<&DarwinAsmParser::ParseSectionDirectiveLiteral4>( @@ -163,6 +165,7 @@ public: bool ParseDirectiveDesc(StringRef, SMLoc); bool ParseDirectiveDumpOrLoad(StringRef, SMLoc); bool ParseDirectiveLsym(StringRef, SMLoc); + bool ParseDirectiveLinkerOption(StringRef, SMLoc); bool ParseDirectiveSection(StringRef, SMLoc); bool ParseDirectivePushSection(StringRef, SMLoc); bool ParseDirectivePopSection(StringRef, SMLoc); @@ -435,6 +438,33 @@ bool DarwinAsmParser::ParseDirectiveDumpOrLoad(StringRef Directive, return Warning(IDLoc, "ignoring directive .load for now"); } +/// ParseDirectiveLinkerOption +/// ::= .linker_option "string" ( , "string" )* +bool DarwinAsmParser::ParseDirectiveLinkerOption(StringRef IDVal, SMLoc) { + SmallVector Args; + for (;;) { + if (getLexer().isNot(AsmToken::String)) + return TokError("expected string in '" + Twine(IDVal) + "' directive"); + + std::string Data; + if (getParser().ParseEscapedString(Data)) + return true; + + Args.push_back(Data); + + Lex(); + if (getLexer().is(AsmToken::EndOfStatement)) + break; + + if (getLexer().isNot(AsmToken::Comma)) + return TokError("unexpected token in '" + Twine(IDVal) + "' directive"); + Lex(); + } + + getStreamer().EmitLinkerOptions(Args); + return false; +} + /// ParseDirectiveLsym /// ::= .lsym identifier , expression bool DarwinAsmParser::ParseDirectiveLsym(StringRef, SMLoc) {