[cfe-commits] r42728 - in /cfe/trunk/Lex: IdentifierTable.cpp Lexer.cpp
Chris Lattner
sabre at nondot.org
Sun Oct 7 01:47:25 PDT 2007
Author: lattner
Date: Sun Oct 7 03:47:24 2007
New Revision: 42728
URL: http://llvm.org/viewvc/llvm-project?rev=42728&view=rev
Log:
implement the Token class in the Lexer.cpp file instead of IdentifierInfo.cpp
Modified:
cfe/trunk/Lex/IdentifierTable.cpp
cfe/trunk/Lex/Lexer.cpp
Modified: cfe/trunk/Lex/IdentifierTable.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Lex/IdentifierTable.cpp?rev=42728&r1=42727&r2=42728&view=diff
==============================================================================
--- cfe/trunk/Lex/IdentifierTable.cpp (original)
+++ cfe/trunk/Lex/IdentifierTable.cpp Sun Oct 7 03:47:24 2007
@@ -19,25 +19,6 @@
using namespace clang;
//===----------------------------------------------------------------------===//
-// Token Implementation
-//===----------------------------------------------------------------------===//
-
-// FIXME: Move this elsewhere!
-#include "clang/Lex/Token.h"
-
-/// isObjCAtKeyword - Return true if we have an ObjC keyword identifier.
-bool Token::isObjCAtKeyword(tok::ObjCKeywordKind objcKey) const {
- return getKind() == tok::identifier &&
- getIdentifierInfo()->getObjCKeywordID() == objcKey;
-}
-
-/// getObjCKeywordID - Return the ObjC keyword kind.
-tok::ObjCKeywordKind Token::getObjCKeywordID() const {
- IdentifierInfo *specId = getIdentifierInfo();
- return specId ? specId->getObjCKeywordID() : tok::objc_not_keyword;
-}
-
-//===----------------------------------------------------------------------===//
// IdentifierInfo Implementation
//===----------------------------------------------------------------------===//
Modified: cfe/trunk/Lex/Lexer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Lex/Lexer.cpp?rev=42728&r1=42727&r2=42728&view=diff
==============================================================================
--- cfe/trunk/Lex/Lexer.cpp (original)
+++ cfe/trunk/Lex/Lexer.cpp Sun Oct 7 03:47:24 2007
@@ -35,6 +35,27 @@
static void InitCharacterInfo();
+//===----------------------------------------------------------------------===//
+// Token Class Implementation
+//===----------------------------------------------------------------------===//
+
+/// isObjCAtKeyword - Return true if we have an ObjC keyword identifier.
+bool Token::isObjCAtKeyword(tok::ObjCKeywordKind objcKey) const {
+ return getKind() == tok::identifier &&
+ getIdentifierInfo()->getObjCKeywordID() == objcKey;
+}
+
+/// getObjCKeywordID - Return the ObjC keyword kind.
+tok::ObjCKeywordKind Token::getObjCKeywordID() const {
+ IdentifierInfo *specId = getIdentifierInfo();
+ return specId ? specId->getObjCKeywordID() : tok::objc_not_keyword;
+}
+
+//===----------------------------------------------------------------------===//
+// Lexer Class Implementation
+//===----------------------------------------------------------------------===//
+
+
Lexer::Lexer(SourceLocation fileloc, Preprocessor &pp,
const char *BufStart, const char *BufEnd)
: FileLoc(fileloc), PP(pp), Features(PP.getLangOptions()) {
@@ -141,26 +162,26 @@
/// isIdentifierBody - Return true if this is the body character of an
/// identifier, which is [a-zA-Z0-9_].
static inline bool isIdentifierBody(unsigned char c) {
- return (CharInfo[c] & (CHAR_LETTER|CHAR_NUMBER|CHAR_UNDER)) ? true : false;
+ return CharInfo[c] & (CHAR_LETTER|CHAR_NUMBER|CHAR_UNDER);
}
/// isHorizontalWhitespace - Return true if this character is horizontal
/// whitespace: ' ', '\t', '\f', '\v'. Note that this returns false for '\0'.
static inline bool isHorizontalWhitespace(unsigned char c) {
- return (CharInfo[c] & CHAR_HORZ_WS) ? true : false;
+ return CharInfo[c] & CHAR_HORZ_WS;
}
/// isWhitespace - Return true if this character is horizontal or vertical
/// whitespace: ' ', '\t', '\f', '\v', '\n', '\r'. Note that this returns false
/// for '\0'.
static inline bool isWhitespace(unsigned char c) {
- return (CharInfo[c] & (CHAR_HORZ_WS|CHAR_VERT_WS)) ? true : false;
+ return CharInfo[c] & (CHAR_HORZ_WS|CHAR_VERT_WS);
}
/// isNumberBody - Return true if this is the body character of an
/// preprocessing number, which is [a-zA-Z0-9_.].
static inline bool isNumberBody(unsigned char c) {
- return (CharInfo[c] & (CHAR_LETTER|CHAR_NUMBER|CHAR_UNDER|CHAR_PERIOD)) ? true : false;
+ return CharInfo[c] & (CHAR_LETTER|CHAR_NUMBER|CHAR_UNDER|CHAR_PERIOD);
}
More information about the cfe-commits
mailing list