[PATCH] D102482: [clang][deps] NFC: Report modules' context hash
Jan Svoboda via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon May 17 00:24:41 PDT 2021
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGd3fb4b9065e9: [clang][deps] NFC: Report modules' context hash (authored by jansvoboda11).
Changed prior to commit:
https://reviews.llvm.org/D102482?vs=345402&id=345769#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D102482/new/
https://reviews.llvm.org/D102482
Files:
clang/include/clang/Tooling/DependencyScanning/ModuleDepCollector.h
clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp
Index: clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp
===================================================================
--- clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp
+++ clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp
@@ -19,9 +19,10 @@
using namespace dependencies;
static CompilerInvocation
-makeInvocationForModuleBuildWithoutPaths(const ModuleDeps &Deps) {
+makeInvocationForModuleBuildWithoutPaths(const ModuleDeps &Deps,
+ const CompilerInvocation &Invocation) {
// Make a deep copy of the invocation.
- CompilerInvocation CI(*Deps.Invocation);
+ CompilerInvocation CI(Invocation);
// Remove options incompatible with explicit module build.
CI.getFrontendOpts().Inputs.clear();
@@ -38,7 +39,7 @@
}
static std::vector<std::string>
-serializeCompilerInvocation(CompilerInvocation &CI) {
+serializeCompilerInvocation(const CompilerInvocation &CI) {
// Set up string allocator.
llvm::BumpPtrAllocator Alloc;
llvm::StringSaver Strings(Alloc);
@@ -55,7 +56,7 @@
std::vector<std::string> ModuleDeps::getCanonicalCommandLine(
std::function<StringRef(ModuleID)> LookupPCMPath,
std::function<const ModuleDeps &(ModuleID)> LookupModuleDeps) const {
- CompilerInvocation CI(makeInvocationForModuleBuildWithoutPaths(*this));
+ CompilerInvocation CI(Invocation);
dependencies::detail::collectPCMAndModuleMapPaths(
ClangModuleDeps, LookupPCMPath, LookupModuleDeps,
@@ -66,9 +67,7 @@
std::vector<std::string>
ModuleDeps::getCanonicalCommandLineWithoutModulePaths() const {
- CompilerInvocation CI(makeInvocationForModuleBuildWithoutPaths(*this));
-
- return serializeCompilerInvocation(CI);
+ return serializeCompilerInvocation(Invocation);
}
void dependencies::detail::collectPCMAndModuleMapPaths(
@@ -190,11 +189,9 @@
MD.FileDeps.insert(IF.getFile()->getName());
});
- // FIXME: Prepare the CompilerInvocation for building this module **now**, so
- // that we store the actual context hash for this module (not just the
- // context hash inherited from the original TU).
- MD.Invocation = Instance.getInvocationPtr();
- MD.ID.ContextHash = MD.Invocation->getModuleHash();
+ MD.Invocation =
+ makeInvocationForModuleBuildWithoutPaths(MD, Instance.getInvocation());
+ MD.ID.ContextHash = MD.Invocation.getModuleHash();
llvm::DenseSet<const Module *> AddedModules;
addAllSubmoduleDeps(M, MD, AddedModules);
Index: clang/include/clang/Tooling/DependencyScanning/ModuleDepCollector.h
===================================================================
--- clang/include/clang/Tooling/DependencyScanning/ModuleDepCollector.h
+++ clang/include/clang/Tooling/DependencyScanning/ModuleDepCollector.h
@@ -75,9 +75,8 @@
// the primary TU.
bool ImportedByMainFile = false;
- /// The compiler invocation associated with the translation unit that imports
- /// this module.
- std::shared_ptr<CompilerInvocation> Invocation;
+ /// Compiler invocation that can be used to build this module (without paths).
+ CompilerInvocation Invocation;
/// Gets the canonical command line suitable for passing to clang.
///
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D102482.345769.patch
Type: text/x-patch
Size: 3211 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210517/9e73d0a6/attachment-0001.bin>
More information about the cfe-commits
mailing list