Coverage Report

Created: 2019-07-24 05:18

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/tools/clang/lib/AST/ExternalASTSource.cpp
Line
Count
Source (jump to first uncovered line)
1
//===- ExternalASTSource.cpp - Abstract External AST Interface ------------===//
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 provides the default implementation of the ExternalASTSource
10
//  interface, which enables construction of AST nodes from some external
11
//  source.
12
//
13
//===----------------------------------------------------------------------===//
14
15
#include "clang/AST/ExternalASTSource.h"
16
#include "clang/AST/ASTContext.h"
17
#include "clang/AST/DeclarationName.h"
18
#include "clang/Basic/IdentifierTable.h"
19
#include "clang/Basic/LLVM.h"
20
#include "clang/Basic/Module.h"
21
#include "llvm/ADT/None.h"
22
#include "llvm/Support/ErrorHandling.h"
23
#include <cstdint>
24
25
using namespace clang;
26
27
7.48k
ExternalASTSource::~ExternalASTSource() = default;
28
29
llvm::Optional<ExternalASTSource::ASTSourceDescriptor>
30
0
ExternalASTSource::getSourceDescriptor(unsigned ID) {
31
0
  return None;
32
0
}
33
34
ExternalASTSource::ExtKind
35
701
ExternalASTSource::hasExternalDefinitions(const Decl *D) {
36
701
  return EK_ReplyHazy;
37
701
}
38
39
ExternalASTSource::ASTSourceDescriptor::ASTSourceDescriptor(const Module &M)
40
234
  : Signature(M.Signature), ClangModule(&M) {
41
234
  if (M.Directory)
42
233
    Path = M.Directory->getName();
43
234
  if (auto *File = M.getASTFile())
44
92
    ASTFile = File->getName();
45
234
}
46
47
75
std::string ExternalASTSource::ASTSourceDescriptor::getModuleName() const {
48
75
  if (ClangModule)
49
46
    return ClangModule->Name;
50
29
  else
51
29
    return PCHModuleName;
52
75
}
53
54
void ExternalASTSource::FindFileRegionDecls(FileID File, unsigned Offset,
55
                                            unsigned Length,
56
0
                                            SmallVectorImpl<Decl *> &Decls) {}
57
58
0
void ExternalASTSource::CompleteRedeclChain(const Decl *D) {}
59
60
0
void ExternalASTSource::CompleteType(TagDecl *Tag) {}
61
62
0
void ExternalASTSource::CompleteType(ObjCInterfaceDecl *Class) {}
63
64
28
void ExternalASTSource::ReadComments() {}
65
66
210
void ExternalASTSource::StartedDeserializing() {}
67
68
210
void ExternalASTSource::FinishedDeserializing() {}
69
70
85
void ExternalASTSource::StartTranslationUnit(ASTConsumer *Consumer) {}
71
72
0
void ExternalASTSource::PrintStats() {}
73
74
bool ExternalASTSource::layoutRecordType(
75
    const RecordDecl *Record, uint64_t &Size, uint64_t &Alignment,
76
    llvm::DenseMap<const FieldDecl *, uint64_t> &FieldOffsets,
77
    llvm::DenseMap<const CXXRecordDecl *, CharUnits> &BaseOffsets,
78
7.00k
    llvm::DenseMap<const CXXRecordDecl *, CharUnits> &VirtualBaseOffsets) {
79
7.00k
  return false;
80
7.00k
}
81
82
33
Decl *ExternalASTSource::GetExternalDecl(uint32_t ID) {
83
33
  return nullptr;
84
33
}
85
86
0
Selector ExternalASTSource::GetExternalSelector(uint32_t ID) {
87
0
  return Selector();
88
0
}
89
90
0
uint32_t ExternalASTSource::GetNumExternalSelectors() {
91
0
   return 0;
92
0
}
93
94
14
Stmt *ExternalASTSource::GetExternalDeclStmt(uint64_t Offset) {
95
14
  return nullptr;
96
14
}
97
98
CXXCtorInitializer **
99
2
ExternalASTSource::GetExternalCXXCtorInitializers(uint64_t Offset) {
100
2
  return nullptr;
101
2
}
102
103
CXXBaseSpecifier *
104
13
ExternalASTSource::GetExternalCXXBaseSpecifiers(uint64_t Offset) {
105
13
  return nullptr;
106
13
}
107
108
bool
109
ExternalASTSource::FindExternalVisibleDeclsByName(const DeclContext *DC,
110
265
                                                  DeclarationName Name) {
111
265
  return false;
112
265
}
113
114
1
void ExternalASTSource::completeVisibleDeclsMap(const DeclContext *DC) {}
115
116
void ExternalASTSource::FindExternalLexicalDecls(
117
    const DeclContext *DC, llvm::function_ref<bool(Decl::Kind)> IsKindWeWant,
118
85
    SmallVectorImpl<Decl *> &Result) {}
119
120
0
void ExternalASTSource::getMemoryBufferSizes(MemoryBufferSizes &sizes) const {}
121
122
5.89k
uint32_t ExternalASTSource::incrementGeneration(ASTContext &C) {
123
5.89k
  uint32_t OldGeneration = CurrentGeneration;
124
5.89k
125
5.89k
  // Make sure the generation of the topmost external source for the context is
126
5.89k
  // incremented. That might not be us.
127
5.89k
  auto *P = C.getExternalSource();
128
5.89k
  if (P && 
P != this5.83k
)
129
2
    CurrentGeneration = P->incrementGeneration(C);
130
5.89k
  else {
131
5.89k
    // FIXME: Only bump the generation counter if the current generation number
132
5.89k
    // has been observed?
133
5.89k
    if (!++CurrentGeneration)
134
0
      llvm::report_fatal_error("generation counter overflowed", false);
135
5.89k
  }
136
5.89k
137
5.89k
  return OldGeneration;
138
5.89k
}