From 222e2a7620e6520ffaf4fc4e69d79c18da31542e Mon Sep 17 00:00:00 2001 From: "Zancanaro; Carlo" Date: Mon, 24 Sep 2012 09:58:17 +1000 Subject: Add the clang library to the repo (with some of my changes, too). --- clang/test/CodeGenCXX/explicit-instantiation.cpp | 45 ++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 clang/test/CodeGenCXX/explicit-instantiation.cpp (limited to 'clang/test/CodeGenCXX/explicit-instantiation.cpp') diff --git a/clang/test/CodeGenCXX/explicit-instantiation.cpp b/clang/test/CodeGenCXX/explicit-instantiation.cpp new file mode 100644 index 0000000..8daf3c6 --- /dev/null +++ b/clang/test/CodeGenCXX/explicit-instantiation.cpp @@ -0,0 +1,45 @@ +// RUN: %clang_cc1 -emit-llvm -triple i686-pc-linux-gnu -o - %s | FileCheck %s + +// This check logically is attached to 'template int S::i;' below. +// CHECK: @_ZN1SIiE1iE = weak_odr global i32 + +template +struct plus { + Result operator()(const T& t, const U& u) const; +}; + +template +Result plus::operator()(const T& t, const U& u) const { + return t + u; +} + +// CHECK: define weak_odr i32 @_ZNK4plusIillEclERKiRKl +template struct plus; + +// Check that we emit definitions from explicit instantiations even when they +// occur prior to the definition itself. +template struct S { + void f(); + static void g(); + static int i; + struct S2 { + void h(); + }; +}; + +// CHECK: define weak_odr void @_ZN1SIiE1fEv +template void S::f(); + +// CHECK: define weak_odr void @_ZN1SIiE1gEv +template void S::g(); + +// See the check line at the top of the file. +template int S::i; + +// CHECK: define weak_odr void @_ZN1SIiE2S21hEv +template void S::S2::h(); + +template void S::f() {} +template void S::g() {} +template int S::i; +template void S::S2::h() {} -- cgit v1.2.3