зеркало из https://github.com/microsoft/clang.git
add a new inKeepCommentMode() accessor to abstract the KeepCommentMode
ivar. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57397 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
a2c7ad9c73
Коммит
fa95a019da
|
@ -158,6 +158,13 @@ public:
|
|||
KeepCommentMode = Mode;
|
||||
}
|
||||
|
||||
/// inKeepCommentMode - Return true if the lexer should return comments as
|
||||
/// tokens.
|
||||
bool inKeepCommentMode() const {
|
||||
return KeepCommentMode;
|
||||
}
|
||||
|
||||
|
||||
/// ReadToEndOfLine - Read the rest of the current preprocessor line as an
|
||||
/// uninterpreted string. This switches the lexer out of directive mode.
|
||||
std::string ReadToEndOfLine();
|
||||
|
|
|
@ -804,7 +804,7 @@ bool Lexer::SkipBCPLComment(Token &Result, const char *CurPtr) {
|
|||
// Found but did not consume the newline.
|
||||
|
||||
// If we are returning comments as tokens, return this comment as a token.
|
||||
if (KeepCommentMode)
|
||||
if (inKeepCommentMode())
|
||||
return SaveBCPLComment(Result, CurPtr);
|
||||
|
||||
// If we are inside a preprocessor directive and we see the end of line,
|
||||
|
@ -1015,7 +1015,7 @@ bool Lexer::SkipBlockComment(Token &Result, const char *CurPtr) {
|
|||
}
|
||||
|
||||
// If we are returning comments as tokens, return this comment as a token.
|
||||
if (KeepCommentMode) {
|
||||
if (inKeepCommentMode()) {
|
||||
Result.setKind(tok::comment);
|
||||
FormTokenWithChars(Result, CurPtr);
|
||||
return false;
|
||||
|
@ -1263,10 +1263,10 @@ LexNextToken:
|
|||
|
||||
// If the next token is obviously a // or /* */ comment, skip it efficiently
|
||||
// too (without going through the big switch stmt).
|
||||
if (CurPtr[0] == '/' && CurPtr[1] == '/' && !KeepCommentMode) {
|
||||
if (CurPtr[0] == '/' && CurPtr[1] == '/' && !inKeepCommentMode()) {
|
||||
SkipBCPLComment(Result, CurPtr+2);
|
||||
goto SkipIgnoredUnits;
|
||||
} else if (CurPtr[0] == '/' && CurPtr[1] == '*' && !KeepCommentMode) {
|
||||
} else if (CurPtr[0] == '/' && CurPtr[1] == '*' && !inKeepCommentMode()) {
|
||||
SkipBlockComment(Result, CurPtr+2);
|
||||
goto SkipIgnoredUnits;
|
||||
} else if (isHorizontalWhitespace(*CurPtr)) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче