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

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to