Previously a diagnostic was given if the expression was not strictly a
DeclRef. Now also allow use of data members inside member functions.
Details
Diff Detail
Event Timeline
The spec says: interop-var is a variable of type omp_interop_t
And defines 'variable' as: A named data storage block, for which the value can be defined and redefined during the execution of a program.
So we think yes. Users think yes. They want to use init/destroy in constructors/destructors, which seems reasonable.
I would try to get clarification from the standard committee, need to fix this in the standard, if this is not quite correct.
clang/lib/Sema/SemaOpenMP.cpp | ||
---|---|---|
17256 | No need to introduce separate storage for the fields, reuse the existing one. | |
17265 | Try to use getPrivateItem(), if possible. | |
17287 | A check that the base is this? |
Use getPrivateItem() for interop variables.
clang/lib/Sema/SemaOpenMP.cpp | ||
---|---|---|
17287 | getPrivateItem() does this so should be good now. |
Add a test for member with base other than this?
clang/lib/Sema/SemaOpenMP.cpp | ||
---|---|---|
17264–17265 | Can you drop const_cast by dropping const from const OMPClause *C? | |
clang/test/OpenMP/interop_messages.cpp | ||
61 | Previous error message was much better, need to restore it. |
clang/test/OpenMP/interop_messages.cpp | ||
---|---|---|
61 | Better to remove name from the message to make it look like before. Also, if the messageis in the context of member function, would be good to emit something like variable or data member. |
Changed message to match old message. Prints 'variable' or 'data member' depending on context.
To include static data members in the message and be correct in C or C++ we need three cases:
In C:
expected variable of type 'omp_interop_t'
In a C++ non-member function:
expected variable or static data member of type 'omp_interop_t'
In a C++ member function:
expected variable, static data member, or non-static data member of current class of type 'omp_interop_t'
This seems to exactly describe the situation to me. Maybe I am missing the point.
Feel free to make specific recommendations to help move this along.
Right so the description above should really be:
In a C++ non-member function or static member function:
expected variable or static data member of type 'omp_interop_t'
In a C++ non-static member function:
expected variable, static data member, or non-static data member of current class of type 'omp_interop_t'
I'll add testing for static member functions.
Fix formatting.
clang/lib/Sema/SemaOpenMP.cpp | ||
---|---|---|
5331–5332 | In C++ there are two cases: "expected variable or static data member of type 'omp_interop_t'" !S.getCurrentThisType().isNull() -> only non-static member functions "expected variable, static data member, or non-static data member of current class of type 'omp_interop_t'" | |
clang/test/OpenMP/interop_messages.cpp | ||
64 |
Why? use(A::smember) is okay here. |
Maybe of the current instance or static member or something similar? data member of current class is not correct technically.