[all-commits] [llvm/llvm-project] 2ac562: [Sema] Mark alias/ifunc targets used and consider ...

Fangrui Song via All-commits all-commits at lists.llvm.org
Mon Apr 15 17:59:01 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2ac562ab784c6bf04e6d3026c567d3552a735668
      https://github.com/llvm/llvm-project/commit/2ac562ab784c6bf04e6d3026c567d3552a735668
  Author: Fangrui Song <i at maskray.me>
  Date:   2024-04-15 (Mon, 15 Apr 2024)

  Changed paths:
    M clang/lib/Sema/CMakeLists.txt
    M clang/lib/Sema/SemaDeclAttr.cpp
    M clang/test/AST/ast-dump-attr-json.cpp
    M clang/test/Sema/alias-unused-win.cpp
    M clang/test/Sema/alias-unused.cpp
    M utils/bazel/llvm-project-overlay/clang/BUILD.bazel

  Log Message:
  -----------
  [Sema] Mark alias/ifunc targets used and consider mangled names

https://reviews.llvm.org/D54188 marked "alias" targets as used in C to
fix -Wunused false positives. This patch extends the approach to handle
mangled names to support global scope names in C++ and the
`overloadable` attribute in C.

In addition, we mark ifunc targets as used to fix #63957.

While our approach has false negatives for namespace scope names, the
majority of alias/ifunc C++ uses (global scope with no overloads) are
handled.

Note: The following function with internal linkage but C language
linkage type is mangled in Clang but not in GCC. This inconsistency
makes alias/ifunc difficult to use in C++ with portability (#88593).
```
extern "C" {
static void f0() {}
// GCC: void g0() __attribute__((alias("_ZL2f0v")));
// Clang: void g0() __attribute__((alias("f0")));
}
```

Pull Request: https://github.com/llvm/llvm-project/pull/87130



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