This is an archive of the discontinued LLVM Phabricator instance.

[clang] Set FP options in Sema when instantiating CompoundStmt
ClosedPublic

Authored by sepavloff on Aug 17 2023, 1:42 AM.

Details

Summary

When an expression is instantiated, TreeTransform skips ImplicitCastExpr
nodes, assuming they are recreated when the instantiated expression is
built. It breaks functions that use non-default floating-point options,
because they are kept in these ImplicitCastExprs. In this case the
recreated ImplicitCastExpr takes FP options from the current Sema state
and not from AST node.

To fix this issue FP options in Sema object are set when a compound
statement is cloned in TreeTransform.

This change fixes https://github.com/llvm/llvm-project/issues/64605
([Regression 16 -> 17] Template instantiation ignores FENV_ACCESS being
ON for both definition and instantiation).

Diff Detail

Event Timeline

sepavloff created this revision.Aug 17 2023, 1:42 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 17 2023, 1:42 AM
sepavloff requested review of this revision.Aug 17 2023, 1:42 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 17 2023, 1:42 AM
This revision is now accepted and ready to land.Aug 18 2023, 7:33 PM
This revision was landed with ongoing or failed builds.Aug 20 2023, 10:37 PM
This revision was automatically updated to reflect the committed changes.