<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - fixit should follow symlinks when writing files"
href="https://bugs.llvm.org/show_bug.cgi?id=39409">39409</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>fixit should follow symlinks when writing files
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>6.0
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Frontend
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>mblythester@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>-----------
Test input:
-----------
------
foo_real.cc:
------
#include "foo.h"
void foo( cFoo x){
(void)x;
}
------
foo_real.h:
------
#include "bar.h"
namespace nFoo{
class cFoo{};
class cFooBar: public cBar {};
}
------
bar.h:
------
namespace nBar{
class cBar{};
}
------
foo.cc is a softlink/symlink to foo_real.cc
foo.h is a softlink/symlink to foo_real.h
------
$ ls -o
total 4
-rw-rw-r-- 1 mblythe 34 Oct 23 12:59 bar.h
lrwxrwxrwx 1 mblythe 11 Oct 23 13:02 foo.cc -> foo_real.cc
lrwxrwxrwx 1 mblythe 10 Oct 23 13:02 foo.h -> foo_real.h
-rw-rw-r-- 1 mblythe 50 Oct 23 12:57 foo_real.cc
-rw-rw-r-- 1 mblythe 85 Oct 23 12:59 foo_real.h
------
Compile command and ouptut:
------
$ clang -c -o foo foo.cc -Xclang -fixit
In file included from foo.cc:1:
./foo.h:5:25: error: unknown class name 'cBar'; did you mean 'nBar::cBar'?
class cFooBar: public cBar {};
^~~~
nBar::cBar
./foo.h:5:25: note: FIX-IT applied suggested code changes
./bar.h:2:9: note: 'nBar::cBar' declared here
class cBar{};
^
foo.cc:3:11: error: unknown type name 'cFoo'; did you mean 'nFoo::cFoo'?
void foo( cFoo x){
^~~~
nFoo::cFoo
foo.cc:3:11: note: FIX-IT applied suggested code changes
./foo.h:4:9: note: 'nFoo::cFoo' declared here
class cFoo{};
^
2 errors generated.
------
----------------
Expected Result:
----------------------
The softlinks/symlinks remain unchanged, and the fixit changes are applied to
the files that they reference.
------
foo_real.cc:
------
#include "foo.h"
void foo( nFoo::cFoo x){
(void)x;
}
------
foo_real.h:
------
#include "bar.h"
namespace nFoo{
class cFoo{};
class cFooBar: public nBar::cBar {};
}
------
-------------------------
Current Incorrect Result:
-------------------------
The softlinks/symlinks are replaced with files containing the fixes:
------
$ ls -o
total 8
-rw-rw-r-- 1 mblythe 34 Oct 23 12:59 bar.h
-rw-rw-r-- 1 mblythe 56 Oct 23 13:20 foo.cc
-rw-rw-r-- 1 mblythe 91 Oct 23 13:20 foo.h
-rw-rw-r-- 1 mblythe 50 Oct 23 12:57 foo_real.cc
-rw-rw-r-- 1 mblythe 85 Oct 23 12:59 foo_real.h
------
I realize that it may be an uncommon or unusual use case to have the source
files be softlinks/symlinks, but I'd expect it to be well-supported.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>