summaryrefslogtreecommitdiff
path: root/lib/MC/MCInstPrinter.cpp
diff options
context:
space:
mode:
authorKevin Enderby <enderby@apple.com>2012-10-23 22:52:52 +0000
committerKevin Enderby <enderby@apple.com>2012-10-23 22:52:52 +0000
commite1d4a8813427b76c5f59cf5b70a9df734b7e9284 (patch)
treea20c95c84240baea4d82d5839d641373b28c4ead /lib/MC/MCInstPrinter.cpp
parent0787274b70e718af737bd3c0f427574acd829810 (diff)
downloadllvm-e1d4a8813427b76c5f59cf5b70a9df734b7e9284.tar.gz
llvm-e1d4a8813427b76c5f59cf5b70a9df734b7e9284.tar.bz2
llvm-e1d4a8813427b76c5f59cf5b70a9df734b7e9284.tar.xz
Make branch heavy code for generating marked up disassembly simpler
and easier to read by adding a couple helper functions. Suggestion by Chandler Carruth and seconded by Meador Inge! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166515 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/MC/MCInstPrinter.cpp')
-rw-r--r--lib/MC/MCInstPrinter.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/MC/MCInstPrinter.cpp b/lib/MC/MCInstPrinter.cpp
index 847bcc0a16..41d90abeeb 100644
--- a/lib/MC/MCInstPrinter.cpp
+++ b/lib/MC/MCInstPrinter.cpp
@@ -36,3 +36,17 @@ void MCInstPrinter::printAnnotation(raw_ostream &OS, StringRef Annot) {
OS << " " << MAI.getCommentString() << " " << Annot;
}
}
+
+/// Utility functions to make adding mark ups simpler.
+StringRef MCInstPrinter::markup(StringRef s) const {
+ if (getUseMarkup())
+ return s;
+ else
+ return "";
+}
+StringRef MCInstPrinter::markup(StringRef a, StringRef b) const {
+ if (getUseMarkup())
+ return a;
+ else
+ return b;
+}