blob: cbda79fd8bcc4ebf3590fd3266edae9b710f8c0e [file] [log] [blame]
Ted Kremenekab91b702008-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
21/// LexIncludeFilename - After the preprocessor has parsed a #include, lex and
22/// (potentially) macro expand the filename.
23void PreprocessorLexer::LexIncludeFilename(Token &FilenameTok) {
24 assert(ParsingPreprocessorDirective &&
25 ParsingFilename == false &&
26 "Must be in a preprocessing directive!");
27
28 // We are now parsing a filename!
29 ParsingFilename = true;
30
31 // Lex the filename.
32 IndirectLex(FilenameTok);
33
34 // We should have obtained the filename now.
35 ParsingFilename = false;
36
37 // No filename?
38 if (FilenameTok.is(tok::eom))
39 Diag(FilenameTok.getLocation(), diag::err_pp_expects_filename);
40}