summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNirav Dave <niravd@google.com>2016-07-29 14:42:00 +0000
committerNirav Dave <niravd@google.com>2016-07-29 14:42:00 +0000
commit8b3dc876ea494f2b1e403721041116daf80dbe30 (patch)
tree8115af6e1ae96cc8b10d1c0f418c9230eda9ac7b
parent22ae7df6f430596f81e616476fe1cc6ded72d26c (diff)
downloadbcm5719-llvm-8b3dc876ea494f2b1e403721041116daf80dbe30.tar.gz
bcm5719-llvm-8b3dc876ea494f2b1e403721041116daf80dbe30.zip
[MC] When emitting output hash comments always use standard line comment seperator
llvm-svn: 277146
-rw-r--r--llvm/lib/MC/MCAsmStreamer.cpp7
-rw-r--r--llvm/lib/MC/MCParser/AsmLexer.cpp2
-rw-r--r--llvm/test/MC/AsmParser/inline-comments-2.ll22
3 files changed, 27 insertions, 4 deletions
diff --git a/llvm/lib/MC/MCAsmStreamer.cpp b/llvm/lib/MC/MCAsmStreamer.cpp
index ef2f7810dea..ed85f153002 100644
--- a/llvm/lib/MC/MCAsmStreamer.cpp
+++ b/llvm/lib/MC/MCAsmStreamer.cpp
@@ -357,9 +357,10 @@ void MCAsmStreamer::addExplicitComment(const Twine &T) {
ExplicitCommentToEmit.append("\t");
ExplicitCommentToEmit.append(c.str());
} else if (c.front() == '#') {
- // # are comments for ## commentString. Output extra #.
- ExplicitCommentToEmit.append("\t#");
- ExplicitCommentToEmit.append(c.str());
+
+ ExplicitCommentToEmit.append("\t");
+ ExplicitCommentToEmit.append(MAI->getCommentString());
+ ExplicitCommentToEmit.append(c.slice(1, c.size()).str());
} else
assert(false && "Unexpected Assembly Comment");
// full line comments immediately output
diff --git a/llvm/lib/MC/MCParser/AsmLexer.cpp b/llvm/lib/MC/MCParser/AsmLexer.cpp
index d56071aea4d..7037bb1d5fa 100644
--- a/llvm/lib/MC/MCParser/AsmLexer.cpp
+++ b/llvm/lib/MC/MCParser/AsmLexer.cpp
@@ -197,7 +197,7 @@ AsmToken AsmLexer::LexLineComment() {
CurChar = getNextChar();
IsAtStartOfLine = true;
- // Whis is a whole line comment. leave newline
+ // This is a whole line comment. leave newline
if (IsAtStartOfStatement)
return AsmToken(AsmToken::EndOfStatement,
StringRef(TokStart, CurPtr - TokStart));
diff --git a/llvm/test/MC/AsmParser/inline-comments-2.ll b/llvm/test/MC/AsmParser/inline-comments-2.ll
new file mode 100644
index 00000000000..70d49a55727
--- /dev/null
+++ b/llvm/test/MC/AsmParser/inline-comments-2.ll
@@ -0,0 +1,22 @@
+; RUN: llc %s -o - | sed -n -e '/@APP/,/@NO_APP/p' > %t
+; RUN: sed -n -e 's/^;CHECK://p' %s > %t2
+; RUN: diff %t %t2
+
+target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
+target triple = "arm-eabi"
+
+; Function Attrs: nounwind uwtable
+define void @foo() #0 {
+entry:
+ call void asm sideeffect "#isolated preprocessor comment", "~{dirflag},~{fpsr},~{flags}"() #0
+;CHECK: @APP
+;CHECK: @isolated preprocessor comment
+;CHECK: @NO_APP
+ ret void
+}
+
+attributes #0 = { nounwind }
+
+!llvm.ident = !{!0}
+
+!0 = !{!""}
OpenPOWER on IntegriCloud