summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
Diffstat (limited to 'llvm')
-rw-r--r--llvm/include/llvm/MC/MCParser/MCAsmLexer.h2
-rw-r--r--llvm/include/llvm/MC/MCParser/MCAsmParser.h5
-rw-r--r--llvm/include/llvm/MC/MCParser/MCAsmParserExtension.h9
-rw-r--r--llvm/lib/MC/MCParser/MCAsmParser.cpp2
4 files changed, 15 insertions, 3 deletions
diff --git a/llvm/include/llvm/MC/MCParser/MCAsmLexer.h b/llvm/include/llvm/MC/MCParser/MCAsmLexer.h
index f7e73f9c1d9..b05891c1325 100644
--- a/llvm/include/llvm/MC/MCParser/MCAsmLexer.h
+++ b/llvm/include/llvm/MC/MCParser/MCAsmLexer.h
@@ -157,7 +157,7 @@ public:
SMLoc getLoc() const;
/// Get the current (last) lexed token.
- const AsmToken &getTok() {
+ const AsmToken &getTok() const {
return CurTok;
}
diff --git a/llvm/include/llvm/MC/MCParser/MCAsmParser.h b/llvm/include/llvm/MC/MCParser/MCAsmParser.h
index d3be208eb82..34188e66e62 100644
--- a/llvm/include/llvm/MC/MCParser/MCAsmParser.h
+++ b/llvm/include/llvm/MC/MCParser/MCAsmParser.h
@@ -87,6 +87,9 @@ public:
virtual SourceMgr &getSourceManager() = 0;
virtual MCAsmLexer &getLexer() = 0;
+ const MCAsmLexer &getLexer() const {
+ return const_cast<MCAsmParser*>(this)->getLexer();
+ }
virtual MCContext &getContext() = 0;
@@ -138,7 +141,7 @@ public:
virtual const AsmToken &Lex() = 0;
/// Get the current AsmToken from the stream.
- const AsmToken &getTok();
+ const AsmToken &getTok() const;
/// \brief Report an error at the current lexer location.
bool TokError(const Twine &Msg, ArrayRef<SMRange> Ranges = None);
diff --git a/llvm/include/llvm/MC/MCParser/MCAsmParserExtension.h b/llvm/include/llvm/MC/MCParser/MCAsmParserExtension.h
index 2eda3a9a214..bfc0afa132b 100644
--- a/llvm/include/llvm/MC/MCParser/MCAsmParserExtension.h
+++ b/llvm/include/llvm/MC/MCParser/MCAsmParserExtension.h
@@ -52,8 +52,17 @@ public:
/// @{
MCContext &getContext() { return getParser().getContext(); }
+
MCAsmLexer &getLexer() { return getParser().getLexer(); }
+ const MCAsmLexer &getLexer() const {
+ return const_cast<MCAsmParserExtension *>(this)->getLexer();
+ }
+
MCAsmParser &getParser() { return *Parser; }
+ const MCAsmParser &getParser() const {
+ return const_cast<MCAsmParserExtension*>(this)->getParser();
+ }
+
SourceMgr &getSourceManager() { return getParser().getSourceManager(); }
MCStreamer &getStreamer() { return getParser().getStreamer(); }
bool Warning(SMLoc L, const Twine &Msg) {
diff --git a/llvm/lib/MC/MCParser/MCAsmParser.cpp b/llvm/lib/MC/MCParser/MCAsmParser.cpp
index e417aa97716..290dcb29774 100644
--- a/llvm/lib/MC/MCParser/MCAsmParser.cpp
+++ b/llvm/lib/MC/MCParser/MCAsmParser.cpp
@@ -29,7 +29,7 @@ void MCAsmParser::setTargetParser(MCTargetAsmParser &P) {
TargetParser->Initialize(*this);
}
-const AsmToken &MCAsmParser::getTok() {
+const AsmToken &MCAsmParser::getTok() const {
return getLexer().getTok();
}
OpenPOWER on IntegriCloud