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

1

2

3

4

5

6

7

8

9

10

11

12

13#ifndef LLVM_CLANG_INSTALLAPI_HEADERFILE_H

14#define LLVM_CLANG_INSTALLAPI_HEADERFILE_H

15

19#include "llvm/ADT/StringRef.h"

20#include "llvm/Support/ErrorHandling.h"

21#include "llvm/Support/Regex.h"

22#include

23#include

24

37

39 switch (T) {

41 return "Public";

43 return "Private";

45 return "Project";

47 return "Unknown";

48 }

49 llvm_unreachable("unexpected header type");

50}

51

53

54 std::string FullPath;

55

57

58 std::string IncludeName;

59

60 std::optionalclang::Language Language;

61

62 bool Excluded{false};

63

64 bool Extra{false};

65

66 bool Umbrella{false};

67

68public:

71 StringRef IncludeName = StringRef(),

72 std::optionalclang::Language Language = std::nullopt)

73 : FullPath(FullPath), Type(Type), IncludeName(IncludeName),

74 Language(Language) {}

75

77

80 StringRef getPath() const { return FullPath; }

81

85 bool isExtra() const { return Extra; }

88

92

94 return std::tie(Type, FullPath, IncludeName, Language, Excluded, Extra,

95 Umbrella) == std::tie(Other.Type, Other.FullPath,

99 }

100

102

103

104

105

106

108 return std::tie(Type, Umbrella) < std::tie(Other.Type, Other.Umbrella);

109

110 return std::tie(Type, Umbrella, Extra, FullPath) <

112 }

113};

114

115

117private:

118 std::string GlobString;

119 llvm::Regex Rule;

121 bool FoundMatch{false};

122

123public:

125

126

129

130

132

133

134

136

137

138 StringRef str() { return GlobString; }

139};

140

141

142

143

144

145

146

147

148

151

152

153

154

155

157

158

159

160

161

163 StringRef Directory);

164

165}

166

167#endif

Defines the clang::FileManager interface and associated types.

Implements support for file system lookup, file system caching, and directory search management.

The DirectoryScanner for collecting library files on the file system.

llvm::Expected< PathSeq > enumerateFiles(clang::FileManager &FM, StringRef Directory)

Given input directory, collect all header files.

HeaderType

Definition HeaderFile.h:26

@ Public

Represents declarations accessible to all clients.

Definition HeaderFile.h:28

@ Private

Represents declarations accessible to a disclosed set of clients.

Definition HeaderFile.h:30

@ Unknown

Unset or unknown type.

Definition HeaderFile.h:35

@ Project

Represents declarations only accessible as implementation details to the input library.

Definition HeaderFile.h:33

std::optional< std::string > createIncludeHeaderName(const StringRef FullPath)

Assemble expected way header will be included by clients.

StringRef getName(const HeaderType T)

Definition HeaderFile.h:38

bool isHeaderFile(StringRef Path)

Determine if Path is a header file.

std::vector< HeaderFile > HeaderSeq

Definition HeaderFile.h:150

const FunctionProtoType * T

@ Other

Other implicit parameter.