[all-commits] [llvm/llvm-project] 8930ba: [clang][FMV] Allow declaration of function version...

Alexandros Lamprineas via All-commits all-commits at lists.llvm.org
Thu May 23 02:09:44 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8930ba98e01bc66949e482b396f8389d64388359
      https://github.com/llvm/llvm-project/commit/8930ba98e01bc66949e482b396f8389d64388359
  Author: Alexandros Lamprineas <alexandros.lamprineas at arm.com>
  Date:   2024-05-23 (Thu, 23 May 2024)

  Changed paths:
    M clang/lib/CodeGen/CodeGenModule.cpp
    M clang/lib/Sema/SemaDecl.cpp
    A clang/test/CodeGenCXX/fmv-namespace.cpp
    A clang/test/Sema/fmv-namespace.cpp

  Log Message:
  -----------
  [clang][FMV] Allow declaration of function versions in namespaces. (#93044)

Fixes the following bug:

namespace Name {
int __attribute((target_version("default"))) foo() { return 0; }
}

namespace Name {
int __attribute((target_version("sve"))) foo() { return 1; }
}

int bar() { return Name::foo(); }

error: redefinition of 'foo'
  int __attribute((target_version("sve"))) foo() { return 1; }

note: previous definition is here
  int __attribute((target_version("default"))) foo() { return 0; }

While fixing this I also found that in the absence of default version
declaration, the one we implicitly create has incorrect mangling if
we are in a namespace:

namespace OtherName {
int __attribute((target_version("sve"))) foo() { return 2; }
}

int baz() { return OtherName::foo(); }

In this example instead of creating a declaration for the symbol
@_ZN9OtherName3fooEv.default we are creating one for the symbol
@_Z3foov.default (the namespace mangling prefix is omitted).
This has now been fixed.



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