forked from OSchip/llvm-project
Support: Move c_str from SmallVector back to SmallString and add a free standing
templated c_str in Windows.h to replace it. llvm-svn: 121381
This commit is contained in:
parent
730f51ad96
commit
751e9aafa9
|
@ -38,6 +38,13 @@ public:
|
|||
// Extra methods.
|
||||
StringRef str() const { return StringRef(this->begin(), this->size()); }
|
||||
|
||||
// TODO: Make this const, if it's safe...
|
||||
const char* c_str() {
|
||||
this->push_back(0);
|
||||
this->pop_back();
|
||||
return this->data();
|
||||
}
|
||||
|
||||
// Implicit conversion to StringRef.
|
||||
operator StringRef() const { return str(); }
|
||||
|
||||
|
|
|
@ -340,13 +340,6 @@ public:
|
|||
return Result;
|
||||
}
|
||||
|
||||
// TODO: Make this const, if it's safe...
|
||||
typename SuperClass::const_pointer c_str() {
|
||||
push_back(0);
|
||||
pop_back();
|
||||
return this->data();
|
||||
}
|
||||
|
||||
void swap(SmallVectorImpl &RHS);
|
||||
|
||||
/// append - Add the specified range to the end of the SmallVector.
|
||||
|
|
|
@ -623,7 +623,7 @@ error_code directory_iterator_construct(directory_iterator& it,
|
|||
|
||||
// Get the first directory entry.
|
||||
WIN32_FIND_DATAW FirstFind;
|
||||
ScopedFindHandle FindHandle(::FindFirstFileW(path_utf16.c_str(), &FirstFind));
|
||||
ScopedFindHandle FindHandle(::FindFirstFileW(c_str(path_utf16), &FirstFind));
|
||||
if (!FindHandle)
|
||||
return windows_error(::GetLastError());
|
||||
|
||||
|
|
|
@ -102,3 +102,16 @@ public:
|
|||
typedef ScopedHandle<HANDLE, uintptr_t(-1),
|
||||
BOOL (WINAPI*)(HANDLE), ::FindClose>
|
||||
ScopedFindHandle;
|
||||
|
||||
namespace llvm {
|
||||
template <class T>
|
||||
class SmallVectorImpl;
|
||||
|
||||
template <class T>
|
||||
typename SmallVectorImpl<T>::const_pointer
|
||||
c_str(SmallVectorImpl<T> &str) {
|
||||
str.push_back(0);
|
||||
str.pop_back();
|
||||
return str.data();
|
||||
}
|
||||
} // end namespace llvm.
|
||||
|
|
Loading…
Reference in New Issue