Skip to content

Commit 5b0c4b2

Browse files
author
David Ungar
committed
Fix memory violation when build record is bad.
1 parent 6305f1f commit 5b0c4b2

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/Driver/Driver.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ static bool getCompilationRecordPath(std::string &buildRecordPath,
375375
return false;
376376
}
377377

378-
static StringRef failedToReadOutOfDateMap(bool ShowIncrementalBuildDecisions,
378+
static std::string failedToReadOutOfDateMap(bool ShowIncrementalBuildDecisions,
379379
StringRef buildRecordPath,
380380
StringRef reason = "") {
381381
std::string why = "malformed build record file";
@@ -398,7 +398,7 @@ static void dealWithRemovedInputs(ArrayRef<StringRef> removedInputs,
398398
bool ShowIncrementalBuildDecisions);
399399

400400
/// Returns why ignore incrementality
401-
static StringRef
401+
static std::string
402402
populateOutOfDateMap(InputInfoMap &map, llvm::sys::TimePoint<> &LastBuildTime,
403403
StringRef argsHashStr, const InputFileList &inputs,
404404
StringRef buildRecordPath,
@@ -893,7 +893,7 @@ Driver::buildCompilation(const ToolChain &TC,
893893
computeArgsHash(ArgsHash, *TranslatedArgList);
894894
llvm::sys::TimePoint<> LastBuildTime = llvm::sys::TimePoint<>::min();
895895
InputInfoMap outOfDateMap;
896-
StringRef whyIgnoreIncrementallity =
896+
std::string whyIgnoreIncrementallity =
897897
!Incremental
898898
? ""
899899
: buildRecordPath.empty()
@@ -1027,7 +1027,7 @@ Driver::buildCompilation(const ToolChain &TC,
10271027
// This has to happen after building jobs, because otherwise we won't even
10281028
// emit .swiftdeps files for the next build.
10291029
if (!whyIgnoreIncrementallity.empty())
1030-
C->disableIncrementalBuild(whyIgnoreIncrementallity.str());
1030+
C->disableIncrementalBuild(whyIgnoreIncrementallity);
10311031

10321032
if (Diags.hadAnyError())
10331033
return nullptr;

0 commit comments

Comments
 (0)