mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-16 14:46:36 +00:00
[CLANG-CL] Remove the 'static' specifier for _FUNCTION_ in MSVC mode. (#128184)
The macro `FUNCTION` is returning the `static` specifier for static templated functions. It's not the case for MSVC. See https://godbolt.org/z/KnhWhqs47 Clang-cl is returning: `__FUNCTION__ static inner::C<class A>::f` `__FUNCTION__ static inner::C<class A>::f` for the reproducer.
This commit is contained in:
parent
59e0704a52
commit
7358973df1
@ -251,6 +251,8 @@ Bug Fixes in This Version
|
||||
- Non-local variable and non-variable declarations in the first clause of a ``for`` loop in C are no longer incorrectly
|
||||
considered an error in C23 mode and are allowed as an extension in earlier language modes.
|
||||
|
||||
- Remove the ``static`` specifier for the value of ``_FUNCTION_`` for static functions, in MSVC compatibility mode.
|
||||
|
||||
Bug Fixes to Compiler Builtins
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
|
@ -747,7 +747,7 @@ std::string PredefinedExpr::ComputeName(PredefinedIdentKind IK,
|
||||
if (const CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(FD)) {
|
||||
if (MD->isVirtual() && IK != PredefinedIdentKind::PrettyFunctionNoVirtual)
|
||||
Out << "virtual ";
|
||||
if (MD->isStatic())
|
||||
if (MD->isStatic() && !ForceElaboratedPrinting)
|
||||
Out << "static ";
|
||||
}
|
||||
|
||||
|
@ -524,6 +524,57 @@ TestClass<test_func::C> t2;
|
||||
TestStruct<test_func::S> t3;
|
||||
TestEnum<test_func::E> t4;
|
||||
|
||||
class A { int b;};
|
||||
namespace inner {
|
||||
template <class Ty>
|
||||
class C {
|
||||
public:
|
||||
template <class T>
|
||||
static void f(int i) {
|
||||
(void)i;
|
||||
#ifdef MS
|
||||
static_assert(is_equal(__FUNCTION__, "test_func::inner::C<class test_func::A>::f"));
|
||||
#else
|
||||
static_assert(is_equal(__FUNCTION__, "f"));
|
||||
#endif
|
||||
}
|
||||
template <class T>
|
||||
static constexpr void cf(int i) {
|
||||
(void)i;
|
||||
#ifdef MS
|
||||
static_assert(is_equal(__FUNCTION__, "test_func::inner::C<class test_func::A>::cf"));
|
||||
#else
|
||||
static_assert(is_equal(__FUNCTION__, "cf"));
|
||||
#endif
|
||||
}
|
||||
template <class T>
|
||||
static void df(double f) {
|
||||
(void)f;
|
||||
#ifdef MS
|
||||
static_assert(is_equal(__FUNCTION__, "test_func::inner::C<class test_func::A>::df"));
|
||||
#else
|
||||
static_assert(is_equal(__FUNCTION__, "df"));
|
||||
#endif
|
||||
}
|
||||
template <class T>
|
||||
static constexpr void cdf(double f) {
|
||||
(void)f;
|
||||
#ifdef MS
|
||||
static_assert(is_equal(__FUNCTION__, "test_func::inner::C<class test_func::A>::cdf"));
|
||||
#else
|
||||
static_assert(is_equal(__FUNCTION__, "cdf"));
|
||||
#endif
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
void foo() {
|
||||
test_func::inner::C<test_func::A>::f<char>(1);
|
||||
test_func::inner::C<test_func::A>::cf<char>(1);
|
||||
test_func::inner::C<test_func::A>::df<void>(1.0);
|
||||
test_func::inner::C<test_func::A>::cdf<void>(1.0);
|
||||
}
|
||||
|
||||
} // namespace test_func
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user