Skip to content

Commit 6fa6b98

Browse files
author
David Ungar
committed
Fix string memory bug
1 parent ad71b8f commit 6fa6b98

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

lib/AST/FineGrainedDependencies.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,9 +180,9 @@ std::string DependencyKey::demangleTypeAsContext(StringRef s) {
180180
DependencyKey DependencyKey::createKeyForWholeSourceFile(DeclAspect aspect,
181181
StringRef swiftDeps) {
182182
assert(!swiftDeps.empty());
183-
const auto context = DependencyKey::computeContextForProvidedEntity<
183+
const std::string context = DependencyKey::computeContextForProvidedEntity<
184184
NodeKind::sourceFileProvide>(swiftDeps);
185-
const auto name =
185+
const std::string name =
186186
DependencyKey::computeNameForProvidedEntity<NodeKind::sourceFileProvide>(
187187
swiftDeps);
188188
return DependencyKey(NodeKind::sourceFileProvide, aspect, context, name);

lib/AST/SourceFileDepGraphConstructor.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -695,15 +695,15 @@ class UsedDeclEnumerator {
695695
enumerateMemberUses();
696696
}
697697

698-
llvm::StringSet<> computeHoldersOfCascadingMembers() {
699-
llvm::StringSet<> holdersOfCascadingMembers;
698+
std::unordered_set<std::string> computeHoldersOfCascadingMembers() {
699+
std::unordered_set<std::string> holdersOfCascadingMembers;
700700
for (const auto &p : SF->getReferencedNameTracker()->getUsedMembers()) {
701701
{
702702
bool isPrivate = declIsPrivate(p.getFirst().first);
703703
if (isPrivate && !includeIntrafileDeps)
704704
continue;
705705
}
706-
StringRef context =
706+
std::string context =
707707
DependencyKey::computeContextForProvidedEntity<NodeKind::nominal>(
708708
p.getFirst().first);
709709
bool isCascading = p.getSecond();
@@ -713,8 +713,8 @@ class UsedDeclEnumerator {
713713
return holdersOfCascadingMembers;
714714
}
715715

716-
void
717-
enumerateNominalUses(const llvm::StringSet<> &&holdersOfCascadingMembers) {
716+
void enumerateNominalUses(
717+
const std::unordered_set<std::string> &&holdersOfCascadingMembers) {
718718
for (const auto &p : SF->getReferencedNameTracker()->getUsedMembers()) {
719719
{
720720
bool isPrivate = declIsPrivate(p.getFirst().first);
@@ -723,7 +723,7 @@ class UsedDeclEnumerator {
723723
}
724724
const NominalTypeDecl *nominal = p.getFirst().first;
725725

726-
StringRef context =
726+
std::string context =
727727
DependencyKey::computeContextForProvidedEntity<NodeKind::nominal>(
728728
nominal);
729729
const bool isCascadingUse = holdersOfCascadingMembers.count(context) != 0;
@@ -738,11 +738,11 @@ class UsedDeclEnumerator {
738738
const bool isPotentialMember = rawName.empty();
739739
const bool isCascadingUse = p.getSecond();
740740
if (isPotentialMember) {
741-
StringRef context = DependencyKey::computeContextForProvidedEntity<
741+
std::string context = DependencyKey::computeContextForProvidedEntity<
742742
NodeKind::potentialMember>(nominal);
743743
enumerateUse(NodeKind::potentialMember, context, "", isCascadingUse);
744744
} else {
745-
StringRef context =
745+
std::string context =
746746
DependencyKey::computeContextForProvidedEntity<NodeKind::member>(
747747
nominal);
748748
StringRef name = rawName.userFacingName();

0 commit comments

Comments
 (0)