// C functions are not mangled.
if (L == CLanguageLinkage)
return false;
-
- // FIXME: Users assume they know the mangling of static functions
- // declared in extern "C" contexts, so we cannot always mangle them.
- // As an improvement, maybe we could mangle them only if they are actually
- // overloaded.
- const DeclContext *DC = FD->getDeclContext();
- if (!DC->isRecord() &&
- FD->getFirstDeclaration()->getDeclContext()->isExternCContext())
- return false;
}
// Otherwise, no mangling is done outside C++ mode.
if (D.isMain())
return false;
- // FIXME: Users assume they know the mangling of static functions
- // declared in extern "C" contexts. For now just disallow overloading these
- // functions so that we can avoid mangling them.
- const DeclContext *DC = D.getDeclContext();
- if (!DC->isRecord() &&
- D.getFirstDeclaration()->getDeclContext()->isExternCContext())
- return false;
-
return true;
}
extern "C" {
static void test2_f() {
}
- // This is not required by the standard, but users assume they know
- // the mangling of static functions in extern "C" contexts.
- // CHECK: define internal void @test2_f(
+ // CHECK: define internal void @_Z7test2_fv
+ static void test2_f(int x) {
+ }
+ // CHECK: define internal void @_Z7test2_fi
void test2_use() {
test2_f();
+ test2_f(42);
}
}
}
}
-// FIXME: This should be OK. Both test2_f don't have language linkage since they
-// have internal linkage.
+// This is OK. Both test2_f don't have language linkage since they have
+// internal linkage.
extern "C" {
- static void test2_f() { // expected-note {{previous definition is here}}
+ static void test2_f() {
}
- static void test2_f(int x) { // expected-error {{conflicting types for 'test2_f'}}
+ static void test2_f(int x) {
}
}