Coverage Report

Created: 2019-07-24 05:18

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/tools/clang/lib/Lex/PreprocessorLexer.cpp
Line
Count
Source (jump to first uncovered line)
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.
10
//
11
//===----------------------------------------------------------------------===//
12
13
#include "clang/Lex/PreprocessorLexer.h"
14
#include "clang/Basic/SourceManager.h"
15
#include "clang/Lex/LexDiagnostic.h"
16
#include "clang/Lex/Preprocessor.h"
17
#include "clang/Lex/Token.h"
18
#include <cassert>
19
20
using namespace clang;
21
22
0
void PreprocessorLexer::anchor() {}
23
24
PreprocessorLexer::PreprocessorLexer(Preprocessor *pp, FileID fid)
25
602k
    : PP(pp), FID(fid) {
26
602k
  if (pp)
27
602k
    InitialNumSLocEntries = pp->getSourceManager().local_sloc_entry_size();
28
602k
}
29
30
/// After the preprocessor has parsed a \#include, lex and
31
/// (potentially) macro expand the filename.
32
1.04M
void PreprocessorLexer::LexIncludeFilename(Token &FilenameTok) {
33
1.04M
  assert(ParsingFilename == false && "reentered LexIncludeFilename");
34
1.04M
35
1.04M
  // We are now parsing a filename!
36
1.04M
  ParsingFilename = true;
37
1.04M
38
1.04M
  // Lex the filename.
39
1.04M
  if (LexingRawMode)
40
0
    IndirectLex(FilenameTok);
41
1.04M
  else
42
1.04M
    PP->Lex(FilenameTok);
43
1.04M
44
1.04M
  // We should have obtained the filename now.
45
1.04M
  ParsingFilename = false;
46
1.04M
}
47
48
/// getFileEntry - Return the FileEntry corresponding to this FileID.  Like
49
/// getFileID(), this only works for lexers with attached preprocessors.
50
471k
const FileEntry *PreprocessorLexer::getFileEntry() const {
51
471k
  return PP->getSourceManager().getFileEntryForID(getFileID());
52
471k
}