[cfe-commits] r89229 - /cfe/trunk/lib/Frontend/PCHReader.cpp

Daniel Dunbar daniel at zuster.org
Sat Nov 21 20:43:35 PST 2009


On Thu, Nov 19, 2009 at 8:29 AM, Chris Lattner <clattner at apple.com> wrote:
> Sys::path introduces a temporary STD::string copy.  Would it make more sense
> for sys::path to have a static isabsolute method that takes a stringref in
> addition to a helper method that forwards to the static one?

Yes, but, sys::Path just needs to be rewritten, IMHO. I'm sure someone
will do it someday, but until someone does I don't see a good reason
to worry about individual band-aids. This call gets done very few
times, so we can probably find more interesting things to spend time
on.

 - Daniel

> -Chris
>
> On Nov 18, 2009, at 9:50 PM, Daniel Dunbar <daniel at zuster.org> wrote:
>
>> Author: ddunbar
>> Date: Wed Nov 18 13:50:41 2009
>> New Revision: 89229
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=89229&view=rev
>> Log:
>> Use llvm::sys::Path to check isAbsolute, instead of hard coding. Also,
>> remove random FIXME (?).
>>
>> Modified:
>>   cfe/trunk/lib/Frontend/PCHReader.cpp
>>
>> Modified: cfe/trunk/lib/Frontend/PCHReader.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/PCHReader.cpp?rev=89229&r1=89228&r2=89229&view=diff
>>
>>
>> ==============================================================================
>> --- cfe/trunk/lib/Frontend/PCHReader.cpp (original)
>> +++ cfe/trunk/lib/Frontend/PCHReader.cpp Wed Nov 18 13:50:41 2009
>> @@ -34,6 +34,7 @@
>> #include "llvm/Support/Compiler.h"
>> #include "llvm/Support/MemoryBuffer.h"
>> #include "llvm/Support/ErrorHandling.h"
>> +#include "llvm/System/Path.h"
>> #include <algorithm>
>> #include <iterator>
>> #include <cstdio>
>> @@ -1086,11 +1087,9 @@
>>  if (!RelocatablePCH)
>>    return;
>>
>> -  if (Filename.empty() || Filename[0] == '/' || Filename[0] == '<')
>> +  if (Filename.empty() || llvm::sys::Path(Filename).isAbsolute())
>>    return;
>>
>> -  std::string FIXME = Filename;
>> -
>>  if (isysroot == 0) {
>>    // If no system root was given, default to '/'
>>    Filename.insert(Filename.begin(), '/');
>>
>>
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>




More information about the cfe-commits mailing list