mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-02-03 07:38:57 +00:00
d3cf025ae2
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
22 lines
560 B
C
22 lines
560 B
C
// Test this without pch.
|
|
// RUN: %clang_cc1 -include %s -fsyntax-only -verify %s
|
|
|
|
// Test with pch.
|
|
// RUN: %clang_cc1 -emit-pch -o %t %s
|
|
// RUN: %clang_cc1 -include-pch %t -fsyntax-only -verify %s
|
|
|
|
#ifndef HEADER
|
|
#define HEADER
|
|
|
|
int f(int) __attribute__((visibility("default"), overloadable));
|
|
int g(int) __attribute__((abi_tag("foo", "bar", "baz"), no_sanitize("address", "memory")));
|
|
|
|
#else
|
|
|
|
float f(float);
|
|
double f(double); // expected-error{{overloadable}}
|
|
// expected-note@-2{{previous unmarked overload}}
|
|
void h() { g(0); }
|
|
|
|
#endif
|