Page MenuHomePhabricator

Add option 'exceptions' to pragma clang fp
ClosedPublic

Authored by sepavloff on Oct 20 2020, 11:35 PM.

Details

Summary

Pragma 'clang fp' is extended to support a new option, 'exceptions'. It
allows to specify floating point exception behavior more flexibly.

Diff Detail

Event Timeline

sepavloff created this revision.Oct 20 2020, 11:35 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 20 2020, 11:35 PM
Herald added a subscriber: dexonsmith. · View Herald Transcript
sepavloff requested review of this revision.Oct 20 2020, 11:35 PM
mibintc added inline comments.Oct 21 2020, 5:54 AM
clang/docs/LanguageExtensions.rst
3223

do you mean pragma clang fp ...

clang/lib/Parse/ParsePragma.cpp
3054

Did you consider adding ActOnPragmaFPExceptions?

sepavloff added inline comments.Oct 21 2020, 6:20 AM
clang/docs/LanguageExtensions.rst
3223

Sure. Thank you!

clang/lib/Parse/ParsePragma.cpp
3054

The existing method setExceptionMode does everything that we need. Do you think it should be renamed to ActOnPragmaFPExceptions? Are there any advantages for this?

mibintc added inline comments.Oct 21 2020, 2:16 PM
clang/lib/Parse/ParsePragma.cpp
3054

I think it's easier to understand if it's written to parallel the other 2 fp pragmas that have similar semantics (contract and reassociate).

Added ActOnPragmaFPExceptions

sepavloff added inline comments.Oct 22 2020, 12:34 AM
clang/lib/Parse/ParsePragma.cpp
3054

It makes sense. This is a parser semantic action, they usually have names ActOn.... I didn't rename setExceptionMode , as in future we might need to set exception behavior from a place other than Parser.

mibintc accepted this revision.Oct 28 2020, 1:03 PM
This revision is now accepted and ready to land.Oct 28 2020, 1:03 PM
This revision was landed with ongoing or failed builds.Oct 31 2020, 3:37 AM
This revision was automatically updated to reflect the committed changes.