aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/MC/MCParser
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/MC/MCParser')
-rw-r--r--llvm/lib/MC/MCParser/AsmLexer.cpp9
-rw-r--r--llvm/lib/MC/MCParser/MasmParser.cpp10
2 files changed, 13 insertions, 6 deletions
diff --git a/llvm/lib/MC/MCParser/AsmLexer.cpp b/llvm/lib/MC/MCParser/AsmLexer.cpp
index 968ccf7..a6188f0 100644
--- a/llvm/lib/MC/MCParser/AsmLexer.cpp
+++ b/llvm/lib/MC/MCParser/AsmLexer.cpp
@@ -835,7 +835,14 @@ AsmToken AsmLexer::LexToken() {
}
if (isAtStartOfComment(TokStart)) {
- CurPtr += MAI.getCommentString().size() - 1;
+ StringRef CommentString = MAI.getCommentString();
+ // For multi-char comment strings, advance CurPtr only if we matched the
+ // full string. This stops us from accidentally eating the newline if the
+ // current line ends in a single comment char.
+ if (CommentString.size() > 1 &&
+ StringRef(TokStart, CommentString.size()) == CommentString) {
+ CurPtr += CommentString.size() - 1;
+ }
return LexLineComment();
}
diff --git a/llvm/lib/MC/MCParser/MasmParser.cpp b/llvm/lib/MC/MCParser/MasmParser.cpp
index d4901d9..8a8f111 100644
--- a/llvm/lib/MC/MCParser/MasmParser.cpp
+++ b/llvm/lib/MC/MCParser/MasmParser.cpp
@@ -5844,11 +5844,11 @@ bool MasmParser::lookUpField(const StructInfo &Structure, StringRef Member,
bool MasmParser::lookUpType(StringRef Name, AsmTypeInfo &Info) const {
unsigned Size = StringSwitch<unsigned>(Name)
- .CasesLower("byte", "db", "sbyte", 1)
- .CasesLower("word", "dw", "sword", 2)
- .CasesLower("dword", "dd", "sdword", 4)
- .CasesLower("fword", "df", 6)
- .CasesLower("qword", "dq", "sqword", 8)
+ .CasesLower({"byte", "db", "sbyte"}, 1)
+ .CasesLower({"word", "dw", "sword"}, 2)
+ .CasesLower({"dword", "dd", "sdword"}, 4)
+ .CasesLower({"fword", "df"}, 6)
+ .CasesLower({"qword", "dq", "sqword"}, 8)
.CaseLower("real4", 4)
.CaseLower("real8", 8)
.CaseLower("real10", 10)