Coverage Report

Created: 2023-05-31 04:38

/Users/buildslave/jenkins/workspace/coverage/llvm-project/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/FileManager.h"
19
#include "clang/Basic/IdentifierTable.h"
20
#include "clang/Basic/LLVM.h"
21
#include "clang/Basic/Module.h"
22
#include "clang/Basic/SourceManager.h"
23
#include "llvm/Support/ErrorHandling.h"
24
#include <cstdint>
25
#include <optional>
26
27
using namespace clang;
28
29
char ExternalASTSource::ID;
30
31
45.0k
ExternalASTSource::~ExternalASTSource() = default;
32
33
std::optional<ASTSourceDescriptor>
34
0
ExternalASTSource::getSourceDescriptor(unsigned ID) {
35
0
  return std::nullopt;
36
0
}
37
38
ExternalASTSource::ExtKind
39
2.56M
ExternalASTSource::hasExternalDefinitions(const Decl *D) {
40
2.56M
  return EK_ReplyHazy;
41
2.56M
}
42
43
void ExternalASTSource::FindFileRegionDecls(FileID File, unsigned Offset,
44
                                            unsigned Length,
45
0
                                            SmallVectorImpl<Decl *> &Decls) {}
46
47
1.95M
void ExternalASTSource::CompleteRedeclChain(const Decl *D) {}
48
49
39.8k
void ExternalASTSource::CompleteType(TagDecl *Tag) {}
50
51
0
void ExternalASTSource::CompleteType(ObjCInterfaceDecl *Class) {}
52
53
73
void ExternalASTSource::ReadComments() {}
54
55
138k
void ExternalASTSource::StartedDeserializing() {}
56
57
138k
void ExternalASTSource::FinishedDeserializing() {}
58
59
212
void ExternalASTSource::StartTranslationUnit(ASTConsumer *Consumer) {}
60
61
0
void ExternalASTSource::PrintStats() {}
62
63
bool ExternalASTSource::layoutRecordType(
64
    const RecordDecl *Record, uint64_t &Size, uint64_t &Alignment,
65
    llvm::DenseMap<const FieldDecl *, uint64_t> &FieldOffsets,
66
    llvm::DenseMap<const CXXRecordDecl *, CharUnits> &BaseOffsets,
67
36.3k
    llvm::DenseMap<const CXXRecordDecl *, CharUnits> &VirtualBaseOffsets) {
68
36.3k
  return false;
69
36.3k
}
70
71
33
Decl *ExternalASTSource::GetExternalDecl(uint32_t ID) {
72
33
  return nullptr;
73
33
}
74
75
0
Selector ExternalASTSource::GetExternalSelector(uint32_t ID) {
76
0
  return Selector();
77
0
}
78
79
0
uint32_t ExternalASTSource::GetNumExternalSelectors() {
80
0
   return 0;
81
0
}
82
83
28
Stmt *ExternalASTSource::GetExternalDeclStmt(uint64_t Offset) {
84
28
  return nullptr;
85
28
}
86
87
CXXCtorInitializer **
88
2
ExternalASTSource::GetExternalCXXCtorInitializers(uint64_t Offset) {
89
2
  return nullptr;
90
2
}
91
92
CXXBaseSpecifier *
93
13
ExternalASTSource::GetExternalCXXBaseSpecifiers(uint64_t Offset) {
94
13
  return nullptr;
95
13
}
96
97
bool
98
ExternalASTSource::FindExternalVisibleDeclsByName(const DeclContext *DC,
99
327
                                                  DeclarationName Name) {
100
327
  return false;
101
327
}
102
103
33
void ExternalASTSource::completeVisibleDeclsMap(const DeclContext *DC) {}
104
105
void ExternalASTSource::FindExternalLexicalDecls(
106
    const DeclContext *DC, llvm::function_ref<bool(Decl::Kind)> IsKindWeWant,
107
262
    SmallVectorImpl<Decl *> &Result) {}
108
109
0
void ExternalASTSource::getMemoryBufferSizes(MemoryBufferSizes &sizes) const {}
110
111
10.0k
uint32_t ExternalASTSource::incrementGeneration(ASTContext &C) {
112
10.0k
  uint32_t OldGeneration = CurrentGeneration;
113
114
  // Make sure the generation of the topmost external source for the context is
115
  // incremented. That might not be us.
116
10.0k
  auto *P = C.getExternalSource();
117
10.0k
  if (P && 
P != this10.0k
)
118
415
    CurrentGeneration = P->incrementGeneration(C);
119
9.66k
  else {
120
    // FIXME: Only bump the generation counter if the current generation number
121
    // has been observed?
122
9.66k
    if (!++CurrentGeneration)
123
0
      llvm::report_fatal_error("generation counter overflowed", false);
124
9.66k
  }
125
126
10.0k
  return OldGeneration;
127
10.0k
}