[llvm] 2692978 - [X86] X86AsmParser - make methods const where possible. NFCI.
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 22 07:55:26 PDT 2020
Author: Simon Pilgrim
Date: 2020-10-22T15:55:06+01:00
New Revision: 26929780506c3492dddd980da728a92f050fe069
URL: https://github.com/llvm/llvm-project/commit/26929780506c3492dddd980da728a92f050fe069
DIFF: https://github.com/llvm/llvm-project/commit/26929780506c3492dddd980da728a92f050fe069.diff
LOG: [X86] X86AsmParser - make methods const where possible. NFCI.
Reported by cppcheck
Added:
Modified:
llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp b/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
index e18771386751..f13f9cb76437 100644
--- a/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
+++ b/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
@@ -164,7 +164,7 @@ class X86AsmParser : public MCTargetAsmParser {
SmallVector<InfixCalculatorTok, 4> InfixOperatorStack;
SmallVector<ICToken, 4> PostfixStack;
- bool isUnaryOperator(const InfixCalculatorTok Op) {
+ bool isUnaryOperator(InfixCalculatorTok Op) const {
return Op == IC_NEG || Op == IC_NOT;
}
@@ -395,24 +395,24 @@ class X86AsmParser : public MCTargetAsmParser {
MemExpr(false), OffsetOperator(false) {}
void addImm(int64_t imm) { Imm += imm; }
- short getBracCount() { return BracCount; }
- bool isMemExpr() { return MemExpr; }
- bool isOffsetOperator() { return OffsetOperator; }
- SMLoc getOffsetLoc() { return OffsetOperatorLoc; }
- unsigned getBaseReg() { return BaseReg; }
- unsigned getIndexReg() { return IndexReg; }
- unsigned getScale() { return Scale; }
- const MCExpr *getSym() { return Sym; }
- StringRef getSymName() { return SymName; }
- StringRef getType() { return CurType.Name; }
- unsigned getSize() { return CurType.Size; }
- unsigned getElementSize() { return CurType.ElementSize; }
- unsigned getLength() { return CurType.Length; }
+ short getBracCount() const { return BracCount; }
+ bool isMemExpr() const { return MemExpr; }
+ bool isOffsetOperator() const { return OffsetOperator; }
+ SMLoc getOffsetLoc() const { return OffsetOperatorLoc; }
+ unsigned getBaseReg() const { return BaseReg; }
+ unsigned getIndexReg() const { return IndexReg; }
+ unsigned getScale() const { return Scale; }
+ const MCExpr *getSym() const { return Sym; }
+ StringRef getSymName() const { return SymName; }
+ StringRef getType() const { return CurType.Name; }
+ unsigned getSize() const { return CurType.Size; }
+ unsigned getElementSize() const { return CurType.ElementSize; }
+ unsigned getLength() const { return CurType.Length; }
int64_t getImm() { return Imm + IC.execute(); }
- bool isValidEndState() {
+ bool isValidEndState() const {
return State == IES_RBRAC || State == IES_INTEGER;
}
- bool hadError() { return State == IES_ERROR; }
+ bool hadError() const { return State == IES_ERROR; }
const InlineAsmIdentifierInfo &getIdentifierInfo() const { return Info; }
void onOr() {
More information about the llvm-commits
mailing list