Add and use the CONCAT macro to force the expansion of LINE in
PushSemantics body.
Details
- Reviewers
clementval - Commits
- rG12bddc81b076: [NFC][flang] Fix PushSemantics macro
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
It's trying to fix the name of the local variable used by PushSemantics macro. There is no open issue, I discovered this while debugging.
pushSemanticsLocalVariable##__LINE__ gets preprocessed to pushSemanticsLocalVariable__LINE__.
This patch fixes this, as it seems the original intent was to append the line number to the variable name.
This would also avoid compilation errors in the unlikely case that PushSemantics is used twice in the same scope.
And if PushSemantics is used in a nested way, this avoids shadowing the variables in the outer scopes, which helps when debugging.
Any way to add a test so we can make sure we have what we want?
flang/lib/Lower/ConvertExpr.cpp | ||
---|---|---|
3023–3024 | Why do we need two macros here? |
It would be possible to add a unit test that uses PushSemantics in the ways that currently cause issues, but it would have to be moved to ConvertExpr.h. Would it be ok?
flang/lib/Lower/ConvertExpr.cpp | ||
---|---|---|
3023–3024 | It's because arguments are not expanded in concatenation. That's why we need to call CONCAT2, before doing the concatenation. |
Why do we need two macros here?