Skip to content

Commit 2692978

Browse files
committed
[X86] X86AsmParser - make methods const where possible. NFCI.
Reported by cppcheck
1 parent 091b18b commit 2692978

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ class X86AsmParser : public MCTargetAsmParser {
164164
SmallVector<InfixCalculatorTok, 4> InfixOperatorStack;
165165
SmallVector<ICToken, 4> PostfixStack;
166166

167-
bool isUnaryOperator(const InfixCalculatorTok Op) {
167+
bool isUnaryOperator(InfixCalculatorTok Op) const {
168168
return Op == IC_NEG || Op == IC_NOT;
169169
}
170170

@@ -395,24 +395,24 @@ class X86AsmParser : public MCTargetAsmParser {
395395
MemExpr(false), OffsetOperator(false) {}
396396

397397
void addImm(int64_t imm) { Imm += imm; }
398-
short getBracCount() { return BracCount; }
399-
bool isMemExpr() { return MemExpr; }
400-
bool isOffsetOperator() { return OffsetOperator; }
401-
SMLoc getOffsetLoc() { return OffsetOperatorLoc; }
402-
unsigned getBaseReg() { return BaseReg; }
403-
unsigned getIndexReg() { return IndexReg; }
404-
unsigned getScale() { return Scale; }
405-
const MCExpr *getSym() { return Sym; }
406-
StringRef getSymName() { return SymName; }
407-
StringRef getType() { return CurType.Name; }
408-
unsigned getSize() { return CurType.Size; }
409-
unsigned getElementSize() { return CurType.ElementSize; }
410-
unsigned getLength() { return CurType.Length; }
398+
short getBracCount() const { return BracCount; }
399+
bool isMemExpr() const { return MemExpr; }
400+
bool isOffsetOperator() const { return OffsetOperator; }
401+
SMLoc getOffsetLoc() const { return OffsetOperatorLoc; }
402+
unsigned getBaseReg() const { return BaseReg; }
403+
unsigned getIndexReg() const { return IndexReg; }
404+
unsigned getScale() const { return Scale; }
405+
const MCExpr *getSym() const { return Sym; }
406+
StringRef getSymName() const { return SymName; }
407+
StringRef getType() const { return CurType.Name; }
408+
unsigned getSize() const { return CurType.Size; }
409+
unsigned getElementSize() const { return CurType.ElementSize; }
410+
unsigned getLength() const { return CurType.Length; }
411411
int64_t getImm() { return Imm + IC.execute(); }
412-
bool isValidEndState() {
412+
bool isValidEndState() const {
413413
return State == IES_RBRAC || State == IES_INTEGER;
414414
}
415-
bool hadError() { return State == IES_ERROR; }
415+
bool hadError() const { return State == IES_ERROR; }
416416
const InlineAsmIdentifierInfo &getIdentifierInfo() const { return Info; }
417417

418418
void onOr() {

0 commit comments

Comments
 (0)