diff options
author | David Majnemer <david.majnemer@gmail.com> | 2013-09-17 22:21:27 +0000 |
---|---|---|
committer | David Majnemer <david.majnemer@gmail.com> | 2013-09-17 22:21:27 +0000 |
commit | 1ebb145bdff0b3dc85a972922b9c706d298fc462 (patch) | |
tree | c6580c88b57f6ccfb0565553d7d13e9a6b02ee19 /clang/test/CodeGenCXX/mangle-ms.cpp | |
parent | 870b662779107b429a3ebc10340b039c48229806 (diff) | |
download | bcm5719-llvm-1ebb145bdff0b3dc85a972922b9c706d298fc462.tar.gz bcm5719-llvm-1ebb145bdff0b3dc85a972922b9c706d298fc462.zip |
[-cxx-abi microsoft] Mangle local TagDecls appropriately
Summary:
When selecting a mangling for an anonymous tag type:
- We should first try it's typedef'd name.
- If that doesn't work, we should mangle in the name of the declarator
that specified it as a declaration specifier.
- If that doesn't work, fall back to a static mangling of
<unnamed-type>.
This should make our anonymous type mangling compatible.
This partially fixes PR16994; we would need to have an implementation of
scope numbering to get it right (a separate issue).
Reviewers: rnk, rsmith, rjmccall, cdavis5x
CC: cfe-commits
Differential Revision: http://llvm-reviews.chandlerc.com/D1540
llvm-svn: 190892
Diffstat (limited to 'clang/test/CodeGenCXX/mangle-ms.cpp')
-rw-r--r-- | clang/test/CodeGenCXX/mangle-ms.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/mangle-ms.cpp b/clang/test/CodeGenCXX/mangle-ms.cpp index 8b7aa4223d9..fd7c605c99f 100644 --- a/clang/test/CodeGenCXX/mangle-ms.cpp +++ b/clang/test/CodeGenCXX/mangle-ms.cpp @@ -275,3 +275,32 @@ int wWinMain() { return 0; } int DllMain() { return 0; } // CHECK-DAG: @DllMain // X64-DAG: @DllMain + +inline int inline_function_with_local_type() { + static struct { + int a_field; + } static_variable_in_inline_function = { 20 }, second_static = { 40 }; + // CHECK: @"\01?static_variable_in_inline_function@?1??inline_function_with_local_type@@YAHXZ@4U<unnamed-type-static_variable_in_inline_function>@?1??1@YAHXZ@A" + + return static_variable_in_inline_function.a_field + second_static.a_field; +} + +int call_inline_function_with_local_type() { + return inline_function_with_local_type(); +} + +template <typename T> +inline int templated_inline_function_with_local_type() { + static struct { + int a_field; + } static_variable_in_templated_inline_function = { 20 }, + second_static = { 40 }; + // CHECK: @"\01?static_variable_in_templated_inline_function@?1???$templated_inline_function_with_local_type@H@@YAHXZ@4U<unnamed-type-static_variable_in_templated_inline_function>@?1???$templated_inline_function_with_local_type@H@@YAHXZ@A" + + return static_variable_in_templated_inline_function.a_field + + second_static.a_field; +} + +int call_templated_inline_function_with_local_type() { + return templated_inline_function_with_local_type<int>(); +} |