This is an archive of the discontinued LLVM Phabricator instance.

Fix path concatenation in HeaderSearch
AbandonedPublic

Authored by yaron.keren on May 9 2014, 2:25 AM.

Details

Summary

Fixed the FIXME: Filename concatenation done using llvm::sys::path::append.

Diff Detail

Event Timeline

yaron.keren updated this revision to Diff 9238.May 9 2014, 2:25 AM
yaron.keren retitled this revision from to Fix path concatenation in HeaderSearch.
yaron.keren updated this object.
yaron.keren edited the test plan for this revision. (Show Details)
yaron.keren added reviewers: echristo, hans, dblaikie.
yaron.keren added a subscriber: Unknown Object (MLST).

Does this fix any bug or is just a cleanup? If it fixes a bug, can you
include a testcase?

I fixes the file names shown in clang messages as

c:\my\dir/file.cpp

(incosistent slashes) TmpDir arrives in native so always concatenating '/' is wrong. That's what the fixme said...

testcase is tricky as the path seperator changes if clang and the tools were compiled on windows or not. It does not depend on the target but on the host.

Can we make a test that behave differently based on the host OS?

Can we make a test that behave differently based on the host OS?

Since the behavior change is on windows, I think you can just write a test with

REQUIRES: system-windows

Cheers,
Rafael

// REQUIRES: system-windows

run on Windows 7 results in

UNSUPPORTED: LLVM :: Other/path-seperator.c (1 of 1)

what feature work with requires? In other test I have seen REQUIRES: asserts, zlib, nozlib but no OS example.

My mistake, I ran the test under llvm/test instead of clang/test.

yaron.keren updated this revision to Diff 9278.May 10 2014, 5:09 AM

+deleted line
+test

yaron.keren added a comment.EditedMay 10 2014, 5:38 AM

This patch caused one regression test failure, clang/test/Misc/remap-file.c.

The failure is the result of a FileManager::getVirtualFile limitation: it considers c:\dir\file different than c:/dir/file.
FileManager::getFile may have the same problem but I think it gets sorted out since both names point to same inode and getFile merges them.

Regardless of this patch I think getVirtualFile and getFile should be tolerant to the path seperators.

How to proceed?
Fix the get*File to be tolerant? his will require allocating a native version filename for each entry.
XFAIL the test on Windows and add a Windows only version of it?

I added Argyrios Kyrtzidis to the review since he has done some work on clang's file handling. He probably has an opinion on how to fix the virtual interface.

It may make sense to fix this together with file names case insensitivty on Windows

http://llvm.org/bugs/show_bug.cgi?id=17993