[cfe-commits] r111866 - /cfe/trunk/lib/Basic/FileManager.cpp

Chris Lattner sabre at nondot.org
Mon Aug 23 16:50:42 PDT 2010


Author: lattner
Date: Mon Aug 23 18:50:42 2010
New Revision: 111866

URL: http://llvm.org/viewvc/llvm-project?rev=111866&view=rev
Log:
fix PR7953 - Windows filename are case insensitive:

#pragma once wasn't working on win32 if the header file was included
using a different case.
I tracked down  the problem to the fact that clang::FileManager was
caching files using case sensitive string (UniqueFiles) on Windows.

I changed FileManager to cache filename in lower case only.
Doesn't affect UNIX because UNIX uses Inode to uniquely identify files.

unix doesn't use this codepath.

Analysis and patch by Francois Pichet!


Modified:
    cfe/trunk/lib/Basic/FileManager.cpp

Modified: cfe/trunk/lib/Basic/FileManager.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/FileManager.cpp?rev=111866&r1=111865&r2=111866&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/FileManager.cpp (original)
+++ cfe/trunk/lib/Basic/FileManager.cpp Mon Aug 23 18:50:42 2010
@@ -19,6 +19,7 @@
 
 #include "clang/Basic/FileManager.h"
 #include "llvm/ADT/SmallString.h"
+#include "llvm/ADT/StringExtras.h"
 #include "llvm/Support/raw_ostream.h"
 #include "llvm/System/Path.h"
 #include "llvm/Config/config.h"
@@ -83,6 +84,9 @@
 public:
   FileEntry &getFile(const char *Name, struct stat &StatBuf) {
     std::string FullPath(GetFullPath(Name));
+    
+    // LowercaseString because Windows filesystem is case insensitive.
+    FullPath = llvm::LowercaseString(FullPath);
     return UniqueFiles.GetOrCreateValue(
                                FullPath.c_str(),
                                FullPath.c_str() + FullPath.size()





More information about the cfe-commits mailing list