[PATCH] D123952: [FPEnv] Allow CompoundStmt to keep FP options

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 29 06:51:25 PDT 2022


aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

LGTM modulo the rename request.



================
Comment at: clang/lib/AST/Stmt.cpp:370-371
   setStmts(Stmts);
+  if (hasStoredFPFeatures())
+    setStoredFPFeatures(FPFeatures);
 }
----------------
rjmccall wrote:
> aaron.ballman wrote:
> > There's a part of me that wonders if it's a slightly more clear design to have `setStoredFPFeatures()` set `CompoundStmtBits.HasFPFeatures` to true as needed rather than requiring the caller to do this two-step initialization process. WDYT?
> `setStoredFPFeatures` is only otherwise used in deserialization, and the node has to be allocated properly to support it.  I think this is the right approach.
My concern was more with new calls added later -- it seems reasonable that someone would think they could call `setStoredFPFeatures()` and have them stored rather than asserting the object already claims to have stored features.

That said, I don't feel strongly, so we can always adjust it in the future as new callers are added.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D123952/new/

https://reviews.llvm.org/D123952



More information about the cfe-commits mailing list