[all-commits] [llvm/llvm-project] c5b3fe: [clang] Automatically add the `returns_twice` attr...

Alan Zhao via All-commits all-commits at lists.llvm.org
Mon Mar 31 09:42:55 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c5b3fe209408c89c1ca21f103a8fd45fb48c3138
      https://github.com/llvm/llvm-project/commit/c5b3fe209408c89c1ca21f103a8fd45fb48c3138
  Author: Alan Zhao <ayzhao at google.com>
  Date:   2025-03-31 (Mon, 31 Mar 2025)

  Changed paths:
    M clang/lib/CodeGen/CGCall.cpp
    M clang/test/CodeGen/2003-08-20-vfork-bug.c
    M clang/test/CodeGen/setjmp.c

  Log Message:
  -----------
  [clang] Automatically add the `returns_twice` attribute to certain functions even if `-fno-builtin` is set (#133511)

Certain functions require the `returns_twice` attribute in order to
produce correct codegen. However, `-fno-builtin` removes all knowledge
of functions that require this attribute, so this PR modifies Clang to
add the `returns_twice` attribute even if `-fno-builtin` is set. This
behavior is also consistent with what GCC does.

It's not (easily) possible to get the builtin information from
`Builtins.td` because `-fno-builtin` causes Clang to never initialize
any builtins, so functions never get tokenized as functions/builtins
that require `returns_twice`. Therefore, the most straightforward
solution is to explicitly hard code the function names that require
`returns_twice`.

Fixes #122840



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list