clang: include/clang/InstallAPI/DylibVerifier.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9#ifndef LLVM_CLANG_INSTALLAPI_DYLIBVERIFIER_H

10#define LLVM_CLANG_INSTALLAPI_DYLIBVERIFIER_H

11

15

17namespace installapi {

18struct FrontendAttrs;

19

20

26};

27

28using LibAttrs = llvm::StringMap;

30

31

32

33

38};

40

41

42

43

44

46private:

49

50public:

53

55

56

58

59

61

62

64

65

67

68

70

71

73

76 };

77

79

83 StringRef DSYMPath)

84 : Dylib(std::move(Dylib)), Reexports(std::move(Reexports)),

85 Aliases(std::move(Aliases)), Mode(Mode), Zippered(Zippered),

86 Demangle(Demangle), DSYMPath(DSYMPath),

88

92 const StringRef SuperClass);

93

94

96

97

98

101 const LibAttrs &ProvidedReexports,

102 const LibAttrs &ProvidedClients,

104

105

107

108

109 std::unique_ptr takeExports();

110

111

113

114

116

117private:

118

119 bool canVerify();

120

121

122 Result verifyImpl(Record *R, SymbolContext &SymCtx);

123

124

125

126 bool shouldIgnoreObsolete(const Record *R, SymbolContext &SymCtx,

128

129

130

131 bool shouldIgnoreReexport(const Record *R, SymbolContext &SymCtx) const;

132

133

134 bool shouldIgnoreZipperedAvailability(const Record *R, SymbolContext &SymCtx);

135

136

137

138

139 bool shouldIgnoreInternalZipperedSymbol(const Record *R,

140 const SymbolContext &SymCtx) const;

141

142

143

144 Result compareVisibility(const Record *R, SymbolContext &SymCtx,

146

147

148

149 bool compareObjCInterfaceSymbols(const Record *R, SymbolContext &SymCtx,

151

152

153 Result compareAvailability(const Record *R, SymbolContext &SymCtx,

155

156

157 bool compareSymbolFlags(const Record *R, SymbolContext &SymCtx,

159

160

161 void updateState(Result State);

162

163

164 void addSymbol(const Record *R, SymbolContext &SymCtx,

166

167

168 void assignSlice(const Target &T);

169

170

171 void visitSymbolInDylib(const Record &R, SymbolContext &SymCtx);

172

173 void visitGlobal(const GlobalRecord &R) override;

176 void visitObjCIVar(const ObjCIVarRecord &R, const StringRef Super);

177

178

179 std::string getAnnotatedName(const Record *R, SymbolContext &SymCtx,

180 bool ValidSourceLoc = true);

181

182

183

184

185

186 void accumulateSrcLocForDylibSymbols();

187

188

189 llvm::MachO::Records Dylib;

190

191

193

194

196

197

199

200

201 bool Zippered = false;

202

203

204 bool Demangle = false;

205

206

207 StringRef DSYMPath;

208

209

210 std::unique_ptr Exports = std::make_unique();

211

212

213

214 llvm::StringMap DeferredZipperedSymbols;

215

216

217 VerifierContext Ctx;

218

219

220 DWARFContext *DWARFCtx = nullptr;

221

222

224};

225

226}

227}

228#endif

Defines the Diagnostic-related interfaces.

static DiagnosticBuilder Diag(DiagnosticsEngine *Diags, const LangOptions &Features, FullSourceLoc TokLoc, const char *TokBegin, const char *TokRangeBegin, const char *TokRangeEnd, unsigned DiagID)

Produce a diagnostic highlighting some portion of a literal.

llvm::MachO::ObjCIVarRecord ObjCIVarRecord

llvm::MachO::RecordLoc RecordLoc

llvm::MachO::ObjCCategoryRecord ObjCCategoryRecord

llvm::MachO::GlobalRecord GlobalRecord

llvm::MachO::AliasMap AliasMap

llvm::MachO::RecordsSlice RecordsSlice

llvm::MachO::SymbolSet SymbolSet

llvm::MachO::ObjCInterfaceRecord ObjCInterfaceRecord

llvm::MachO::FileType FileType

llvm::MachO::Target Target

llvm::MachO::RecordsSlice::BinaryAttrs BinaryAttrs

llvm::MachO::Record Record

llvm::MachO::TargetList TargetList

Defines the SourceManager interface.

Concrete class used by the front-end to report problems and issues.

This class handles loading and caching of source files into memory.

Service responsible to tracking state of verification across the lifetime of InstallAPI.

Result verify(GlobalRecord *R, const FrontendAttrs *FA)

Result getState() const

Get result of verification.

void setSourceManager(IntrusiveRefCntPtr< SourceManager > SourceMgr)

Set different source managers to the same diagnostics engine.

std::unique_ptr< SymbolSet > takeExports()

Release ownership over exports.

bool verifyBinaryAttrs(const ArrayRef< Target > ProvidedTargets, const BinaryAttrs &ProvidedBA, const LibAttrs &ProvidedReexports, const LibAttrs &ProvidedClients, const LibAttrs &ProvidedRPaths, const FileType &FT)

Compare and report the attributes represented as load commands in the dylib to the attributes provide...

void setTarget(const Target &T)

Initialize target for verification.

DylibVerifier(llvm::MachO::Records &&Dylib, ReexportedInterfaces &&Reexports, AliasMap Aliases, DiagnosticsEngine *Diag, VerificationMode Mode, bool Zippered, bool Demangle, StringRef DSYMPath)

Result verifyRemainingSymbols()

llvm::StringMap< ArchitectureSet > LibAttrs

std::vector< ZipperedDeclSource > ZipperedDeclSources

VerificationMode

A list of InstallAPI verification modes.

llvm::SmallVector< llvm::MachO::InterfaceFile, 8 > ReexportedInterfaces

The JSON file list parser is used to communicate input to InstallAPI.

const FunctionProtoType * T

Metadata stored about a mapping of a declaration to a symbol.

bool DiscoveredFirstError

VerifierContext(DiagnosticsEngine *Diag)

VerifierContext()=default

void emitDiag(llvm::function_ref< void()> Report, RecordLoc *Loc=nullptr)

RecordsSlice * DylibSlice

llvm::MachO::Target Target

Frontend information captured about records.

clang::SourceManager * SrcMgr