search for: tostringref

Displaying 12 results from an estimated 12 matches for "tostringref".

Did you mean: stringref
2011 Jul 19
0
[LLVMdev] Correct use of StringRef and Twine
...eturn values: 1. Use std::string when the value is computed, or there are other lifetime issues. 2. Use StringRef otherwise. And for arguments, generally always use Twine as the default, it allows construction of complex things, and is still efficient when passed the equiv of a StringRef (with the toStringRef method). The only annoying thing about it is that the API to do this requires a temporary SmallVector to scribble in, which makes it more difficult to use. It seems that there should be a good way to fix this API problem. > * Would it be OK to implement an implicit conversion from Twine to st...
2011 Jul 18
3
[LLVMdev] Correct use of StringRef and Twine
I'm attempting to do some amount of mass migration from const std::string& (& const char*) to StringRef. In doing so I stumbled across the fact that while StringRef has no op+ to speak of (well, it has += and I added a manual StringRef+std::string and std::string+StringRef for now - though I'm thinking perhaps they can be skipped in favor of Twine operations), Twine does provide a
2016 Apr 18
2
Redundant Twine->StringRef->Twine conversions in llvm::sys::fs::make_absolute?
...llvm::Twine, p converts to a bunch of Twine temporaries. In a few places, namely path::has_root_directory & path::has_root_name, that temporary Twine is again converted to a StringRef: bool has_root_directory(const Twine &path) { SmallString<128> path_storage; StringRef p = path.toStringRef(path_storage); return !root_directory(p).empty(); } Is there some reason for this? If not, I'll write a patch to delay the StringRef p(path.data(), path.size()) construction until it's actually needed (calls to path::root_name(p) & path::relative_path(p)). Sincerely, Alexander Ricc...
2012 Mar 22
1
[LLVMdev] Infinite recursion in sys::fs::create_directories()
..."" which is "" which doesn't exist etc. The function should perhaps check if parent is empty. Here is how I fixed it: //------------------ error_code create_directories(const Twine &path, bool &existed) { SmallString<128> path_storage; StringRef p = path.toStringRef(path_storage); StringRef parent = path::parent_path(p); if (!parent.empty()) { bool parent_exists; if (error_code ec = exists(parent, parent_exists)) return ec; if (!parent_exists) if (error_code ec = create_directories(parent, existed)) return ec; } return create_direct...
2011 Jul 19
3
[LLVMdev] Correct use of StringRef and Twine
> And for arguments, generally always use Twine as the default, it allows construction of complex things, and is still efficient when passed the equiv of a StringRef (with the toStringRef method).  The only annoying thing about it is that the API to do this requires a temporary SmallVector to scribble in, which makes it more difficult to use. Yes, I noticed this - which was one of my concerns about migrating lots of stuff to Twine: that efficient Twine-sinks would be tricky and/or...
2012 Mar 21
0
[LLVMdev] Infinite recursion in sys::fs::create_directories()
..."" which is "" which doesn't exist etc. The function should perhaps check if parent is empty. Here is how I fixed it: //------------------ error_code create_directories(const Twine &path, bool &existed) { SmallString<128> path_storage; StringRef p = path.toStringRef(path_storage); StringRef parent = path::parent_path(p); if (!parent.empty()) { bool parent_exists; if (error_code ec = exists(parent, parent_exists)) return ec; if (!parent_exists) if (error_code ec = create_directories(parent, existed)) return ec; } return create_direct...
2011 Jul 21
4
[LLVMdev] Correct use of StringRef and Twine
> And for arguments, generally always use Twine as the default, it allows construction of complex things, and is still efficient when passed the equiv of a StringRef (with the toStringRef method).  The only annoying thing about it is that the API to do this requires a temporary SmallVector to scribble in, which makes it more difficult to use. > > It seems that there should be a good way to fix this API problem. This is the problem I'm still trying to figure out. It seems...
2011 Jul 22
0
[LLVMdev] Correct use of StringRef and Twine
On Jul 21, 2011, at 12:00 AM, David Blaikie wrote: >> And for arguments, generally always use Twine as the default, it allows construction of complex things, and is still efficient when passed the equiv of a StringRef (with the toStringRef method). The only annoying thing about it is that the API to do this requires a temporary SmallVector to scribble in, which makes it more difficult to use. >> >> It seems that there should be a good way to fix this API problem. > > This is the problem I'm still trying to fi...
2012 Jun 19
0
[LLVMdev] llvm/include/Support/FileSystem.h
This is a proposed patch to enhance FileSystem.h to add functionality (getting and setting permission bits and mapping an unmapping files). This implementation follows the N3365 proposal regarding permission bits. This functionality is needed for my next patch which will implement llvm/include/Support/FileOutputBuffer.h which is needed by lld. -------------- next part -------------- A
2012 May 18
2
[LLVMdev] [RFC] llvm/include/Support/FileOutputBuffer.h
On Fri, May 18, 2012 at 3:07 PM, Michael Spencer <bigcheesegs at gmail.com> wrote: > >> +  error_code ec = sys::fs::status(filePathTwine, stat); > > stat is undefined if ec isn't success. ec will be success even in the case of > file_not_found. Actually I was wrong. The Windows and UNIX implementation disagree on this point. I'm going to change it to match
2012 May 18
0
[LLVMdev] [RFC] llvm/include/Support/FileOutputBuffer.h
...SmallVectorImpl<char> &result_path, > - bool makeAbsolute, unsigned mode) { > + bool makeAbsolute, bool private_file) { > // Use result_path as temp storage. > result_path.set_size(0); > StringRef m = model.toStringRef(result_path); > @@ -755,6 +755,43 @@ > return error_code::success(); > } > > +error_code map_file_pages(const Twine &path, off_t file_offset, size_t size, > + bool map_writable, void *&result) { > + assert(0 && &qu...
2012 May 17
3
[LLVMdev] [RFC] llvm/include/Support/FileOutputBuffer.h
I now have an implementation of FileOutputBuffer (OutputBuffer was already taken). The patch supports the functionality listed below and I've tested that it works for lld. -------------- next part -------------- A non-text attachment was scrubbed... Name: FileOutputBuffer.patch Type: application/octet-stream Size: 25308 bytes Desc: not available URL: