Rename LexerToken methods to be more consistent
llvm-svn: 38970
This commit is contained in:
parent
8c2048710d
commit
509d3c00ed
|
@ -124,12 +124,12 @@ public:
|
||||||
/// the preprocessor.
|
/// the preprocessor.
|
||||||
void Lex(LexerToken &Result) {
|
void Lex(LexerToken &Result) {
|
||||||
// Start a new token.
|
// Start a new token.
|
||||||
Result.StartToken();
|
Result.startToken();
|
||||||
|
|
||||||
// NOTE, any changes here should also change code after calls to
|
// NOTE, any changes here should also change code after calls to
|
||||||
// Preprocessor::HandleDirective
|
// Preprocessor::HandleDirective
|
||||||
if (IsAtStartOfLine) {
|
if (IsAtStartOfLine) {
|
||||||
Result.SetFlag(LexerToken::StartOfLine);
|
Result.setFlag(LexerToken::StartOfLine);
|
||||||
IsAtStartOfLine = false;
|
IsAtStartOfLine = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -185,8 +185,8 @@ private:
|
||||||
/// addition, since tokens cannot overlap, this also updates BufferPtr to be
|
/// addition, since tokens cannot overlap, this also updates BufferPtr to be
|
||||||
/// TokEnd.
|
/// TokEnd.
|
||||||
void FormTokenWithChars(LexerToken &Result, const char *TokEnd) {
|
void FormTokenWithChars(LexerToken &Result, const char *TokEnd) {
|
||||||
Result.SetLocation(getSourceLocation(BufferPtr));
|
Result.setLocation(getSourceLocation(BufferPtr));
|
||||||
Result.SetLength(TokEnd-BufferPtr);
|
Result.setLength(TokEnd-BufferPtr);
|
||||||
BufferPtr = TokEnd;
|
BufferPtr = TokEnd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,45 +52,45 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
tok::TokenKind getKind() const { return Kind; }
|
tok::TokenKind getKind() const { return Kind; }
|
||||||
void SetKind(tok::TokenKind K) { Kind = K; }
|
void setKind(tok::TokenKind K) { Kind = K; }
|
||||||
|
|
||||||
/// getLocation - Return a source location identifier for the specified
|
/// getLocation - Return a source location identifier for the specified
|
||||||
/// offset in the current file.
|
/// offset in the current file.
|
||||||
SourceLocation getLocation() const { return Loc; }
|
SourceLocation getLocation() const { return Loc; }
|
||||||
unsigned getLength() const { return Length; }
|
unsigned getLength() const { return Length; }
|
||||||
|
|
||||||
void SetLocation(SourceLocation L) { Loc = L; }
|
void setLocation(SourceLocation L) { Loc = L; }
|
||||||
void SetLength(unsigned Len) { Length = Len; }
|
void setLength(unsigned Len) { Length = Len; }
|
||||||
|
|
||||||
/// StartToken - Reset all flags to cleared.
|
/// startToken - Reset all flags to cleared.
|
||||||
///
|
///
|
||||||
void StartToken() {
|
void startToken() {
|
||||||
Flags = 0;
|
Flags = 0;
|
||||||
IdentInfo = 0;
|
IdentInfo = 0;
|
||||||
Loc = SourceLocation();
|
Loc = SourceLocation();
|
||||||
}
|
}
|
||||||
|
|
||||||
IdentifierInfo *getIdentifierInfo() const { return IdentInfo; }
|
IdentifierInfo *getIdentifierInfo() const { return IdentInfo; }
|
||||||
void SetIdentifierInfo(IdentifierInfo *II) {
|
void setIdentifierInfo(IdentifierInfo *II) {
|
||||||
IdentInfo = II;
|
IdentInfo = II;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// SetFlag - Set the specified flag.
|
/// setFlag - Set the specified flag.
|
||||||
void SetFlag(TokenFlags Flag) {
|
void setFlag(TokenFlags Flag) {
|
||||||
Flags |= Flag;
|
Flags |= Flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// ClearFlag - Unset the specified flag.
|
/// clearFlag - Unset the specified flag.
|
||||||
void ClearFlag(TokenFlags Flag) {
|
void clearFlag(TokenFlags Flag) {
|
||||||
Flags &= ~Flag;
|
Flags &= ~Flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// SetFlagValue - Set a flag to either true or false.
|
/// setFlagValue - Set a flag to either true or false.
|
||||||
void SetFlagValue(TokenFlags Flag, bool Val) {
|
void setFlagValue(TokenFlags Flag, bool Val) {
|
||||||
if (Val)
|
if (Val)
|
||||||
SetFlag(Flag);
|
setFlag(Flag);
|
||||||
else
|
else
|
||||||
ClearFlag(Flag);
|
clearFlag(Flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// isAtStartOfLine - Return true if this token is at the start of a line.
|
/// isAtStartOfLine - Return true if this token is at the start of a line.
|
||||||
|
|
Loading…
Reference in New Issue