[all-commits] [llvm/llvm-project] 0a1467: CodeGen: Strip exception specifications from funct...

pcc via All-commits all-commits at lists.llvm.org
Fri Dec 3 11:51:12 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0a14674f276b598d23353290635fc62f93e9ab30
      https://github.com/llvm/llvm-project/commit/0a14674f276b598d23353290635fc62f93e9ab30
  Author: Peter Collingbourne <peter at pcc.me.uk>
  Date:   2021-12-03 (Fri, 03 Dec 2021)

  Changed paths:
    M clang/lib/CodeGen/CodeGenModule.cpp
    A clang/test/CodeGenCXX/cfi-icall-noexcept.cpp

  Log Message:
  -----------
  CodeGen: Strip exception specifications from function types in CFI type names.

With C++17 the exception specification has been made part of the
function type, and therefore part of mangled type names.

However, it's valid to convert function pointers with an exception
specification to function pointers with the same argument and return
types but without an exception specification, which means that e.g. a
function of type "void () noexcept" can be called through a pointer
of type "void ()". We must therefore consider the two types to be
compatible for CFI purposes.

We can do this by stripping the exception specification before mangling
the type name, which is what this patch does.

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




More information about the All-commits mailing list