blob: f3d91af4ed11ef498368c01fdc282f9bcadd30ca [file] [log] [blame]
Ted Kremenek97017da2008-11-12 22:43:05 +00001//===--- 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.
11//
12//===----------------------------------------------------------------------===//
13
14#include "clang/Lex/PreprocessorLexer.h"
15#include "clang/Lex/Preprocessor.h"
16#include "clang/Basic/Diagnostic.h"
17#include "clang/Basic/SourceManager.h"
18
19using namespace clang;
20
Ted Kremenek957be412008-11-12 22:48:57 +000021PreprocessorLexer::~PreprocessorLexer() {}
22
Ted Kremenek97017da2008-11-12 22:43:05 +000023/// LexIncludeFilename - After the preprocessor has parsed a #include, lex and
24/// (potentially) macro expand the filename.
25void PreprocessorLexer::LexIncludeFilename(Token &FilenameTok) {
26 assert(ParsingPreprocessorDirective &&
27 ParsingFilename == false &&
28 "Must be in a preprocessing directive!");
29
30 // We are now parsing a filename!
31 ParsingFilename = true;
32
33 // Lex the filename.
34 IndirectLex(FilenameTok);
35
36 // We should have obtained the filename now.
37 ParsingFilename = false;
38
39 // No filename?
40 if (FilenameTok.is(tok::eom))
41 Diag(FilenameTok.getLocation(), diag::err_pp_expects_filename);
42}