[all-commits] [llvm/llvm-project] 0baf85: [clang] Set FP options in Sema when instantiating ...

Serge Pavlov via All-commits all-commits at lists.llvm.org
Sun Aug 20 22:38:01 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0baf85c331090fbe2d2b42214ed0664d55feb0b5
      https://github.com/llvm/llvm-project/commit/0baf85c331090fbe2d2b42214ed0664d55feb0b5
  Author: Serge Pavlov <sepavloff at gmail.com>
  Date:   2023-08-21 (Mon, 21 Aug 2023)

  Changed paths:
    M clang/lib/Sema/TreeTransform.h
    A clang/test/SemaCXX/template-64605.cpp

  Log Message:
  -----------
  [clang] Set FP options in Sema when instantiating CompoundStmt

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 the 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).

Differential Revision: https://reviews.llvm.org/D158158




More information about the All-commits mailing list