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

Chris Lattner clattner at apple.com
Thu Nov 19 08:29:21 PST 2009


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?

-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