aboutsummaryrefslogtreecommitdiff
path: root/tools/libclang/CIndex.cpp
diff options
context:
space:
mode:
authorAbramo Bagnara <abramo.bagnara@gmail.com>2010-12-22 08:23:18 +0000
committerAbramo Bagnara <abramo.bagnara@gmail.com>2010-12-22 08:23:18 +0000
commitc4bf2b9afb7d47445a9dc6bc848657098a4e3851 (patch)
tree3979630b01d84bf594a3ebf34ad12b2c1e2ea86b /tools/libclang/CIndex.cpp
parenteee1df1e7ac74bbccd5282f0348381af70cf5e5e (diff)
Introduced raw_identifier token kind.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122394 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/libclang/CIndex.cpp')
-rw-r--r--tools/libclang/CIndex.cpp19
1 files changed, 5 insertions, 14 deletions
diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp
index bd39925dad..61ff611a66 100644
--- a/tools/libclang/CIndex.cpp
+++ b/tools/libclang/CIndex.cpp
@@ -4010,27 +4010,18 @@ void clang_tokenize(CXTranslationUnit TU, CXSourceRange Range,
if (Tok.isLiteral()) {
CXTok.int_data[0] = CXToken_Literal;
CXTok.ptr_data = (void *)Tok.getLiteralData();
- } else if (Tok.is(tok::identifier)) {
+ } else if (Tok.is(tok::raw_identifier)) {
// Lookup the identifier to determine whether we have a keyword.
- std::pair<FileID, unsigned> LocInfo
- = SourceMgr.getDecomposedLoc(Tok.getLocation());
- bool Invalid = false;
- llvm::StringRef Buf
- = CXXUnit->getSourceManager().getBufferData(LocInfo.first, &Invalid);
- if (Invalid)
- return;
-
- const char *StartPos = Buf.data() + LocInfo.second;
IdentifierInfo *II
- = CXXUnit->getPreprocessor().LookUpIdentifierInfo(Tok, StartPos);
+ = CXXUnit->getPreprocessor().LookUpIdentifierInfo(Tok);
if ((II->getObjCKeywordID() != tok::objc_not_keyword) && previousWasAt) {
CXTok.int_data[0] = CXToken_Keyword;
}
else {
- CXTok.int_data[0] = II->getTokenID() == tok::identifier?
- CXToken_Identifier
- : CXToken_Keyword;
+ CXTok.int_data[0] = Tok.is(tok::identifier)
+ ? CXToken_Identifier
+ : CXToken_Keyword;
}
CXTok.ptr_data = II;
} else if (Tok.is(tok::comment)) {