| Summary: | CPPVariableReadWriteFlags.getReadWriteFlags returns incorrect result for method call | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Tools] CDT | Reporter: | Sergey Prigogin <eclipse.sprigogin> | ||||
| Component: | cdt-core | Assignee: | Sergey Prigogin <eclipse.sprigogin> | ||||
| Status: | RESOLVED FIXED | QA Contact: | Doug Schaefer <cdtdoug> | ||||
| Severity: | normal | ||||||
| Priority: | P3 | CC: | cdtdoug, malaperle | ||||
| Version: | 8.0 | Flags: | eclipse.sprigogin:
iplog-
mschorn.eclipse: review+ |
||||
| Target Milestone: | 8.1.0 | ||||||
| Hardware: | All | ||||||
| OS: | All | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
Created VariableReadWriteFlagsTest, which uncovered two more problems:
1.
int a = 1; READ | WRITE instead of expected WRITE
2.
struct A { int x; };
void test() {
A a;
a.x = 1; READ instead of expected WRITE
};
Created attachment 210705 [details]
Proposed fix
Markus,
Could you please review the attached fix for the function call issue. Thanks.
Comment on attachment 210705 [details]
Proposed fix
Looks good to me.
(In reply to comment #3) > Comment on attachment 210705 [details] > Proposed fix > Looks good to me. It just came to my mind that you may have to check the indirection of using the variable. The indirection is passed around as an argument and is modified when one of the operators [], *, & is encountered. Currently it is not adjusted when the operator -> is found. void test() { A* ap; A a; (*ap).m(); // read access to ap ap->m(); // read access to ap (&a)->m(); // read/write access to a } Fixed in master. *** cdt git genie on behalf of Sergey Prigogin ***
Bug 370887 - CPPVariableReadWriteFlags.getReadWriteFlags returns
incorrect results.
[*] http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=61e9d699ba21775a06748d2fbf3183d064411c37
*** cdt git genie on behalf of Sergey Prigogin ***
Bug 370887 - CPPVariableReadWriteFlags.getReadWriteFlags returns
incorrect results.
[*] http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=61e9d699ba21775a06748d2fbf3183d064411c37
*** cdt git genie on behalf of Sergey Prigogin ***
Bug 370887 - CPPVariableReadWriteFlags.getReadWriteFlags returns
incorrect results.
[*] http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=61e9d699ba21775a06748d2fbf3183d064411c37
|
In the following code class A { public: void m(); }; void test() { A a; a.m(); } CPPVariableReadWriteFlags.getReadWriteFlags returns READ for 'a' in a.m(). It should return WRITE since the method m is not declared const.