r243600 - Attempt to make clang-x64-ninja-win7 happy.

Sean Silva chisophugis at gmail.com
Wed Jul 29 19:19:08 PDT 2015


Turns out this did not make the bot any happier, but it did fix some
post-commit feedback from Richard on r243597  On unix there are corner
cases where foo/../foo is definitely not correct (related reading:
http://plan9.bell-labs.com/sys/doc/lexnames.html).

In r243602 I removed the spurious test that was the real culprit (after
investigating a bit deeper what exactly it was testing). The bot is now
happy.

-- Sean Silva

On Wed, Jul 29, 2015 at 5:52 PM, Sean Silva <chisophugis at gmail.com> wrote:

> Author: silvas
> Date: Wed Jul 29 19:52:32 2015
> New Revision: 243600
>
> URL: http://llvm.org/viewvc/llvm-project?rev=243600&view=rev
> Log:
> Attempt to make clang-x64-ninja-win7 happy.
>
> It looks like we were somehow relying somewhere on removing 'foo/./bar'
> but *not* 'foo/../foo/bar'. Currently investigating.
>
> Modified:
>     cfe/trunk/include/clang/Basic/FileManager.h
>     cfe/trunk/lib/Basic/FileManager.cpp
>
> Modified: cfe/trunk/include/clang/Basic/FileManager.h
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/FileManager.h?rev=243600&r1=243599&r2=243600&view=diff
>
> ==============================================================================
> --- cfe/trunk/include/clang/Basic/FileManager.h (original)
> +++ cfe/trunk/include/clang/Basic/FileManager.h Wed Jul 29 19:52:32 2015
> @@ -267,7 +267,7 @@ public:
>                                time_t ModificationTime);
>
>    /// \brief Remove any './' components from a path.
> -  static bool removeDotPaths(SmallVectorImpl<char> &Path);
> +  static bool removeDotPaths(SmallVectorImpl<char> &Path, bool
> RemoveDotDot = false);
>
>    /// \brief Retrieve the canonical name for a given directory.
>    ///
>
> Modified: cfe/trunk/lib/Basic/FileManager.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/FileManager.cpp?rev=243600&r1=243599&r2=243600&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/Basic/FileManager.cpp (original)
> +++ cfe/trunk/lib/Basic/FileManager.cpp Wed Jul 29 19:52:32 2015
> @@ -517,7 +517,7 @@ void FileManager::modifyFileEntry(FileEn
>  /// Remove '.' and '..' path components from the given absolute path.
>  /// \return \c true if any changes were made.
>  // FIXME: Move this to llvm::sys::path.
> -bool FileManager::removeDotPaths(SmallVectorImpl<char> &Path) {
> +bool FileManager::removeDotPaths(SmallVectorImpl<char> &Path, bool
> RemoveDotDot) {
>    using namespace llvm::sys;
>
>    SmallVector<StringRef, 16> ComponentStack;
> @@ -528,10 +528,12 @@ bool FileManager::removeDotPaths(SmallVe
>    for (StringRef C : llvm::make_range(path::begin(Rel), path::end(Rel))) {
>      if (C == ".")
>        continue;
> -    if (C == "..") {
> -      if (!ComponentStack.empty())
> -        ComponentStack.pop_back();
> -      continue;
> +    if (RemoveDotDot) {
> +      if (C == "..") {
> +        if (!ComponentStack.empty())
> +          ComponentStack.pop_back();
> +        continue;
> +      }
>      }
>      ComponentStack.push_back(C);
>    }
> @@ -566,7 +568,7 @@ StringRef FileManager::getCanonicalName(
>    SmallString<256> CanonicalNameBuf(CanonicalName);
>    llvm::sys::fs::make_absolute(CanonicalNameBuf);
>    llvm::sys::path::native(CanonicalNameBuf);
> -  removeDotPaths(CanonicalNameBuf);
> +  removeDotPaths(CanonicalNameBuf, true);
>    char *Mem =
> CanonicalNameStorage.Allocate<char>(CanonicalNameBuf.size());
>    memcpy(Mem, CanonicalNameBuf.data(), CanonicalNameBuf.size());
>    CanonicalName = StringRef(Mem, CanonicalNameBuf.size());
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150729/afd371b7/attachment.html>


More information about the cfe-commits mailing list