Compute mangling numbers for externally visible local variables and tags. Change the mangler to consistently use discriminators where necessary. Tweak the scheme we use to number decls which are not externally visible to avoid unnecessary discriminators in common cases now that we request them more consistently. Fixes <rdar://problem/14204721>. llvm-svn: 185986
98 lines
1.5 KiB
C++
98 lines
1.5 KiB
C++
// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
|
|
|
|
// CHECK: @_ZZ4FUNCvEN4SSSSC1ERKf
|
|
// CHECK: @_ZZ4FUNCvEN4SSSSC2E_0RKf
|
|
// CHECK: @_ZZ4GORFfEN4SSSSC1ERKf
|
|
// CHECK: @_ZZ4GORFfEN4SSSSC2E_0RKf
|
|
|
|
void FUNC ()
|
|
{
|
|
{
|
|
float IVAR1 ;
|
|
|
|
struct SSSS
|
|
{
|
|
float bv;
|
|
SSSS( const float& from): bv(from) { }
|
|
};
|
|
|
|
SSSS VAR1(IVAR1);
|
|
}
|
|
|
|
{
|
|
float IVAR2 ;
|
|
|
|
struct SSSS
|
|
{
|
|
SSSS( const float& from) {}
|
|
};
|
|
|
|
SSSS VAR2(IVAR2);
|
|
}
|
|
}
|
|
|
|
void GORF (float IVAR1)
|
|
{
|
|
{
|
|
struct SSSS
|
|
{
|
|
float bv;
|
|
SSSS( const float& from): bv(from) { }
|
|
};
|
|
|
|
SSSS VAR1(IVAR1);
|
|
}
|
|
|
|
{
|
|
float IVAR2 ;
|
|
|
|
struct SSSS
|
|
{
|
|
SSSS( const float& from) {}
|
|
};
|
|
|
|
SSSS VAR2(IVAR2);
|
|
}
|
|
}
|
|
|
|
// CHECK: @_ZZ12OmittingCodefEN4SSSSC1E_0RKf
|
|
inline void OmittingCode(float x) {
|
|
if (0) {
|
|
struct SSSS {
|
|
float bv;
|
|
SSSS(const float& from): bv(from) { }
|
|
};
|
|
|
|
SSSS VAR1(x);
|
|
}
|
|
|
|
struct SSSS {
|
|
float bv;
|
|
SSSS(const float& from): bv(from) { }
|
|
};
|
|
|
|
SSSS VAR2(x);
|
|
}
|
|
void CallOmittingCode() { OmittingCode(1); }
|
|
|
|
// CHECK: @_ZZ25LocalTemplateFunctionTestdEN5Local3fooIdEET_S1_
|
|
int LocalTemplateFunctionTest(double d) {
|
|
struct Local {
|
|
template<class T> T foo(T t) {
|
|
return t;
|
|
}
|
|
};
|
|
return Local().foo(d);
|
|
}
|
|
|
|
// CHECK: @_ZZ15LocalAnonStructvENUt0_1gEv
|
|
inline void LocalAnonStruct() {
|
|
if (0) {
|
|
struct { void f() {} } x;
|
|
x.f();
|
|
}
|
|
struct { void g() {} } y;
|
|
y.g();
|
|
}
|
|
void CallLocalAnonStruct() { LocalAnonStruct(); }
|