[ELF] Avoid make in elf::writeARMCmseImportLib
[llvm-project.git] / clang / lib / Lex / PreprocessorLexer.cpp
blob3f483c56f8b12623e96b8fa81b331983155c6c74
1 //===- PreprocessorLexer.cpp - C Language Family Lexer --------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file implements the PreprocessorLexer and Token interfaces.
11 //===----------------------------------------------------------------------===//
13 #include "clang/Lex/PreprocessorLexer.h"
14 #include "clang/Basic/SourceManager.h"
15 #include "clang/Lex/Preprocessor.h"
16 #include "clang/Lex/Token.h"
17 #include <cassert>
19 using namespace clang;
21 void PreprocessorLexer::anchor() {}
23 PreprocessorLexer::PreprocessorLexer(Preprocessor *pp, FileID fid)
24 : PP(pp), FID(fid) {
25 if (pp)
26 InitialNumSLocEntries = pp->getSourceManager().local_sloc_entry_size();
29 /// After the preprocessor has parsed a \#include, lex and
30 /// (potentially) macro expand the filename.
31 void PreprocessorLexer::LexIncludeFilename(Token &FilenameTok) {
32 assert(ParsingFilename == false && "reentered LexIncludeFilename");
34 // We are now parsing a filename!
35 ParsingFilename = true;
37 // Lex the filename.
38 if (LexingRawMode)
39 IndirectLex(FilenameTok);
40 else
41 PP->Lex(FilenameTok);
43 // We should have obtained the filename now.
44 ParsingFilename = false;
47 /// getFileEntry - Return the FileEntry corresponding to this FileID. Like
48 /// getFileID(), this only works for lexers with attached preprocessors.
49 OptionalFileEntryRef PreprocessorLexer::getFileEntry() const {
50 return PP->getSourceManager().getFileEntryRefForID(getFileID());