Use StringRef in more places to match recent llvm changes.

llvm r283043 and possibly other recent changes switch to use StringRef
instead of char* pointers. Update Swift to match. In some cases, this is
a clear improvement. It would be good to assess the impact on memory use,
particularly for the Filename component of source locations.

Note that the change to SILLocation::isNull fixes an apparent bug where
the location was treated as null when the filename was *not* null.
This commit is contained in:
Bob Wilson
2016-10-13 12:56:38 -07:00
parent c08a96a880
commit 3fd92f82e8
13 changed files with 41 additions and 47 deletions

View File

@@ -150,8 +150,8 @@ FileUnit *SerializedModuleLoader::loadAST(
bool isFramework) {
assert(moduleInputBuffer);
const char *moduleBufferID = moduleInputBuffer->getBufferIdentifier();
const char *moduleDocBufferID = nullptr;
StringRef moduleBufferID = moduleInputBuffer->getBufferIdentifier();
StringRef moduleDocBufferID;
if (moduleDocInputBuffer)
moduleDocBufferID = moduleDocInputBuffer->getBufferIdentifier();
@@ -236,9 +236,9 @@ FileUnit *SerializedModuleLoader::loadAST(
break;
case serialization::Status::MalformedDocumentation:
assert(moduleDocBufferID);
assert(!moduleDocBufferID.empty());
Ctx.Diags.diagnose(*diagLoc, diag::serialization_malformed_module,
moduleDocBufferID ? moduleDocBufferID : "");
moduleDocBufferID);
break;
case serialization::Status::MissingDependency: {