This step is the preparation of allowing lvalue in map/motion clause.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
clang/lib/Sema/SemaOpenMP.cpp | ||
---|---|---|
15480 | emitErrorMsg() here? | |
15481 | No need cast here. | |
15482 | Better to use IgnoreParenCasts() to handle explicit casting to the base class. | |
15489 | Just Visit(E) | |
15494 | Default initializer here | |
15496 | Default initializer | |
15497–15499 | Better to use = <init>; here. Just a nit. | |
15512 | Just Visit(E) | |
15517 | Just Visit(E) | |
15534 | Just Visit(E) | |
15553 | Visit(E) | |
15570–15571 | E->IgnoreParensCasts() | |
15572 | Need to check that AE->getIdx() is not value dependent, otherwise it may crash | |
15603–15604 | Just Visit(E) | |
15636–15645 | Also, need to be sure that the expressions here are not value-dependent. | |
15679–15708 | Just add: boo VisitStmt(Stmt *) { emitErrorMsg(); return false; } instead of all these functions, returning false as a result. | |
15709–15711 | No need for else here, just unconditional return nullptr. |
clang/lib/Sema/SemaOpenMP.cpp | ||
---|---|---|
15572 | It seems Clang would catch the error before we do the analysis: orig.cpp:6:24: error: array subscript is not an integer #pragma omp target map(a[b]) ^ ~ orig.cpp:15:3: note: in instantiation of function template specialization 'gg<int, double>' requested here gg<int, double>(a, c); ^ orig.cpp:8:5: error: array subscript is not an integer a[b] = 10; ^ ~ 2 errors generated. Also, if we still need it, do we also check type dependent? |
clang/lib/Sema/SemaOpenMP.cpp | ||
---|---|---|
15572 |
|
clang/lib/Sema/SemaOpenMP.cpp | ||
---|---|---|
15553 | return RelevantExpr || Visit(E);? | |
15580 | return RelevantExpr || Visit(E);? | |
15591–15592 |
| |
15606–15607 | return RelevantExpr || Visit(E);? | |
15652–15661 | Need a check for value-dependent OASE->getLowerBound() | |
15654–15655 |
| |
15677 | Just Visit(E); | |
15679 | Do you really need this function? | |
15695–15710 | Use \\\ style of comment here |
clang/lib/Sema/SemaOpenMP.cpp | ||
---|---|---|
15679 | Removed the function. |
Did you try to run the tests? I would suggest adding a test, at least, where a function is mapped. We should see the error message here. Seems to me, we don't have this one.
clang/lib/Sema/SemaOpenMP.cpp | ||
---|---|---|
15634–15637 | Same here, try to reduce complexity | |
15636–15637 | Just a nit. Try to reduce the structural complexity here by using logical exressions, if (!OASE->getLength()->isValueDependent() && OASE->getLength()->EvaluateAsInt(...) && !ResultR.Val.getInt().isOneValue()). Also, you can |
We already have test for err_omp_invalid_map_this_expr, note_omp_invalid_subscript_on_this_ptr_map, etc.. in target_message.cpp line 44 without checking for value dependence. Do you mean that I should add a test for the check of value dependence? In that case, we don't print any messages.
No. But previously, if we tried to map a function, not a variable, it would be skipped silently. With this patch, this behavior will change. I suggest adding a test with mapping a function to check that error message is emitted. Something like:
int foo(); #pragma omp target map(foo) // <- must be an error here
And I just asked if you tried to run the tests with this patch. Did the result change or it is the same?
Got it, I'll add test for function mapping. I've run the test and this patch passed all the test.
clang/lib/Sema/SemaOpenMP.cpp | ||
---|---|---|
15591–15593 | Simplify this nested ifs too, please. | |
clang/test/OpenMP/target_messages.cpp | ||
53–57 | You mapped CallExprs here, not DeclRefs | |
119–125 | same here, mapped CallExprs |
No problem. But I don't see the changes in the test.
clang/lib/Sema/SemaOpenMP.cpp | ||
---|---|---|
15707 | Remove braces here, the substatement is single line. |
clang/lib/Sema/SemaOpenMP.cpp | ||
---|---|---|
15679 | Was this function intended to be removed? As far as I can tell it was not and it seems to be the source of an issue I am having: expected addressable lvalue in 'map' clause |
emitErrorMsg() here?