[CodeGenModule] Assume dso_local for -fpic -fno-semantic-interposition
Summary:
Clang -fpic defaults to -fno-semantic-interposition (GCC -fpic defaults
to -fsemantic-interposition).
Users need to specify -fsemantic-interposition to get semantic
interposition behavior.
Semantic interposition is currently a best-effort feature. There may
still be some cases where it is not handled well.
Reviewers: peter.smith, rnk, serge-sans-paille, sfertile, jfb, jdoerfert
Subscribers: dschuff, jyknight, dylanmckay, nemanjai, jvesely, kbarton, fedor.sergeev, asb, rbar, johnrusso, simoncook, sabuasal, niosHD, jrtc27, zzheng, edward-jones, atanasyan, rogfer01, MartinMosbeck, brucehoult, the_o, arphaman, PkmX, jocewei, jsji, Jim, lenary, s.egerton, pzheng, sameer.abuasal, apazos, luismarques, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D73865
2020-02-03 04:23:47 +08:00
|
|
|
// RUN: %clang_cc1 -std=c++14 -fcoroutines-ts -triple=x86_64-unknown-linux-gnu -emit-llvm %s -o - -disable-llvm-passes -fsemantic-interposition | FileCheck %s
|
2017-05-24 22:19:48 +08:00
|
|
|
|
|
|
|
#include "Inputs/coroutine.h"
|
|
|
|
|
|
|
|
namespace coro = std::experimental::coroutines_v1;
|
|
|
|
|
|
|
|
struct coro1 {
|
|
|
|
struct promise_type {
|
|
|
|
coro1 get_return_object();
|
|
|
|
coro::suspend_never initial_suspend();
|
|
|
|
coro::suspend_never final_suspend();
|
|
|
|
void return_void();
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
coro1 f() {
|
|
|
|
co_await coro::suspend_never{};
|
|
|
|
}
|
|
|
|
|
[CodeGenModule] Assume dso_local for -fpic -fno-semantic-interposition
Summary:
Clang -fpic defaults to -fno-semantic-interposition (GCC -fpic defaults
to -fsemantic-interposition).
Users need to specify -fsemantic-interposition to get semantic
interposition behavior.
Semantic interposition is currently a best-effort feature. There may
still be some cases where it is not handled well.
Reviewers: peter.smith, rnk, serge-sans-paille, sfertile, jfb, jdoerfert
Subscribers: dschuff, jyknight, dylanmckay, nemanjai, jvesely, kbarton, fedor.sergeev, asb, rbar, johnrusso, simoncook, sabuasal, niosHD, jrtc27, zzheng, edward-jones, atanasyan, rogfer01, MartinMosbeck, brucehoult, the_o, arphaman, PkmX, jocewei, jsji, Jim, lenary, s.egerton, pzheng, sameer.abuasal, apazos, luismarques, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D73865
2020-02-03 04:23:47 +08:00
|
|
|
// CHECK-LABEL: define dso_local void @_Z1fv(
|
2017-05-24 22:19:48 +08:00
|
|
|
// CHECK: call void @_ZNSt12experimental13coroutines_v113suspend_never12await_resumeEv(%"struct.std::experimental::coroutines_v1::suspend_never"*
|
|
|
|
// CHECK: call void @_ZN5coro112promise_type11return_voidEv(%"struct.coro1::promise_type"* %__promise)
|
|
|
|
|
2017-07-31 15:48:13 +08:00
|
|
|
struct A {
|
|
|
|
A();
|
|
|
|
~A();
|
|
|
|
};
|
|
|
|
|
|
|
|
coro1 f2() {
|
|
|
|
co_return (void) A{};
|
|
|
|
}
|
|
|
|
|
|
|
|
// CHECK-LABEL: define void @_Z2f2v(
|
2018-10-15 23:43:00 +08:00
|
|
|
// CHECK: call void @_ZN1AC1Ev(%struct.A* %[[AVar:.*]])
|
2017-07-31 15:48:13 +08:00
|
|
|
// CHECK-NEXT: call void @_ZN1AD1Ev(%struct.A* %[[AVar]])
|
|
|
|
// CHECK-NEXT: call void @_ZN5coro112promise_type11return_voidEv(%"struct.coro1::promise_type"*
|
|
|
|
|
2017-05-24 22:19:48 +08:00
|
|
|
struct coro2 {
|
|
|
|
struct promise_type {
|
|
|
|
coro2 get_return_object();
|
|
|
|
coro::suspend_never initial_suspend();
|
|
|
|
coro::suspend_never final_suspend();
|
|
|
|
void return_value(int);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
coro2 g() {
|
|
|
|
co_return 42;
|
|
|
|
}
|
|
|
|
|
|
|
|
// CHECK-LABEL: define void @_Z1gv(
|
|
|
|
// CHECK: call void @_ZNSt12experimental13coroutines_v113suspend_never12await_resumeEv(%"struct.std::experimental::coroutines_v1::suspend_never"*
|
|
|
|
// CHECK: call void @_ZN5coro212promise_type12return_valueEi(%"struct.coro2::promise_type"* %__promise, i32 42)
|