I've implemented __builtin_FUNCSIG in Clang recently (llvm/llvm-project@78d8312):
const char* __builtin_FUNCSIG();
We should use this builtin in source_location implementation after VS gets Clang 17:
|
#if defined(__clang__) || defined(__EDG__) // TRANSITION, DevCom-10199227 and LLVM-58951
|
|
const char* const _Function_ = __builtin_FUNCTION()
|
|
#else // ^^^ workaround / no workaround vvv
|
|
const char* const _Function_ = __builtin_FUNCSIG()
|
|
#endif // TRANSITION, DevCom-10199227 and LLVM-58951
|
Comparison:
// https://godbolt.org/z/zq6v9v87q
#include <iostream>
void f(const char* old_ = __builtin_FUNCTION(), const char* new_ = __builtin_FUNCSIG()) {
std::cout << "old: " << old_ << "\nnew: " << new_ << '\n';
}
int main() {
f();
}
old: main
new: int __cdecl main(void)
I've implemented
__builtin_FUNCSIGin Clang recently (llvm/llvm-project@78d8312):We should use this builtin in
source_locationimplementation after VS gets Clang 17:STL/stl/inc/source_location
Lines 28 to 32 in a621095
Comparison: