summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/Mangle.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2017-09-07 00:55:55 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2017-09-07 00:55:55 +0000
commitcd4a7a461f9879aff7795929adbd943b22db1c4d (patch)
tree274838cbd93a8a7f38efaabd3bfdce1bf59b2527 /clang/lib/AST/Mangle.cpp
parent264d7c9021edd1d527567c105cc0285194f4d3bc (diff)
downloadbcm5719-llvm-cd4a7a461f9879aff7795929adbd943b22db1c4d.tar.gz
bcm5719-llvm-cd4a7a461f9879aff7795929adbd943b22db1c4d.zip
[modules ts] Ensure that module linkage variables are always emitted and always have their name mangled.
llvm-svn: 312684
Diffstat (limited to 'clang/lib/AST/Mangle.cpp')
-rw-r--r--clang/lib/AST/Mangle.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/clang/lib/AST/Mangle.cpp b/clang/lib/AST/Mangle.cpp
index 00d50c0e3bd..56a2500274a 100644
--- a/clang/lib/AST/Mangle.cpp
+++ b/clang/lib/AST/Mangle.cpp
@@ -103,6 +103,11 @@ bool MangleContext::shouldMangleDeclName(const NamedDecl *D) {
if (CC != CCM_Other)
return true;
+ // If the declaration has an owning module for linkage purposes that needs to
+ // be mangled, we must mangle its name.
+ if (!D->hasExternalFormalLinkage() && D->getOwningModuleForLinkage())
+ return true;
+
// In C, functions with no attributes never need to be mangled. Fastpath them.
if (!getASTContext().getLangOpts().CPlusPlus && !D->hasAttrs())
return false;
OpenPOWER on IntegriCloud