Open Quuxplusone opened 9 years ago
Bugzilla Link | PR22385 |
Status | CONFIRMED |
Importance | P normal |
Reported by | Tim Besard (tim.besard@elis.ugent.be) |
Reported on | 2015-01-29 08:09:57 -0800 |
Last modified on | 2015-09-02 02:38:30 -0700 |
Version | 3.6 |
Hardware | PC Linux |
CC | alexfh@google.com, guillaume.papin@epitech.eu, hans@chromium.org, klimek@google.com, llvm-bugs@lists.llvm.org |
Fixed by commit(s) | |
Attachments | |
Blocks | |
Blocked by | |
See also |
I've tested this bug with remove-cstr-calls
compiled against LLVM/Clang 3.5.1, and everything works as expected (refactoring files in a subdirectory, that is). So this seems like a regression from 3.5 to 3.6.
Some more details, the file I tested to rewrite:
----main.cpp--------------------
int main() { std::string Hello = "World"; std::out << std::string(Hello.c_str()) << std::endl;
return 1;
I checked out RemoveCstrCalls.cpp from release_35, compiled it against my system 3.5.1 LLVM installation, and called the binary as follows:
in /tmp/test: $ llvm-3.5/remove-cstr-calls src src/main.cpp
This works without error, while using remove-cstr-calls from 3.6 fails.
I've bisected this to r221600.
(In reply to comment #2)
> I've bisected this to r221600.
Alex, can you take a look?
The problem is that the paths in replacements turn out to be relative. That seems strange to me, as Replacement::setFromSourceLocation which seems to be used there, makes paths absolute.
I'll take a look at this tomorrow.
Has there been any progress on this one?
Not yet, unfortunately. Trying to switch to this.
(In reply to comment #6)
> Not yet, unfortunately. Trying to switch to this.
Any update?
I'm not sure if this is worth blocking the release on, but it sounds like it
would be nice to get fixed.
It seems like Replacement::setFromSourceLocation fails to make the path
absolute (fs::make_absolute fails) because the FileEntry it gets from the
SourceManager does not contain a full path. In case of the test set-up I used
above, the FileEntry contains file="main.cpp" dir="."
I tried to look further but couldn't easily find where the SourceManager is
populated.
Hans, I think, this shouldn't block the release, as there's an easy workaround (run from the directory where the compilation database points to).
But yeah, it would be nice to fix, and I'm looking into this. BTW, clang-check fails this way when trying to print an error message as well.
I meant clang-tidy crashes when outputting an error message in this case. And clang-check works fine.
(In reply to comment #9)
> Hans, I think, this shouldn't block the release, as there's an easy
> workaround (run from the directory where the compilation database points to).
Sounds reasonable.