diff options
| -rw-r--r-- | clang/lib/Interpreter/Interpreter.cpp | 7 | ||||
| -rw-r--r-- | llvm/docs/Security.rst | 2 | ||||
| -rw-r--r-- | llvm/lib/MC/MCParser/AsmLexer.cpp | 9 | ||||
| -rw-r--r-- | llvm/test/MC/AsmParser/comments-x86-darwin-eol-dropped.s | 10 |
4 files changed, 20 insertions, 8 deletions
diff --git a/clang/lib/Interpreter/Interpreter.cpp b/clang/lib/Interpreter/Interpreter.cpp index b05cb5a..cde354c 100644 --- a/clang/lib/Interpreter/Interpreter.cpp +++ b/clang/lib/Interpreter/Interpreter.cpp @@ -581,12 +581,7 @@ Interpreter::Parse(llvm::StringRef Code) { if (!TuOrErr) return TuOrErr.takeError(); - PTUs.emplace_back(PartialTranslationUnit()); - PartialTranslationUnit &LastPTU = PTUs.back(); - LastPTU.TUPart = *TuOrErr; - - if (std::unique_ptr<llvm::Module> M = Act->GenModule()) - LastPTU.TheModule = std::move(M); + PartialTranslationUnit &LastPTU = IncrParser->RegisterPTU(*TuOrErr); return LastPTU; } diff --git a/llvm/docs/Security.rst b/llvm/docs/Security.rst index 5cb8d04..d95b552 100644 --- a/llvm/docs/Security.rst +++ b/llvm/docs/Security.rst @@ -51,7 +51,7 @@ username for an individual isn't available, the brackets will be empty. * Nikhil Gupta (Nvidia) [] * Oliver Hunt (Apple) [@ojhunt] * Peter Smith (ARM) [@smithp35] -* Pietro Albini (Ferrous Systems; Rust) [@pietroalbini] +* Pietro Albini (Oxide Computer Company; Rust) [@pietroalbini] * Serge Guelton (Mozilla) [@serge-sans-paille] * Sergey Zverev (Intel) [@offsake] * Shayne Hiet-Block (Microsoft) [@GreatKeeper] 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/test/MC/AsmParser/comments-x86-darwin-eol-dropped.s b/llvm/test/MC/AsmParser/comments-x86-darwin-eol-dropped.s new file mode 100644 index 0000000..662e598 --- /dev/null +++ b/llvm/test/MC/AsmParser/comments-x86-darwin-eol-dropped.s @@ -0,0 +1,10 @@ +// RUN: llvm-mc -triple i386-apple-darwin %s 2>&1 | FileCheck %s +.p2align 3 +// CHECK: .p2align 3 +test: +// CHECK-LABEL: test: +// CHECK: pushl %ebp +// CHECK: movl %esp, %ebp +# Check that the following line's comment # doesn't drop the movl after + pushl %ebp # + movl %esp, %ebp |
