]> granicus.if.org Git - clang/commitdiff
implement the Token class in the Lexer.cpp file instead of IdentifierInfo.cpp
authorChris Lattner <sabre@nondot.org>
Sun, 7 Oct 2007 08:47:24 +0000 (08:47 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 7 Oct 2007 08:47:24 +0000 (08:47 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42728 91177308-0d34-0410-b5e6-96231b3b80d8

Lex/IdentifierTable.cpp
Lex/Lexer.cpp

index f0baa155168cd0a4c00ae4a4833148f602d54ec2..c4c1ee358db4ff54cd6fcc2c02e1a57a0695d168 100644 (file)
 #include "llvm/ADT/DenseMap.h"
 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
 //===----------------------------------------------------------------------===//
index f8640b35562e2ddf8d79d6d6d54a48da8f24742f..0c67d2ab73518afcc14a2dab1de05e6a5278490a 100644 (file)
@@ -35,6 +35,27 @@ using namespace clang;
 
 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 @@ static void InitCharacterInfo() {
 /// 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);
 }