clang 23.0.0git
DependencyGraph.cpp
Go to the documentation of this file.
1//===----------------------------------------------------------------------===//
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
10
12#include "llvm/ADT/SmallString.h"
13
14using namespace clang;
15using namespace clang::dependencies;
16
17void ModuleDeps::forEachFileDep(llvm::function_ref<void(StringRef)> Cb) const {
18 SmallString<0> PathBuf;
19 PathBuf.reserve(256);
20 for (StringRef FileDep : FileDeps) {
21 auto ResolvedFileDep =
22 ASTReader::ResolveImportedPath(PathBuf, FileDep, FileDepsBaseDir);
23 Cb(*ResolvedFileDep);
24 }
25}
26
27const std::vector<std::string> &ModuleDeps::getBuildArguments() const {
28 // FIXME: this operation is not thread safe and is expected to be called
29 // on a single thread. Otherwise, it should be protected with a lock.
30 assert(!std::holds_alternative<std::monostate>(BuildInfo) &&
31 "Using uninitialized ModuleDeps");
32 if (const auto *CI = std::get_if<CowCompilerInvocation>(&BuildInfo))
33 BuildInfo = CI->getCC1CommandLine();
34 return std::get<std::vector<std::string>>(BuildInfo);
35}
static TemporarilyOwnedStringRef ResolveImportedPath(SmallString< 0 > &Buf, StringRef Path, ModuleFile &ModF)
Resolve Path in the context of module file M.
The JSON file list parser is used to communicate input to InstallAPI.
void forEachFileDep(llvm::function_ref< void(StringRef)> Cb) const
Invokes Cb for all file dependencies of this module.
const std::vector< std::string > & getBuildArguments() const
Get (or compute) the compiler invocation that can be used to build this module.