[cfe-commits] r138666 - /cfe/trunk/lib/Driver/Driver.cpp

Chad Rosier mcrosier at apple.com
Fri Aug 26 15:35:44 PDT 2011


On Aug 26, 2011, at 2:55 PM, David Blaikie wrote:

>  // Strip the directory and suffix from BaseInput.
> -static const char *getBaseName (const char *BaseInput) {
> +static std::string getBaseName (const char *BaseInput) {
>   std::pair<StringRef, StringRef> Split = StringRef(BaseInput).rsplit('/');
>   if (Split.second != "")
> -    return Split.second.split('.').first.str().c_str();
> +    return Split.second.split('.').first.str();
>   else
> -    return Split.first.split('.').first.str().c_str();
> +    return Split.first.split('.').first.str();
>  }
> 
> 
> Shouldn't this just return StringRef instead? what's the reason you're converting to std::string at all here?

Actually, Benjamin pointed out that llvm::sys::path::filename() was already doing the bulk of what I needed.  Cleanup committed clang revision r138670, thanks.

> - David 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20110826/4d985197/attachment.html>


More information about the cfe-commits mailing list