summaryrefslogtreecommitdiff
path: root/lib/MC/MCParser/DarwinAsmParser.cpp
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2010-07-18 20:15:59 +0000
committerDaniel Dunbar <daniel@zuster.org>2010-07-18 20:15:59 +0000
commit6a46d571b461246e36f82c146e17bf614d2114ea (patch)
tree3c1648e78244d90fb2f723af1dc62d882f667780 /lib/MC/MCParser/DarwinAsmParser.cpp
parent7a570d09ac8630f782d394878baf6645cfd264e7 (diff)
downloadllvm-6a46d571b461246e36f82c146e17bf614d2114ea.tar.gz
llvm-6a46d571b461246e36f82c146e17bf614d2114ea.tar.bz2
llvm-6a46d571b461246e36f82c146e17bf614d2114ea.tar.xz
MC/AsmParser: Fix .abort and .secure_log_unique to accept arbitrary token
sequences, not just strings. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108655 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/MC/MCParser/DarwinAsmParser.cpp')
-rw-r--r--lib/MC/MCParser/DarwinAsmParser.cpp17
1 files changed, 6 insertions, 11 deletions
diff --git a/lib/MC/MCParser/DarwinAsmParser.cpp b/lib/MC/MCParser/DarwinAsmParser.cpp
index 7d8639ea4d..3b86390da4 100644
--- a/lib/MC/MCParser/DarwinAsmParser.cpp
+++ b/lib/MC/MCParser/DarwinAsmParser.cpp
@@ -537,28 +537,22 @@ bool DarwinAsmParser::ParseDirectiveSection() {
}
/// ParseDirectiveSecureLogUnique
-/// ::= .secure_log_unique "log message"
+/// ::= .secure_log_unique ... message ...
bool DarwinAsmParser::ParseDirectiveSecureLogUnique(StringRef, SMLoc IDLoc) {
- std::string LogMessage;
-
- if (getLexer().isNot(AsmToken::String))
- LogMessage = "";
- else{
- LogMessage = getTok().getString();
- Lex();
- }
-
+ StringRef LogMessage = getParser().ParseStringToEndOfStatement();
if (getLexer().isNot(AsmToken::EndOfStatement))
return TokError("unexpected token in '.secure_log_unique' directive");
if (getContext().getSecureLogUsed() != false)
return Error(IDLoc, ".secure_log_unique specified multiple times");
- char *SecureLogFile = getContext().getSecureLogFile();
+ // Get the secure log path.
+ const char *SecureLogFile = getContext().getSecureLogFile();
if (SecureLogFile == NULL)
return Error(IDLoc, ".secure_log_unique used but AS_SECURE_LOG_FILE "
"environment variable unset.");
+ // Open the secure log file if we haven't already.
raw_ostream *OS = getContext().getSecureLog();
if (OS == NULL) {
std::string Err;
@@ -571,6 +565,7 @@ bool DarwinAsmParser::ParseDirectiveSecureLogUnique(StringRef, SMLoc IDLoc) {
getContext().setSecureLog(OS);
}
+ // Write the message.
int CurBuf = getSourceManager().FindBufferContainingLoc(IDLoc);
*OS << getSourceManager().getBufferInfo(CurBuf).Buffer->getBufferIdentifier()
<< ":" << getSourceManager().FindLineNumber(IDLoc, CurBuf) << ":"