[Re-sending, since mailing the Reply-To: apparently failed to do anything.]
If I recall correctly from my DOS/Windows days, "C:test.c" really means "the file named test.c in the current working directory associated with C:", and is not generally equivalent to "C:\test.c". (Windows maintains separate current working directories for each different drive letter.) Corroboration: http://docs.racket-lang.org/reference/windowspaths.html You should double-check that the current behavior is actually a bug; maybe you're just in the wrong directory when you run clang. –Arthur On Mon, Jul 1, 2013 at 10:11 AM, Yunzhong Gao <[email protected]> wrote: > ygao added you to the CC list for the revision "Fixing a driver bug where > clang cannot locate source file at drive root". > > Hi, > If I run the following command on Windows, I get an error that clang cannot > find the source file. MinGW/GCC seems to work fine. > > C:> clang C:test.c > error: error reading 'C:test.c' > 1 error generated. > > This change attempts to fix it by patching the directory name if the > directory name is the same as a drive name. > > I am not sure how to write a regression test for this bug :( > Any suggestions? Maybe write a test that copies itself to the drive root at > the beginning of the RUN line? > > Would appreciate it if someone could review and commit this for me. > > Many thanks, > - Gao. > > http://llvm-reviews.chandlerc.com/D937 > > Files: > lib/Basic/FileManager.cpp > > Index: lib/Basic/FileManager.cpp > =================================================================== > --- lib/Basic/FileManager.cpp > +++ lib/Basic/FileManager.cpp > @@ -293,6 +293,14 @@ > llvm::sys::path::is_separator(DirName.back())) > DirName = DirName.substr(0, DirName.size()-1); > > +#ifdef LLVM_ON_WIN32 > + // Fixing a problem with "clang C:test.c" on Windows. > + // Stat("C:") does not recognize "C:" as a valid directory > + if (DirName.size() > 1 && DirName.back() == ':' && > + DirName.equals_lower(llvm::sys::path::root_name(DirName))) > + DirName = DirName.str() + '\\'; > +#endif > + > ++NumDirLookups; > llvm::StringMapEntry<DirectoryEntry *> &NamedDirEnt = > SeenDirEntries.GetOrCreateValue(DirName); _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
