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

Serge Pavlov via All-commits all-commits at lists.llvm.org
Wed Aug 30 08:11:01 PDT 2023


  Branch: refs/heads/release/17.x
  Home:   https://github.com/llvm/llvm-project
  Commit: cfd6f0fb9d58b71ec2bd242e58be1c9522cec260
      https://github.com/llvm/llvm-project/commit/cfd6f0fb9d58b71ec2bd242e58be1c9522cec260
  Author: Serge Pavlov <sepavloff at gmail.com>
  Date:   2023-08-30 (Wed, 30 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

(cherry picked from commit 0baf85c331090fbe2d2b42214ed0664d55feb0b5)


  Commit: 78447a8ad57ac62bcc40bd6c865b071e3d686ec1
      https://github.com/llvm/llvm-project/commit/78447a8ad57ac62bcc40bd6c865b071e3d686ec1
  Author: Serge Pavlov <sepavloff at gmail.com>
  Date:   2023-08-30 (Wed, 30 Aug 2023)

  Changed paths:
    M clang/test/SemaCXX/template-64605.cpp

  Log Message:
  -----------
  [clang] Run test for concrete target

The test clang/test/SemaCXX/template-64605.cpp uses pragma FENV_ACCESS,
which is not supported on all targets. Restrict it to x86_64 only.

(cherry picked from commit 73e5a70e676850b79f196e01e2194a2485041584)


  Commit: 45c677d8c62b731df617181e5019316d0b2e1820
      https://github.com/llvm/llvm-project/commit/45c677d8c62b731df617181e5019316d0b2e1820
  Author: Serge Pavlov <sepavloff at gmail.com>
  Date:   2023-08-30 (Wed, 30 Aug 2023)

  Changed paths:
    M clang/test/SemaCXX/template-64605.cpp

  Log Message:
  -----------
  [clang][test] Make check pattern shorter

A check pattern in clang/test/SemaCXX/template-64605.cpp contains template
specialization kind (the text "implicit_instantiation"). It does not need to
be checked and can be safely removed.

Presence of this text in the check pattern prevents from backporting some
commits to the release branch: https://github.com/llvm/llvm-project/issues/64605.
It has only recently been printed and the relevant commit is not present in
the release/17.x branch.

(cherry picked from commit 8859c644ede4898f90f77dcad2286de08a9ba62e)


Compare: https://github.com/llvm/llvm-project/compare/b8ea78cf4495...45c677d8c62b


More information about the All-commits mailing list