@@ -193,16 +193,16 @@ std::string DependencyKey::computeNameForProvidedEntity<
193193// ==============================================================================
194194
195195bool fine_grained_dependencies::withReferenceDependencies (
196- llvm::PointerUnion<ModuleDecl *, SourceFile *> MSF,
196+ llvm::PointerUnion<const ModuleDecl *, const SourceFile *> MSF,
197197 const DependencyTracker &depTracker, StringRef outputPath,
198198 bool alsoEmitDotFile,
199199 llvm::function_ref<bool (SourceFileDepGraph &&)> cont) {
200- if (auto *MD = MSF.dyn_cast <ModuleDecl *>()) {
200+ if (auto *MD = MSF.dyn_cast <const ModuleDecl *>()) {
201201 SourceFileDepGraph g =
202202 ModuleDepGraphFactory (MD, alsoEmitDotFile).construct ();
203203 return cont (std::move (g));
204204 } else {
205- auto *SF = MSF.get <SourceFile *>();
205+ auto *SF = MSF.get <const SourceFile *>();
206206 SourceFileDepGraph g = FrontendSourceFileDepGraphFactory (
207207 SF, outputPath, depTracker, alsoEmitDotFile)
208208 .construct ();
@@ -215,22 +215,22 @@ bool fine_grained_dependencies::withReferenceDependencies(
215215// ==============================================================================
216216
217217FrontendSourceFileDepGraphFactory::FrontendSourceFileDepGraphFactory (
218- SourceFile *SF, StringRef outputPath, const DependencyTracker &depTracker ,
219- const bool alsoEmitDotFile)
218+ const SourceFile *SF, StringRef outputPath,
219+ const DependencyTracker &depTracker, const bool alsoEmitDotFile)
220220 : AbstractSourceFileDepGraphFactory(
221- SF->getASTContext ().hadError(),
222- outputPath, getInterfaceHash(SF), alsoEmitDotFile,
223- SF->getASTContext().Diags),
221+ SF->getASTContext ().hadError(), outputPath, getInterfaceHash(SF),
222+ alsoEmitDotFile, SF->getASTContext().Diags),
224223 SF(SF), depTracker(depTracker) {}
225224
226225// / Centralize the invariant that the fingerprint of the whole file is the
227226// / interface hash
228- std::string FrontendSourceFileDepGraphFactory::getFingerprint (SourceFile *SF) {
227+ std::string
228+ FrontendSourceFileDepGraphFactory::getFingerprint (const SourceFile *SF) {
229229 return getInterfaceHash (SF);
230230}
231231
232232std::string
233- FrontendSourceFileDepGraphFactory::getInterfaceHash (SourceFile *SF) {
233+ FrontendSourceFileDepGraphFactory::getInterfaceHash (const SourceFile *SF) {
234234 llvm::SmallString<32 > interfaceHash;
235235 SF->getInterfaceHash (interfaceHash);
236236 return interfaceHash.str ().str ();
@@ -415,7 +415,7 @@ void FrontendSourceFileDepGraphFactory::addAllDefinedDecls() {
415415namespace {
416416// / Extracts uses out of a SourceFile
417417class UsedDeclEnumerator {
418- SourceFile *SF;
418+ const SourceFile *SF;
419419 const DependencyTracker &depTracker;
420420 StringRef swiftDeps;
421421
@@ -427,16 +427,16 @@ class UsedDeclEnumerator {
427427
428428public:
429429 UsedDeclEnumerator (
430- SourceFile *SF, const DependencyTracker &depTracker, StringRef swiftDeps,
430+ const SourceFile *SF, const DependencyTracker &depTracker,
431+ StringRef swiftDeps,
431432 function_ref<void (const DependencyKey &, const DependencyKey &)>
432433 createDefUse)
433434 : SF(SF), depTracker(depTracker), swiftDeps(swiftDeps),
434435 sourceFileInterface (DependencyKey::createKeyForWholeSourceFile(
435436 DeclAspect::interface, swiftDeps)),
436437 sourceFileImplementation(DependencyKey::createKeyForWholeSourceFile(
437438 DeclAspect::implementation, swiftDeps)),
438- createDefUse(createDefUse) {
439- }
439+ createDefUse(createDefUse) {}
440440
441441public:
442442 void enumerateAllUses () {
@@ -517,10 +517,11 @@ void FrontendSourceFileDepGraphFactory::addAllUsedDecls() {
517517// MARK: ModuleDepGraphFactory
518518// ==============================================================================
519519
520- ModuleDepGraphFactory::ModuleDepGraphFactory (ModuleDecl *Mod, bool emitDot)
521- : AbstractSourceFileDepGraphFactory(
522- Mod->getASTContext ().hadError(),
523- Mod->getNameStr(), "0xBADBEEF", emitDot, Mod->getASTContext().Diags),
520+ ModuleDepGraphFactory::ModuleDepGraphFactory (const ModuleDecl *Mod,
521+ bool emitDot)
522+ : AbstractSourceFileDepGraphFactory(Mod->getASTContext ().hadError(),
523+ Mod->getNameStr(), "0xBADBEEF", emitDot,
524+ Mod->getASTContext().Diags),
524525 Mod(Mod) {}
525526
526527void ModuleDepGraphFactory::addAllDefinedDecls () {
0 commit comments