summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/Decl.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2017-09-04 05:37:53 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2017-09-04 05:37:53 +0000
commitdd8b5337e9da480640598008de6211dab68c20dc (patch)
treeec1b623d8e47e3bd3d256a9ac494e3cbd3f2a3c1 /clang/lib/AST/Decl.cpp
parentebc165901682c0d9feb0c4490e5d9ffaee214983 (diff)
downloadbcm5719-llvm-dd8b5337e9da480640598008de6211dab68c20dc.tar.gz
bcm5719-llvm-dd8b5337e9da480640598008de6211dab68c20dc.zip
Implement Itanium name mangling support for C++ Modules TS.
This follows the scheme agreed with Nathan Sidwell, which can be found here: https://gcc.gnu.org/wiki/cxx-modules?action=AttachFile This will be proposed to the itanium-cxx-abi list once we have some experience with how well it works; the ABI for this TS should be considered unstable until it is part of the Itanium C++ ABI. llvm-svn: 312467
Diffstat (limited to 'clang/lib/AST/Decl.cpp')
-rw-r--r--clang/lib/AST/Decl.cpp26
1 files changed, 25 insertions, 1 deletions
diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp
index 2137075138f..0a4c4a4a776 100644
--- a/clang/lib/AST/Decl.cpp
+++ b/clang/lib/AST/Decl.cpp
@@ -652,7 +652,7 @@ LinkageComputer::getLVForNamespaceScopeDecl(const NamedDecl *D,
// If the declaration of an identifier for an object has file
// scope and no storage-class specifier, its linkage is
// external.
- LinkageInfo LV;
+ LinkageInfo LV = getExternalLinkageFor(D);
if (!hasExplicitVisibilityAlready(computation)) {
if (Optional<Visibility> Vis = getExplicitVisibility(D, computation)) {
@@ -1399,6 +1399,30 @@ LinkageInfo LinkageComputer::getDeclLinkageAndVisibility(const NamedDecl *D) {
return getLVForDecl(D, usesTypeVisibility(D) ? LVForType : LVForValue);
}
+Module *NamedDecl::getOwningModuleForLinkage() const {
+ Module *M = getOwningModule();
+ if (!M)
+ return nullptr;
+
+ switch (M->Kind) {
+ case Module::ModuleMapModule:
+ // Module map modules have no special linkage semantics.
+ return nullptr;
+
+ case Module::ModuleInterfaceUnit:
+ return M;
+
+ case Module::GlobalModuleFragment:
+ // External linkage declarations in the global module have no owning module
+ // for linkage purposes. But internal linkage declarations in the global
+ // module fragment of a particular module are owned by that module for
+ // linkage purposes.
+ return hasExternalFormalLinkage() ? nullptr : M->Parent;
+ }
+
+ llvm_unreachable("unknown module kind");
+}
+
void NamedDecl::printName(raw_ostream &os) const {
os << Name;
}
OpenPOWER on IntegriCloud