diff options
author | George Burgess IV <george.burgess.iv@gmail.com> | 2017-06-27 21:31:31 +0000 |
---|---|---|
committer | George Burgess IV <george.burgess.iv@gmail.com> | 2017-06-27 21:31:31 +0000 |
commit | d3cf025ae22188a15e8249a5c69bcf71aa4450e2 (patch) | |
tree | 49e6129dff948b59f8b519373ac4f52b5ca345c1 /clang/test/CodeGenCXX/mangle-ms.cpp | |
parent | 0b7688e6c0048cfcb9834c00d31b975eea30d849 (diff) | |
download | bcm5719-llvm-d3cf025ae22188a15e8249a5c69bcf71aa4450e2.tar.gz bcm5719-llvm-d3cf025ae22188a15e8249a5c69bcf71aa4450e2.zip |
[Sema] Allow unmarked overloadable functions.
This patch extends the `overloadable` attribute to allow for one
function with a given name to not be marked with the `overloadable`
attribute. The overload without the `overloadable` attribute will not
have its name mangled.
So, the following code is now legal:
void foo(void) __attribute__((overloadable));
void foo(int);
void foo(float) __attribute__((overloadable));
In addition, this patch fixes a bug where we'd accept code with
`__attribute__((overloadable))` inconsistently applied. In other words,
we used to accept:
void foo(void);
void foo(void) __attribute__((overloadable));
But we will do this no longer, since it defeats the original purpose of
requiring `__attribute__((overloadable))` on all redeclarations of a
function.
This breakage seems to not be an issue in practice, since the only code
I could find that had this pattern often looked like:
void foo(void);
void foo(void) __attribute__((overloadable)) __asm__("foo");
void foo(int) __attribute__((overloadable));
...Which can now be simplified by simply removing the asm label and
overloadable attribute from the redeclaration of `void foo(void);`
Differential Revision: https://reviews.llvm.org/D32332
llvm-svn: 306467
Diffstat (limited to 'clang/test/CodeGenCXX/mangle-ms.cpp')
-rw-r--r-- | clang/test/CodeGenCXX/mangle-ms.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/mangle-ms.cpp b/clang/test/CodeGenCXX/mangle-ms.cpp index ee0f50e5e2d..7e2f17f27a9 100644 --- a/clang/test/CodeGenCXX/mangle-ms.cpp +++ b/clang/test/CodeGenCXX/mangle-ms.cpp @@ -399,6 +399,13 @@ template void fn_tmpl<extern_c_func>(); extern "C" void __attribute__((overloadable)) overloaded_fn() {} // CHECK-DAG: @"\01?overloaded_fn@@$$J0YAXXZ" +extern "C" void overloaded_fn2() {} +// CHECK-DAG: @overloaded_fn2 +// +extern "C" void __attribute__((overloadable)) overloaded_fn3(); +extern "C" void overloaded_fn3() {} +// CHECK-DAG: @overloaded_fn3 + namespace UnnamedType { struct S { typedef struct {} *T1[1]; |