mirror of
https://github.com/Gericom/teak-llvm.git
synced 2025-06-21 12:35:47 -04:00

This diff previously exposed a bug in LLVM's IRLinker, breaking buildbots that tried to self-host LLVM with monolithic LTO. The bug is now in LLVM by D59552 Original commit message: As PR17480 describes, clang does not support the used attribute for member functions of class templates. This means that if the member function is not used, its definition is never instantiated. This patch changes clang to emit the definition if it has the used attribute. Test Plan: Added a testcase Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D56928 llvm-svn: 356598
20 lines
601 B
C++
20 lines
601 B
C++
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s | FileCheck %s
|
|
|
|
// Check that PR17480 is fixed: __attribute__((used)) ignored in templated
|
|
// classes
|
|
namespace InstantiateUsedMemberDefinition {
|
|
template <typename T>
|
|
struct S {
|
|
int __attribute__((used)) f() {
|
|
return 0;
|
|
}
|
|
};
|
|
|
|
void test() {
|
|
// Check that InstantiateUsedMemberDefinition::S<int>::f() is defined
|
|
// as a result of the S class template implicit instantiation
|
|
// CHECK: define linkonce_odr i32 @_ZN31InstantiateUsedMemberDefinition1SIiE1fEv
|
|
S<int> inst;
|
|
}
|
|
} // namespace InstantiateUsedMemberDefinition
|