rename test
[clang.git] / lib / Lex / PreprocessorLexer.cpp
blobe005c494763cb60fbe0a3adc160129a25a3d8542
1 //===--- PreprocessorLexer.cpp - C Language Family Lexer ------------------===//
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 implements the PreprocessorLexer and Token interfaces.
12 //===----------------------------------------------------------------------===//
14 #include "clang/Lex/PreprocessorLexer.h"
15 #include "clang/Lex/Preprocessor.h"
16 #include "clang/Lex/LexDiagnostic.h"
17 #include "clang/Basic/SourceManager.h"
18 using namespace clang;
20 /// LexIncludeFilename - After the preprocessor has parsed a #include, lex and
21 /// (potentially) macro expand the filename.
22 void PreprocessorLexer::LexIncludeFilename(Token &FilenameTok) {
23 assert(ParsingPreprocessorDirective &&
24 ParsingFilename == false &&
25 "Must be in a preprocessing directive!");
27 // We are now parsing a filename!
28 ParsingFilename = true;
30 // Lex the filename.
31 IndirectLex(FilenameTok);
33 // We should have obtained the filename now.
34 ParsingFilename = false;
36 // No filename?
37 if (FilenameTok.is(tok::eom))
38 PP->Diag(FilenameTok.getLocation(), diag::err_pp_expects_filename);
41 /// getFileEntry - Return the FileEntry corresponding to this FileID. Like
42 /// getFileID(), this only works for lexers with attached preprocessors.
43 const FileEntry *PreprocessorLexer::getFileEntry() const {
44 return PP->getSourceManager().getFileEntryForID(getFileID());