@@ -193,16 +193,16 @@ std::string DependencyKey::computeNameForProvidedEntity<
193
193
// ==============================================================================
194
194
195
195
bool fine_grained_dependencies::withReferenceDependencies (
196
- llvm::PointerUnion<ModuleDecl *, SourceFile *> MSF,
196
+ llvm::PointerUnion<const ModuleDecl *, const SourceFile *> MSF,
197
197
const DependencyTracker &depTracker, StringRef outputPath,
198
198
bool alsoEmitDotFile,
199
199
llvm::function_ref<bool (SourceFileDepGraph &&)> cont) {
200
- if (auto *MD = MSF.dyn_cast <ModuleDecl *>()) {
200
+ if (auto *MD = MSF.dyn_cast <const ModuleDecl *>()) {
201
201
SourceFileDepGraph g =
202
202
ModuleDepGraphFactory (MD, alsoEmitDotFile).construct ();
203
203
return cont (std::move (g));
204
204
} else {
205
- auto *SF = MSF.get <SourceFile *>();
205
+ auto *SF = MSF.get <const SourceFile *>();
206
206
SourceFileDepGraph g = FrontendSourceFileDepGraphFactory (
207
207
SF, outputPath, depTracker, alsoEmitDotFile)
208
208
.construct ();
@@ -215,22 +215,22 @@ bool fine_grained_dependencies::withReferenceDependencies(
215
215
// ==============================================================================
216
216
217
217
FrontendSourceFileDepGraphFactory::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)
220
220
: 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),
224
223
SF(SF), depTracker(depTracker) {}
225
224
226
225
// / Centralize the invariant that the fingerprint of the whole file is the
227
226
// / interface hash
228
- std::string FrontendSourceFileDepGraphFactory::getFingerprint (SourceFile *SF) {
227
+ std::string
228
+ FrontendSourceFileDepGraphFactory::getFingerprint (const SourceFile *SF) {
229
229
return getInterfaceHash (SF);
230
230
}
231
231
232
232
std::string
233
- FrontendSourceFileDepGraphFactory::getInterfaceHash (SourceFile *SF) {
233
+ FrontendSourceFileDepGraphFactory::getInterfaceHash (const SourceFile *SF) {
234
234
llvm::SmallString<32 > interfaceHash;
235
235
SF->getInterfaceHash (interfaceHash);
236
236
return interfaceHash.str ().str ();
@@ -415,7 +415,7 @@ void FrontendSourceFileDepGraphFactory::addAllDefinedDecls() {
415
415
namespace {
416
416
// / Extracts uses out of a SourceFile
417
417
class UsedDeclEnumerator {
418
- SourceFile *SF;
418
+ const SourceFile *SF;
419
419
const DependencyTracker &depTracker;
420
420
StringRef swiftDeps;
421
421
@@ -427,16 +427,16 @@ class UsedDeclEnumerator {
427
427
428
428
public:
429
429
UsedDeclEnumerator (
430
- SourceFile *SF, const DependencyTracker &depTracker, StringRef swiftDeps,
430
+ const SourceFile *SF, const DependencyTracker &depTracker,
431
+ StringRef swiftDeps,
431
432
function_ref<void (const DependencyKey &, const DependencyKey &)>
432
433
createDefUse)
433
434
: SF(SF), depTracker(depTracker), swiftDeps(swiftDeps),
434
435
sourceFileInterface (DependencyKey::createKeyForWholeSourceFile(
435
436
DeclAspect::interface, swiftDeps)),
436
437
sourceFileImplementation(DependencyKey::createKeyForWholeSourceFile(
437
438
DeclAspect::implementation, swiftDeps)),
438
- createDefUse(createDefUse) {
439
- }
439
+ createDefUse(createDefUse) {}
440
440
441
441
public:
442
442
void enumerateAllUses () {
@@ -517,10 +517,11 @@ void FrontendSourceFileDepGraphFactory::addAllUsedDecls() {
517
517
// MARK: ModuleDepGraphFactory
518
518
// ==============================================================================
519
519
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),
524
525
Mod(Mod) {}
525
526
526
527
void ModuleDepGraphFactory::addAllDefinedDecls () {
0 commit comments