diff options
author | Charles Davis <cdavis@mines.edu> | 2012-05-26 23:12:19 +0000 |
---|---|---|
committer | Charles Davis <cdavis@mines.edu> | 2012-05-26 23:12:19 +0000 |
commit | 9fd2359ee3b140557b808e4b79bc73a3b9d62304 (patch) | |
tree | 97a88bb8059e69f2652ab843be8ac24ad057edf4 /test/CodeGenCXX/mangle-ms-templates.cpp | |
parent | 242cb065057558e2e189e9ea289f3a51059e862d (diff) |
Mangle template instantiations properly (as of VC 7.x) when compiling for
the Microsoft Visual C++ ABI. Currently limited to type and integral
non-type arguments. Based on a patch by Timur Iskhodzhanov!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@157524 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX/mangle-ms-templates.cpp')
-rw-r--r-- | test/CodeGenCXX/mangle-ms-templates.cpp | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/test/CodeGenCXX/mangle-ms-templates.cpp b/test/CodeGenCXX/mangle-ms-templates.cpp new file mode 100644 index 0000000000..357cc3b0e9 --- /dev/null +++ b/test/CodeGenCXX/mangle-ms-templates.cpp @@ -0,0 +1,43 @@ +// RUN: %clang_cc1 -fms-extensions -emit-llvm %s -o - -cxx-abi microsoft -triple=i386-pc-win32 | FileCheck %s + +template<typename T> +class Class { + public: + void method() {} +}; + +class Typename { }; + +template<typename T> +class Nested { }; + +template<bool flag> +class BoolTemplate { + public: + BoolTemplate() {} +}; + +void template_mangling() { + Class<Typename> c1; + c1.method(); +// CHECK: call {{.*}} @"\01?method@?$Class@VTypename@@@@QAEXXZ" + + Class<Nested<Typename> > c2; + c2.method(); +// CHECK: call {{.*}} @"\01?method@?$Class@V?$Nested@VTypename@@@@@@QAEXXZ" + + BoolTemplate<false> _false; +// CHECK: call {{.*}} @"\01??0?$BoolTemplate@$0A@@@QAE@XZ" + + BoolTemplate<true> _true; +// CHECK: call {{.*}} @"\01??0?$BoolTemplate@$00@@QAE@XZ" +} + +namespace space { + template<class T> const T& foo(const T& l) { return l; } +} +// CHECK: "\01??$foo@H@space@@YAABHABH@Z" + +void use() { + space::foo(42); +} |