[PATCH] D143241: [Clang] Reset FP options before function instantiations
Serge Pavlov via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Jun 23 00:56:50 PDT 2023
sepavloff added a comment.
In D143241#4441812 <https://reviews.llvm.org/D143241#4441812>, @rjmccall wrote:
> Hmm. Why are we clearing the FP pragma stack instead of saving the old context onto it and then restoring after instantiation? I don't think semantic analysis ever depends on enclosing members of the stack, does it?
It shouldn't but the function body may contain pragmas and in the case of errors we could have weird behavior. Anyway, parsing in this case occurs at the end of translation unit, so it should be safe to clear pragma stack.
> Clearing the entire stack might not matter much if we're at the end of the translation unit, which is the normal time to instantiate things, but it would matter if we're eagerly instantiating within the translation unit, which we have to do for various reasons, including explicit instantiation and `constexpr`.
Explicit instantiation performs late parsing at the end of translation unit, just as implicit one. Constexpr functions are parsed as usualy, at the point of definition (see `Sema::canDelayFunctionBody`). It seems late parsing always occurs at the end of TU.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D143241/new/
https://reviews.llvm.org/D143241
More information about the cfe-commits
mailing list