clang-tools 23.0.0git
ModularizeUtilities.cpp
Go to the documentation of this file.
1//===--- extra/modularize/ModularizeUtilities.cpp -------------------===//
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 a class for loading and validating a module map or
10// header list by checking that all headers in the corresponding directories
11// are accounted for.
12//
13//===----------------------------------------------------------------------===//
14
15#include "ModularizeUtilities.h"
16#include "CoverageChecker.h"
17#include "clang/Basic/SourceManager.h"
18#include "clang/Frontend/CompilerInstance.h"
19#include "clang/Frontend/FrontendActions.h"
20#include "clang/Options/Options.h"
21#include "llvm/ADT/SmallString.h"
22#include "llvm/Support/FileUtilities.h"
23#include "llvm/Support/MemoryBuffer.h"
24#include "llvm/Support/Path.h"
25#include "llvm/Support/raw_ostream.h"
26
27using namespace clang;
28using namespace llvm;
29using namespace Modularize;
30
31namespace {
32// Subclass TargetOptions so we can construct it inline with
33// the minimal option, the triple.
34class ModuleMapTargetOptions : public clang::TargetOptions {
35public:
36 ModuleMapTargetOptions() { Triple = llvm::sys::getDefaultTargetTriple(); }
37};
38} // namespace
39
40// ModularizeUtilities class implementation.
41
42// Constructor.
43ModularizeUtilities::ModularizeUtilities(std::vector<std::string> &InputPaths,
44 llvm::StringRef Prefix,
45 llvm::StringRef ProblemFilesListPath)
46 : InputFilePaths(InputPaths), HeaderPrefix(Prefix),
47 ProblemFilesPath(ProblemFilesListPath), HasModuleMap(false),
49 // Init clang stuff needed for loading the module map and preprocessing.
50 LangOpts(new LangOptions()), DiagIDs(DiagnosticIDs::create()),
51 DC(llvm::errs(), DiagnosticOpts),
52 Diagnostics(new DiagnosticsEngine(DiagIDs, DiagnosticOpts, &DC, false)),
53 TargetOpts(new ModuleMapTargetOptions()),
54 Target(TargetInfo::CreateTargetInfo(*Diagnostics, *TargetOpts)),
55 FileMgr(new FileManager(FileSystemOpts)),
56 SourceMgr(new SourceManager(*Diagnostics, *FileMgr, false)), HSOpts(),
57 HeaderInfo(new HeaderSearch(HSOpts, *SourceMgr, *Diagnostics, *LangOpts,
58 Target.get())) {}
59
60// Create instance of ModularizeUtilities, to simplify setting up
61// subordinate objects.
63 std::vector<std::string> &InputPaths, llvm::StringRef Prefix,
64 llvm::StringRef ProblemFilesListPath) {
65
66 return new ModularizeUtilities(InputPaths, Prefix, ProblemFilesListPath);
67}
68
69// Load all header lists and dependencies.
71 // For each input file.
72 for (llvm::StringRef InputPath : InputFilePaths) {
73 // If it's a module map.
74 if (InputPath.ends_with(".modulemap")) {
75 // Load the module map.
76 if (std::error_code EC = loadModuleMap(InputPath))
77 return EC;
78 } else {
79 // Else we assume it's a header list and load it.
80 if (std::error_code EC = loadSingleHeaderListsAndDependencies(InputPath)) {
81 errs() << "modularize: error: Unable to get header list '" << InputPath
82 << "': " << EC.message() << '\n';
83 return EC;
84 }
85 }
86 }
87 // If we have a problem files list.
88 if (ProblemFilesPath.size() != 0) {
89 // Load problem files list.
90 if (std::error_code EC = loadProblemHeaderList(ProblemFilesPath)) {
91 errs() << "modularize: error: Unable to get problem header list '" << ProblemFilesPath
92 << "': " << EC.message() << '\n';
93 return EC;
94 }
95 }
96 return std::error_code();
97}
98
99// Do coverage checks.
100// For each loaded module map, do header coverage check.
101// Starting from the directory of the module.modulemap file,
102// Find all header files, optionally looking only at files
103// covered by the include path options, and compare against
104// the headers referenced by the module.modulemap file.
105// Display warnings for unaccounted-for header files.
106// Returns 0 if there were no errors or warnings, 1 if there
107// were warnings, 2 if any other problem, such as a bad
108// module map path argument was specified.
110 std::vector<std::string> &IncludePaths,
111 llvm::ArrayRef<std::string> CommandLine) {
112 int ModuleMapCount = ModuleMaps.size();
113 int ModuleMapIndex;
114 std::error_code EC;
115 for (ModuleMapIndex = 0; ModuleMapIndex < ModuleMapCount; ++ModuleMapIndex) {
116 std::unique_ptr<clang::ModuleMap> &ModMap = ModuleMaps[ModuleMapIndex];
118 InputFilePaths[ModuleMapIndex], IncludePaths, CommandLine,
119 ModMap.get());
120 std::error_code LocalEC = Checker->doChecks();
121 if (LocalEC.value() > 0)
122 EC = LocalEC;
123 }
124 return EC;
125}
126
127// Load single header list and dependencies.
129 llvm::StringRef InputPath) {
130
131 // By default, use the path component of the list file name.
132 SmallString<256> HeaderDirectory(InputPath);
133 llvm::sys::path::remove_filename(HeaderDirectory);
134 SmallString<256> CurrentDirectory;
135 llvm::sys::fs::current_path(CurrentDirectory);
136
137 // Get the prefix if we have one.
138 if (HeaderPrefix.size() != 0)
139 HeaderDirectory = HeaderPrefix;
140
141 // Read the header list file into a buffer.
142 ErrorOr<std::unique_ptr<MemoryBuffer>> listBuffer =
143 MemoryBuffer::getFile(InputPath);
144 if (std::error_code EC = listBuffer.getError())
145 return EC;
146
147 // Parse the header list into strings.
148 SmallVector<StringRef, 32> Strings;
149 listBuffer.get()->getBuffer().split(Strings, "\n", -1, false);
150
151 // Collect the header file names from the string list.
152 for (SmallVectorImpl<StringRef>::iterator I = Strings.begin(),
153 E = Strings.end();
154 I != E; ++I) {
155 StringRef Line = I->trim();
156 // Ignore comments and empty lines.
157 if (Line.empty() || (Line[0] == '#'))
158 continue;
159 std::pair<StringRef, StringRef> TargetAndDependents = Line.split(':');
160 SmallString<256> HeaderFileName;
161 // Prepend header file name prefix if it's not absolute.
162 if (llvm::sys::path::is_absolute(TargetAndDependents.first))
163 llvm::sys::path::native(TargetAndDependents.first, HeaderFileName);
164 else {
165 if (HeaderDirectory.size() != 0)
166 HeaderFileName = HeaderDirectory;
167 else
168 HeaderFileName = CurrentDirectory;
169 llvm::sys::path::append(HeaderFileName, TargetAndDependents.first);
170 llvm::sys::path::native(HeaderFileName);
171 }
172 // Handle optional dependencies.
173 DependentsVector Dependents;
174 SmallVector<StringRef, 4> DependentsList;
175 TargetAndDependents.second.split(DependentsList, " ", -1, false);
176 int Count = DependentsList.size();
177 for (int Index = 0; Index < Count; ++Index) {
178 SmallString<256> Dependent;
179 if (llvm::sys::path::is_absolute(DependentsList[Index]))
180 Dependent = DependentsList[Index];
181 else {
182 if (HeaderDirectory.size() != 0)
183 Dependent = HeaderDirectory;
184 else
185 Dependent = CurrentDirectory;
186 llvm::sys::path::append(Dependent, DependentsList[Index]);
187 }
188 llvm::sys::path::native(Dependent);
189 Dependents.push_back(getCanonicalPath(Dependent.str()));
190 }
191 // Get canonical form.
192 HeaderFileName = getCanonicalPath(HeaderFileName);
193 // Save the resulting header file path and dependencies.
194 HeaderFileNames.push_back(std::string(HeaderFileName));
195 Dependencies[HeaderFileName.str()] = Dependents;
196 }
197 return std::error_code();
198}
199
200// Load problem header list.
202 llvm::StringRef InputPath) {
203
204 // By default, use the path component of the list file name.
205 SmallString<256> HeaderDirectory(InputPath);
206 llvm::sys::path::remove_filename(HeaderDirectory);
207 SmallString<256> CurrentDirectory;
208 llvm::sys::fs::current_path(CurrentDirectory);
209
210 // Get the prefix if we have one.
211 if (HeaderPrefix.size() != 0)
212 HeaderDirectory = HeaderPrefix;
213
214 // Read the header list file into a buffer.
215 ErrorOr<std::unique_ptr<MemoryBuffer>> listBuffer =
216 MemoryBuffer::getFile(InputPath);
217 if (std::error_code EC = listBuffer.getError())
218 return EC;
219
220 // Parse the header list into strings.
221 SmallVector<StringRef, 32> Strings;
222 listBuffer.get()->getBuffer().split(Strings, "\n", -1, false);
223
224 // Collect the header file names from the string list.
225 for (SmallVectorImpl<StringRef>::iterator I = Strings.begin(),
226 E = Strings.end();
227 I != E; ++I) {
228 StringRef Line = I->trim();
229 // Ignore comments and empty lines.
230 if (Line.empty() || (Line[0] == '#'))
231 continue;
232 SmallString<256> HeaderFileName;
233 // Prepend header file name prefix if it's not absolute.
234 if (llvm::sys::path::is_absolute(Line))
235 llvm::sys::path::native(Line, HeaderFileName);
236 else {
237 if (HeaderDirectory.size() != 0)
238 HeaderFileName = HeaderDirectory;
239 else
240 HeaderFileName = CurrentDirectory;
241 llvm::sys::path::append(HeaderFileName, Line);
242 llvm::sys::path::native(HeaderFileName);
243 }
244 // Get canonical form.
245 HeaderFileName = getCanonicalPath(HeaderFileName);
246 // Save the resulting header file path.
247 ProblemFileNames.push_back(std::string(HeaderFileName));
248 }
249 return std::error_code();
250}
251
252// Load single module map and extract header file list.
254 llvm::StringRef InputPath) {
255 // Get file entry for module.modulemap file.
256 auto ModuleMapEntryOrErr = SourceMgr->getFileManager().getFileRef(InputPath);
257
258 // return error if not found.
259 if (!ModuleMapEntryOrErr) {
260 llvm::errs() << "error: File \"" << InputPath << "\" not found.\n";
261 return errorToErrorCode(ModuleMapEntryOrErr.takeError());
262 }
263 FileEntryRef ModuleMapEntry = *ModuleMapEntryOrErr;
264
265 // Because the module map parser uses a ForwardingDiagnosticConsumer,
266 // which doesn't forward the BeginSourceFile call, we do it explicitly here.
267 DC.BeginSourceFile(*LangOpts, nullptr);
268
269 // Figure out the home directory for the module map file.
270 DirectoryEntryRef Dir = ModuleMapEntry.getDir();
271 StringRef DirName(Dir.getName());
272 if (llvm::sys::path::filename(DirName) == "Modules") {
273 DirName = llvm::sys::path::parent_path(DirName);
274 if (DirName.ends_with(".framework")) {
275 auto FrameworkDirOrErr = FileMgr->getDirectoryRef(DirName);
276 if (!FrameworkDirOrErr) {
277 // This can happen if there's a race between the above check and the
278 // removal of the directory.
279 return errorToErrorCode(FrameworkDirOrErr.takeError());
280 }
281 Dir = *FrameworkDirOrErr;
282 }
283 }
284
285 std::unique_ptr<ModuleMap> ModMap;
286 ModMap.reset(new ModuleMap(*SourceMgr, *Diagnostics, *LangOpts,
287 Target.get(), *HeaderInfo));
288
289 // Parse module.modulemap file into module map.
290 if (ModMap->parseAndLoadModuleMapFile(ModuleMapEntry, /*IsSystem=*/false,
291 /*ImplicitlyDiscovered=*/false, Dir)) {
292 return std::error_code(1, std::generic_category());
293 }
294
295 // Do matching end call.
296 DC.EndSourceFile();
297
298 // Reset missing header count.
300
301 if (!collectModuleMapHeaders(ModMap.get()))
302 return std::error_code(1, std::generic_category());
303
304 // Save module map.
305 ModuleMaps.push_back(std::move(ModMap));
306
307 // Indicate we are using module maps.
308 HasModuleMap = true;
309
310 // Return code of 1 for missing headers.
312 return std::error_code(1, std::generic_category());
313
314 return std::error_code();
315}
316
317// Collect module map headers.
318// Walks the modules and collects referenced headers into
319// HeaderFileNames.
320bool ModularizeUtilities::collectModuleMapHeaders(clang::ModuleMap *ModMap) {
321 SmallVector<std::pair<StringRef, const clang::Module *>, 0> Vec;
322 for (auto &M : ModMap->modules())
323 Vec.emplace_back(M.first(), M.second);
324 llvm::sort(Vec, llvm::less_first());
325 for (auto &I : Vec)
326 if (!collectModuleHeaders(*I.second))
327 return false;
328 return true;
329}
330
331// Collect referenced headers from one module.
332// Collects the headers referenced in the given module into
333// HeaderFileNames.
334bool ModularizeUtilities::collectModuleHeaders(const clang::Module &Mod) {
335
336 // Ignore explicit modules because they often have dependencies
337 // we can't know.
338 if (Mod.IsExplicit)
339 return true;
340
341 // Treat headers in umbrella directory as dependencies.
342 DependentsVector UmbrellaDependents;
343
344 // Recursively do submodules.
345 for (auto *Submodule : Mod.submodules())
346 collectModuleHeaders(*Submodule);
347
348 if (std::optional<clang::Module::Header> UmbrellaHeader =
349 Mod.getUmbrellaHeaderAsWritten()) {
350 std::string HeaderPath = getCanonicalPath(UmbrellaHeader->Entry.getName());
351 // Collect umbrella header.
352 HeaderFileNames.push_back(HeaderPath);
353
354 // FUTURE: When needed, umbrella header header collection goes here.
355 } else if (std::optional<clang::Module::DirectoryName> UmbrellaDir =
356 Mod.getUmbrellaDirAsWritten()) {
357 // If there normal headers, assume these are umbrellas and skip collection.
358 if (Mod.getHeaders(Module::HK_Normal).empty()) {
359 // Collect headers in umbrella directory.
360 if (!collectUmbrellaHeaders(UmbrellaDir->Entry.getName(),
361 UmbrellaDependents))
362 return false;
363 }
364 }
365
366 // We ignore HK_Private, HK_Textual, HK_PrivateTextual, and HK_Excluded,
367 // assuming they are marked as such either because of unsuitability for
368 // modules or because they are meant to be included by another header,
369 // and thus should be ignored by modularize.
370
371 for (const auto &Header : Mod.getHeaders(clang::Module::HK_Normal))
372 HeaderFileNames.push_back(getCanonicalPath(Header.Entry.getName()));
373
374 int MissingCountThisModule = Mod.MissingHeaders.size();
375
376 for (int Index = 0; Index < MissingCountThisModule; ++Index) {
377 std::string MissingFile = Mod.MissingHeaders[Index].FileName;
378 SourceLocation Loc = Mod.MissingHeaders[Index].FileNameLoc;
379 errs() << Loc.printToString(*SourceMgr)
380 << ": error : Header not found: " << MissingFile << "\n";
381 }
382
383 MissingHeaderCount += MissingCountThisModule;
384
385 return true;
386}
387
388// Collect headers from an umbrella directory.
389bool ModularizeUtilities::collectUmbrellaHeaders(StringRef UmbrellaDirName,
390 DependentsVector &Dependents) {
391 // Initialize directory name.
392 SmallString<256> Directory(UmbrellaDirName);
393 // Walk the directory.
394 std::error_code EC;
395 for (llvm::sys::fs::directory_iterator I(Directory.str(), EC), E; I != E;
396 I.increment(EC)) {
397 if (EC)
398 return false;
399 std::string File(I->path());
400 llvm::ErrorOr<llvm::sys::fs::basic_file_status> Status = I->status();
401 if (!Status)
402 return false;
403 llvm::sys::fs::file_type Type = Status->type();
404 // If the file is a directory, ignore the name and recurse.
405 if (Type == llvm::sys::fs::file_type::directory_file) {
406 if (!collectUmbrellaHeaders(File, Dependents))
407 return false;
408 continue;
409 }
410 // If the file does not have a common header extension, ignore it.
411 if (!isHeader(File))
412 continue;
413 // Save header name.
414 std::string HeaderPath = getCanonicalPath(File);
415 Dependents.push_back(HeaderPath);
416 }
417 return true;
418}
419
420// Replace .. embedded in path for purposes of having
421// a canonical path.
422static std::string replaceDotDot(StringRef Path) {
423 SmallString<128> Buffer;
424 llvm::sys::path::const_iterator B = llvm::sys::path::begin(Path),
425 E = llvm::sys::path::end(Path);
426 while (B != E) {
427 if (*B == "..")
428 llvm::sys::path::remove_filename(Buffer);
429 else if (*B != ".")
430 llvm::sys::path::append(Buffer, *B);
431 ++B;
432 }
433 if (Path.ends_with("/") || Path.ends_with("\\"))
434 Buffer.append(1, Path.back());
435 return Buffer.c_str();
436}
437
438// Convert header path to canonical form.
439// The canonical form is basically just use forward slashes, and remove "./".
440// \param FilePath The file path, relative to the module map directory.
441// \returns The file path in canonical form.
442std::string ModularizeUtilities::getCanonicalPath(StringRef FilePath) {
443 std::string Tmp(replaceDotDot(FilePath));
444 llvm::replace(Tmp, '\\', '/');
445 StringRef Tmp2(Tmp);
446 if (Tmp2.starts_with("./"))
447 Tmp = std::string(Tmp2.substr(2));
448 return Tmp;
449}
450
451// Check for header file extension.
452// If the file extension is .h, .inc, or missing, it's
453// assumed to be a header.
454// \param FileName The file name. Must not be a directory.
455// \returns true if it has a header extension or no extension.
456bool ModularizeUtilities::isHeader(StringRef FileName) {
457 StringRef Extension = llvm::sys::path::extension(FileName);
458 if (Extension.size() == 0)
459 return true;
460 if (Extension.equals_insensitive(".h"))
461 return true;
462 if (Extension.equals_insensitive(".inc"))
463 return true;
464 return false;
465}
466
467// Get directory path component from file path.
468// \returns the component of the given path, which will be
469// relative if the given path is relative, absolute if the
470// given path is absolute, or "." if the path has no leading
471// path component.
472std::string ModularizeUtilities::getDirectoryFromPath(StringRef Path) {
473 SmallString<256> Directory(Path);
474 sys::path::remove_filename(Directory);
475 if (Directory.size() == 0)
476 return ".";
477 return std::string(Directory);
478}
479
480// Add unique problem file.
481// Also standardizes the path.
483 FilePath = getCanonicalPath(FilePath);
484 // Don't add if already present.
485 for(auto &TestFilePath : ProblemFileNames) {
486 if (TestFilePath == FilePath)
487 return;
488 }
489 ProblemFileNames.push_back(FilePath);
490}
491
492// Add file with no compile errors.
493// Also standardizes the path.
495 FilePath = getCanonicalPath(FilePath);
496 GoodFileNames.push_back(FilePath);
497}
498
499// List problem files.
501 errs() << "\nThese are the files with possible errors:\n\n";
502 for (auto &ProblemFile : ProblemFileNames) {
503 errs() << ProblemFile << "\n";
504 }
505}
506
507// List files with no problems.
509 errs() << "\nThese are the files with no detected errors:\n\n";
510 for (auto &GoodFile : HeaderFileNames) {
511 bool Good = true;
512 for (auto &ProblemFile : ProblemFileNames) {
513 if (ProblemFile == GoodFile) {
514 Good = false;
515 break;
516 }
517 }
518 if (Good)
519 errs() << GoodFile << "\n";
520 }
521}
522
523// List files with problem files commented out.
525 errs() <<
526 "\nThese are the combined files, with problem files preceded by #:\n\n";
527 for (auto &File : HeaderFileNames) {
528 bool Good = true;
529 for (auto &ProblemFile : ProblemFileNames) {
530 if (ProblemFile == File) {
531 Good = false;
532 break;
533 }
534 }
535 errs() << (Good ? "" : "#") << File << "\n";
536 }
537}
static cl::opt< std::string > Directory(cl::Positional, cl::Required, cl::desc("<Search Root Directory>"))
Definitions for CoverageChecker.
static std::string replaceDotDot(StringRef Path)
ModularizeUtilities class definition.
static cl::list< std::string > IncludePaths("I", cl::desc("Include path for coverage check."), cl::value_desc("path"))
std::string CommandLine
llvm::SmallVector< std::string, 4 > DependentsVector
Definition Modularize.h:31
static std::unique_ptr< CoverageChecker > createCoverageChecker(llvm::StringRef ModuleMapPath, std::vector< std::string > &IncludePaths, llvm::ArrayRef< std::string > CommandLine, clang::ModuleMap *ModuleMap)
Create instance of CoverageChecker.
llvm::SmallVector< std::string, 32 > GoodFileNames
List of header files with no problems during the first pass, that is, no compile errors.
ModularizeUtilities(std::vector< std::string > &InputPaths, llvm::StringRef Prefix, llvm::StringRef ProblemFilesListPath)
Constructor.
static std::string getCanonicalPath(llvm::StringRef FilePath)
Convert header path to canonical form.
std::vector< std::string > InputFilePaths
The input file paths.
clang::HeaderSearchOptions HSOpts
Header search options.
std::error_code loadAllHeaderListsAndDependencies()
Load header list and dependencies.
bool collectModuleMapHeaders(clang::ModuleMap *ModMap)
Collect module Map headers.
void displayProblemFiles()
List problem files.
const llvm::IntrusiveRefCntPtr< clang::DiagnosticIDs > DiagIDs
Diagnostic IDs.
std::error_code loadModuleMap(llvm::StringRef InputPath)
Load single module map and extract header file list.
clang::TextDiagnosticPrinter DC
Diagnostic consumer.
std::shared_ptr< clang::TargetOptions > TargetOpts
Options controlling the target.
DependencyMap Dependencies
Map of top-level header file dependencies.
static ModularizeUtilities * createModularizeUtilities(std::vector< std::string > &InputPaths, llvm::StringRef Prefix, llvm::StringRef ProblemFilesListPath)
Create instance of ModularizeUtilities.
llvm::IntrusiveRefCntPtr< clang::SourceManager > SourceMgr
Source manager.
std::error_code loadProblemHeaderList(llvm::StringRef InputPath)
Load problem header list.
bool collectModuleHeaders(const clang::Module &Mod)
Collect referenced headers from one module.
llvm::SmallVector< std::string, 32 > ProblemFileNames
List of header files with problems.
std::unique_ptr< clang::HeaderSearch > HeaderInfo
Header search manager.
llvm::IntrusiveRefCntPtr< clang::TargetInfo > Target
Target information.
llvm::StringRef HeaderPrefix
The header prefix.
std::vector< std::unique_ptr< clang::ModuleMap > > ModuleMaps
void displayCombinedFiles()
List files with problem files commented out.
void addNoCompileErrorsFile(std::string FilePath)
Add file with no compile errors.
void displayGoodFiles()
List files with no problems.
std::shared_ptr< clang::LangOptions > LangOpts
Options controlling the language variant.
llvm::IntrusiveRefCntPtr< clang::FileManager > FileMgr
File system manager.
bool collectUmbrellaHeaders(llvm::StringRef UmbrellaDirName, DependentsVector &Dependents)
Collect headers from an umbrella directory.
llvm::IntrusiveRefCntPtr< clang::DiagnosticsEngine > Diagnostics
Diagnostic engine.
clang::DiagnosticOptions DiagnosticOpts
Options controlling the diagnostic engine.
int MissingHeaderCount
Missing header count.
static bool isHeader(llvm::StringRef FileName)
Check for header file extension.
llvm::StringRef ProblemFilesPath
The path of problem files list file.
std::error_code loadSingleHeaderListsAndDependencies(llvm::StringRef InputPath)
Load single header list and dependencies.
llvm::SmallVector< std::string, 32 > HeaderFileNames
List of top-level header files.
std::error_code doCoverageCheck(std::vector< std::string > &IncludePaths, llvm::ArrayRef< std::string > CommandLine)
Do coverage checks.
bool HasModuleMap
True if we have module maps.
clang::FileSystemOptions FileSystemOpts
Options controlling the file system manager.
void addUniqueProblemFile(std::string FilePath)
Add unique problem file.
static std::string getDirectoryFromPath(llvm::StringRef Path)
Get directory path component from file path.
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
Some operations such as code completion produce a set of candidates.
Definition Generators.h:150