Change the test in isAllowedClauseForDirective from if with multiple conditions
to a main switch on directive and then switches on clause for each directive. Version
check is still done with a condition in the return statment.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/include/llvm/Frontend/OpenMP/OMP.td | ||
---|---|---|
471 ↗ | (On Diff #276289) | [Drive By] Unrelated? |
llvm/include/llvm/Frontend/OpenMP/OMP.td | ||
---|---|---|
471 ↗ | (On Diff #276289) | It was a duplicate. Already on line 469. |
llvm/include/llvm/Frontend/OpenMP/OMP.td | ||
---|---|---|
471 ↗ | (On Diff #276289) | Makes compilation error because of duplicate case when code is generated. |
llvm/include/llvm/Frontend/OpenMP/OMP.td | ||
---|---|---|
471 ↗ | (On Diff #276289) | Commit NFC changes like that w/o review if it "just makes sense". |
llvm/include/llvm/Frontend/OpenMP/OMP.td | ||
---|---|---|
471 ↗ | (On Diff #276289) | Ok! Good to know! |
llvm/test/TableGen/directive1.td | ||
---|---|---|
120 | In most examples I've seen, the outer case would be formatted as: case TDLD_dira: { . . . break; } clang-format puts the { on the same line as the case. grep shows some code putting break; on the same line as the } and some code putting it on the line before. However, I did at least find one example in LLVM docs showing the way I'm suggesting above. Alternatively, as in this example, couldn't those braces be dropped given that there are no local declarations? | |
124 | The unreachable message doesn't make sense given the default in the directive switch. If that switch covers all directives, default isn't needed anyway. | |
llvm/utils/TableGen/DirectiveEmitter.cpp | ||
253–254 | Maybe GenerateCaseForVersionedClauses given that it's not just allowedClauses? |
llvm/test/TableGen/directive1.td | ||
---|---|---|
124 | Is the default useful? Are all directives covered by cases? |
llvm/test/TableGen/directive1.td | ||
---|---|---|
124 | This is what I'm thinking of: |
Remove default in directive switch
llvm/test/TableGen/directive1.td | ||
---|---|---|
124 | Yeah for directive we get remove it since it's fully covered. Just pushed an update. |
Other than the last bit of cleanup I commented on, LGTM.
llvm/test/TableGen/directive1.td | ||
---|---|---|
124 | But it needs llvm_unreachable, whose message makes sense now that default is removed. Also, the last update removed the wrong default from the emitter. |
Should be good now.
llvm/test/TableGen/directive1.td | ||
---|---|---|
124 | Of course! Shouldn't try to do two things at the same time ... sorry for the mix. |
In most examples I've seen, the outer case would be formatted as:
clang-format puts the { on the same line as the case.
grep shows some code putting break; on the same line as the } and some code putting it on the line before. However, I did at least find one example in LLVM docs showing the way I'm suggesting above.
Alternatively, as in this example, couldn't those braces be dropped given that there are no local declarations?