diff options
author | Abramo Bagnara <abramo.bagnara@gmail.com> | 2010-12-22 08:23:18 +0000 |
---|---|---|
committer | Abramo Bagnara <abramo.bagnara@gmail.com> | 2010-12-22 08:23:18 +0000 |
commit | ea4f7c776194c96f8ece1456bc22102c6cbc9a33 (patch) | |
tree | d1053edb8868105b02ca8fdf61a21462e03a8501 /clang/lib/Rewrite/HTMLRewrite.cpp | |
parent | fe86bc527a0d50b653d2df8fa8b091a5397d3a9d (diff) | |
download | bcm5719-llvm-ea4f7c776194c96f8ece1456bc22102c6cbc9a33.tar.gz bcm5719-llvm-ea4f7c776194c96f8ece1456bc22102c6cbc9a33.zip |
Introduced raw_identifier token kind.
llvm-svn: 122394
Diffstat (limited to 'clang/lib/Rewrite/HTMLRewrite.cpp')
-rw-r--r-- | clang/lib/Rewrite/HTMLRewrite.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/clang/lib/Rewrite/HTMLRewrite.cpp b/clang/lib/Rewrite/HTMLRewrite.cpp index e6b9aa367ad..df08cd7cbf3 100644 --- a/clang/lib/Rewrite/HTMLRewrite.cpp +++ b/clang/lib/Rewrite/HTMLRewrite.cpp @@ -20,6 +20,7 @@ #include "clang/Basic/SourceManager.h" #include "llvm/ADT/SmallString.h" #include "llvm/ADT/OwningPtr.h" +#include "llvm/Support/ErrorHandling.h" #include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/raw_ostream.h" using namespace clang; @@ -378,14 +379,16 @@ void html::SyntaxHighlight(Rewriter &R, FileID FID, const Preprocessor &PP) { unsigned TokLen = Tok.getLength(); switch (Tok.getKind()) { default: break; - case tok::identifier: { - // Fill in Result.IdentifierInfo, looking up the identifier in the - // identifier table. - const IdentifierInfo *II = - PP.LookUpIdentifierInfo(Tok, BufferStart+TokOffs); + case tok::identifier: + llvm_unreachable("tok::identifier in raw lexing mode!"); + break; + case tok::raw_identifier: { + // Fill in Result.IdentifierInfo and update the token kind, + // looking up the identifier in the identifier table. + PP.LookUpIdentifierInfo(Tok); // If this is a pp-identifier, for a keyword, highlight it as such. - if (II->getTokenID() != tok::identifier) + if (Tok.isNot(tok::identifier)) HighlightRange(RB, TokOffs, TokOffs+TokLen, BufferStart, "<span class='keyword'>", "</span>"); break; @@ -473,11 +476,8 @@ void html::HighlightMacros(Rewriter &R, FileID FID, const Preprocessor& PP) { // If this raw token is an identifier, the raw lexer won't have looked up // the corresponding identifier info for it. Do this now so that it will be // macro expanded when we re-preprocess it. - if (Tok.is(tok::identifier)) { - // Change the kind of this identifier to the appropriate token kind, e.g. - // turning "for" into a keyword. - Tok.setKind(PP.LookUpIdentifierInfo(Tok)->getTokenID()); - } + if (Tok.is(tok::raw_identifier)) + PP.LookUpIdentifierInfo(Tok); TokenStream.push_back(Tok); |