summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorAlp Toker <alp@nuanti.com>2014-05-17 04:53:25 +0000
committerAlp Toker <alp@nuanti.com>2014-05-17 04:53:25 +0000
commit9db67864c522312bf596a17cd260d8567af669d1 (patch)
treeda5a39a168d84b0f29ce929fe6254096d7a1b625 /tools
parent5027d6f10a9e7c2afa88ce6dc6560f8f4c4ff47c (diff)
downloadclang-9db67864c522312bf596a17cd260d8567af669d1.tar.gz
clang-9db67864c522312bf596a17cd260d8567af669d1.tar.bz2
clang-9db67864c522312bf596a17cd260d8567af669d1.tar.xz
Provide and use a safe Token::getRawIdentifier() accessor
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209061 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools')
-rw-r--r--tools/libclang/CIndex.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp
index 91205602c9..5710d66890 100644
--- a/tools/libclang/CIndex.cpp
+++ b/tools/libclang/CIndex.cpp
@@ -5694,14 +5694,13 @@ static void annotatePreprocessorTokens(CXTranslationUnit TU,
break;
MacroInfo *MI = 0;
- if (Tok.is(tok::raw_identifier) &&
- StringRef(Tok.getRawIdentifierData(), Tok.getLength()) == "define") {
+ if (Tok.is(tok::raw_identifier) && Tok.getRawIdentifier() == "define") {
if (lexNext(Lex, Tok, NextIdx, NumTokens))
break;
if (Tok.is(tok::raw_identifier)) {
- StringRef Name(Tok.getRawIdentifierData(), Tok.getLength());
- IdentifierInfo &II = PP.getIdentifierTable().get(Name);
+ IdentifierInfo &II =
+ PP.getIdentifierTable().get(Tok.getRawIdentifier());
SourceLocation MappedTokLoc =
CXXUnit->mapLocationToPreamble(Tok.getLocation());
MI = getMacroInfo(II, MappedTokLoc, TU);
@@ -6819,8 +6818,7 @@ MacroDefinition *cxindex::checkForMacroInMacroDefinition(const MacroInfo *MI,
if (!PPRec)
return 0;
- StringRef Name(Tok.getRawIdentifierData(), Tok.getLength());
- IdentifierInfo &II = PP.getIdentifierTable().get(Name);
+ IdentifierInfo &II = PP.getIdentifierTable().get(Tok.getRawIdentifier());
if (!II.hadMacroDefinition())
return 0;