PTHLexer.h revision 274b20863a728cc6a31ee75c670e3733600c1531
1//===--- PTHLexer.h - Lexer based on Pre-tokenized input --------*- C++ -*-===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// 9// 10// This file defines the PTHLexer interface. 11// 12//===----------------------------------------------------------------------===// 13 14#ifndef LLVM_CLANG_PTHLexer_H 15#define LLVM_CLANG_PTHLexer_H 16 17#include "clang/Lex/PreprocessorLexer.h" 18 19namespace clang { 20 21class PTHLexer : public PreprocessorLexer { 22 23 /// PP - Preprocessor. 24 Preprocessor& PP; 25 26 /// FileLoc - Location for the start of the file. 27 /// 28 SourceLocation FileLoc; 29 30 /// Tokens - This is the pointer to an array of tokens that the macro is 31 /// defined to, with arguments expanded for function-like macros. If this is 32 /// a token stream, these are the tokens we are returning. 33 const Token *Tokens; 34 35 /// NumTokens - This is the length of the Tokens array. 36 /// 37 unsigned NumTokens; 38 39 /// CurToken - This is the next token that Lex will return. 40 /// 41 unsigned CurToken; 42 43 PTHLexer(const PTHLexer&); // DO NOT IMPLEMENT 44 void operator=(const PTHLexer&); // DO NOT IMPLEMENT 45 46public: 47 48 /// Create a PTHLexer for the specified token stream. 49 PTHLexer(Preprocessor& pp, SourceLocation fileloc, 50 const Token *TokArray, unsigned NumToks); 51 ~PTHLexer() {} 52 53 /// Lex - Return the next token. 54 void Lex(Token &Tok); 55 56 void setEOF(Token &Tok); 57 58 /// getFileLoc - Return the File Location for the file we are lexing out of. 59 /// The physical location encodes the location where the characters come from, 60 /// the virtual location encodes where we should *claim* the characters came 61 /// from. Currently this is only used by _Pragma handling. 62 SourceLocation getFileLoc() const { return FileLoc; } 63}; 64 65} // end namespace clang 66 67#endif 68