llvm.org GIT mirror llvm / 26dd220
Add const. NFC. This adds const to a few methods that already return const references or creates a const version when they reterun non-const references. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221666 91177308-0d34-0410-b5e6-96231b3b80d8 Rafael Espindola 6 years ago
4 changed file(s) with 15 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
156156 SMLoc getLoc() const;
157157
158158 /// Get the current (last) lexed token.
159 const AsmToken &getTok() {
159 const AsmToken &getTok() const {
160160 return CurTok;
161161 }
162162
8686 virtual SourceMgr &getSourceManager() = 0;
8787
8888 virtual MCAsmLexer &getLexer() = 0;
89 const MCAsmLexer &getLexer() const {
90 return const_cast(this)->getLexer();
91 }
8992
9093 virtual MCContext &getContext() = 0;
9194
137140 virtual const AsmToken &Lex() = 0;
138141
139142 /// Get the current AsmToken from the stream.
140 const AsmToken &getTok();
143 const AsmToken &getTok() const;
141144
142145 /// \brief Report an error at the current lexer location.
143146 bool TokError(const Twine &Msg, ArrayRef Ranges = None);
5151 /// @{
5252
5353 MCContext &getContext() { return getParser().getContext(); }
54
5455 MCAsmLexer &getLexer() { return getParser().getLexer(); }
56 const MCAsmLexer &getLexer() const {
57 return const_cast(this)->getLexer();
58 }
59
5560 MCAsmParser &getParser() { return *Parser; }
61 const MCAsmParser &getParser() const {
62 return const_cast(this)->getParser();
63 }
64
5665 SourceMgr &getSourceManager() { return getParser().getSourceManager(); }
5766 MCStreamer &getStreamer() { return getParser().getStreamer(); }
5867 bool Warning(SMLoc L, const Twine &Msg) {
2828 TargetParser->Initialize(*this);
2929 }
3030
31 const AsmToken &MCAsmParser::getTok() {
31 const AsmToken &MCAsmParser::getTok() const {
3232 return getLexer().getTok();
3333 }
3434