forked from OSchip/llvm-project
Remember that we have a null terminated string.
This is a micro optimization. Instead of going char*->StringRef->Twine->char*, go char*->Twine->char* and avoid having to copy the filename on the stack. llvm-svn: 186380
This commit is contained in:
parent
2c633e40ee
commit
8c1ee47fb0
|
@ -387,7 +387,7 @@ public:
|
||||||
NewArchiveIterator(std::vector<std::string>::const_iterator I, Twine Name);
|
NewArchiveIterator(std::vector<std::string>::const_iterator I, Twine Name);
|
||||||
bool isNewMember() const;
|
bool isNewMember() const;
|
||||||
object::Archive::child_iterator getOld() const;
|
object::Archive::child_iterator getOld() const;
|
||||||
StringRef getNew() const;
|
const char *getNew() const;
|
||||||
StringRef getMemberName() const { return MemberName; }
|
StringRef getMemberName() const { return MemberName; }
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -411,9 +411,9 @@ object::Archive::child_iterator NewArchiveIterator::getOld() const {
|
||||||
return OldI;
|
return OldI;
|
||||||
}
|
}
|
||||||
|
|
||||||
StringRef NewArchiveIterator::getNew() const {
|
const char *NewArchiveIterator::getNew() const {
|
||||||
assert(IsNewMember);
|
assert(IsNewMember);
|
||||||
return *NewI;
|
return NewI->c_str();
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
@ -556,7 +556,7 @@ static void performWriteOperation(ArchiveOperation Operation,
|
||||||
|
|
||||||
if (I->isNewMember()) {
|
if (I->isNewMember()) {
|
||||||
// FIXME: we do a stat + open. We should do a open + fstat.
|
// FIXME: we do a stat + open. We should do a open + fstat.
|
||||||
StringRef FileName = I->getNew();
|
const char *FileName = I->getNew();
|
||||||
sys::fs::file_status Status;
|
sys::fs::file_status Status;
|
||||||
failIfError(sys::fs::status(FileName, Status), FileName);
|
failIfError(sys::fs::status(FileName, Status), FileName);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue