Partially revert r175117 so that we don't break assumptions about how
static functions in extern "C" contexts are mangled. Should fix the
bootstrap.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175132 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/ItaniumMangle.cpp b/lib/AST/ItaniumMangle.cpp
index e9a3b03..1f95a2f 100644
--- a/lib/AST/ItaniumMangle.cpp
+++ b/lib/AST/ItaniumMangle.cpp
@@ -381,6 +381,15 @@
// mangling.
if (!FD->getDeclName().isIdentifier() || L == CXXLanguageLinkage)
return true;
+
+ // 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.