| Summary: | Linked resource contains incorrect path in the ast | ||
|---|---|---|---|
| Product: | [Tools] CDT | Reporter: | Elena Laskavaia <elaskavaia.cdt> |
| Component: | cdt-parser | Assignee: | Project Inbox <cdt-parser-inbox> |
| Status: | RESOLVED WONTFIX | QA Contact: | Markus Schorn <mschorn.eclipse> |
| Severity: | normal | ||
| Priority: | P3 | CC: | cdtdoug, eclipse.sprigogin, l.felber, malaperle |
| Version: | 8.0 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Bug Depends on: | |||
| Bug Blocks: | 337204 | ||
|
Description
Elena Laskavaia
reverse block graph (In reply to comment #0) > But this is not possible since the AST.getFilePath also (falsly) points to > A/D/F.cpp instead of B/D/F.cpp. So the wrong AST location is probably the > problem which should be solved fist. The AST is unaware of eclipse projects, I'd be surprised if IASTTranslationUnit.getFilePath() returns anything different from the file-location: <location-of-project-A>/D/F.cpp The documentation of IASTTranslationUnit.getFilePath() is missleading. I have updated the java-doc. *** cdt cvs genie on behalf of mschorn *** Bug 338041: Updated java-doc. [*] IASTTranslationUnit.java 1.59 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt-core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTTranslationUnit.java?root=Tools_Project&r1=1.58&r2=1.59 (In reply to comment #2) > The AST is unaware of eclipse projects, I'd be surprised if > IASTTranslationUnit.getFilePath() returns anything different from the > file-location: <location-of-project-A>/D/F.cpp I think the problem is not caused by the AST returning the wrong path (it actually returns the path to <location-of-project-A>/D/F.cpp, whereas it should return <location-of-project-B>/D/F.cpp since the codan checker is hardly running on the file F in project A(which is closed) ). But the problem is caused that the AST is initialized with a wrong path, which comes form the LocationMap that gets the path form the CProcessor which then gets it form the FileContent. So if reconstructing the situation described above in comment #0, one should investigate what location is used when creating the AST. I assume that the string path which is given to the FileContent originates from an eclipse resource. And this resource is <location-of-project-A>/D/F.cpp instead of <location-of-project-B>/D/F.cpp. (In reply to comment #5) > I think the problem is not caused by the AST returning the wrong path (it > actually returns the path to <location-of-project-A>/D/F.cpp, whereas it should > return <location-of-project-B>/D/F.cpp since the codan checker is hardly > running on the file F in project A(which is closed) ). > But the problem is caused that the AST is initialized with a wrong path, which > comes form the LocationMap that gets the path form the CProcessor which then > gets it form the FileContent. > So if reconstructing the situation described above in comment #0, one should > investigate what location is used when creating the AST. I assume that the > string path which is given to the FileContent originates from an eclipse > resource. And this resource is <location-of-project-A>/D/F.cpp instead of > <location-of-project-B>/D/F.cpp. Nope, the location is correct: It is <location-of-project-A>/D/F.cpp, because this location exists (in the file-system) independent of whether project A is open or not. The file <location-of-project-B>/D/F.cpp does not exist! (Because B/D is a linked folder) |