summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2016-06-28 19:03:57 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2016-06-28 19:03:57 +0000
commit5179eb78210a2ad01a18c37b75048ccfe78414ac (patch)
tree194b7981ca2f1dc43a513f016c1374bf1b31aabb /clang/lib/CodeGen/CodeGenModule.cpp
parenta5c7adcb38e89cd23ed3cbbc813d2da2546a9161 (diff)
downloadbcm5719-llvm-5179eb78210a2ad01a18c37b75048ccfe78414ac.tar.gz
bcm5719-llvm-5179eb78210a2ad01a18c37b75048ccfe78414ac.zip
P0136R1, DR1573, DR1645, DR1715, DR1736, DR1903, DR1941, DR1959, DR1991:
Replace inheriting constructors implementation with new approach, voted into C++ last year as a DR against C++11. Instead of synthesizing a set of derived class constructors for each inherited base class constructor, we make the constructors of the base class visible to constructor lookup in the derived class, using the normal rules for using-declarations. For constructors, UsingShadowDecl now has a ConstructorUsingShadowDecl derived class that tracks the requisite additional information. We create shadow constructors (not found by name lookup) in the derived class to model the actual initialization, and have a new expression node, CXXInheritedCtorInitExpr, to model the initialization of a base class from such a constructor. (This initialization is special because it performs real perfect forwarding of arguments.) In cases where argument forwarding is not possible (for inalloca calls, variadic calls, and calls with callee parameter cleanup), the shadow inheriting constructor is not emitted and instead we directly emit the initialization code into the caller of the inherited constructor. Note that this new model is not perfectly compatible with the old model in some corner cases. In particular: * if B inherits a private constructor from A, and C uses that constructor to construct a B, then we previously required that A befriends B and B befriends C, but the new rules require A to befriend C directly, and * if a derived class has its own constructors (and so its implicit default constructor is suppressed), it may still inherit a default constructor from a base class llvm-svn: 274049
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index ac00bf85cd3..bbec03842cb 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -765,6 +765,15 @@ CodeGenModule::getFunctionLinkage(GlobalDecl GD) {
: llvm::GlobalValue::LinkOnceODRLinkage;
}
+ if (isa<CXXConstructorDecl>(D) &&
+ cast<CXXConstructorDecl>(D)->isInheritingConstructor() &&
+ Context.getTargetInfo().getCXXABI().isMicrosoft()) {
+ // Our approach to inheriting constructors is fundamentally different from
+ // that used by the MS ABI, so keep our inheriting constructor thunks
+ // internal rather than trying to pick an unambiguous mangling for them.
+ return llvm::GlobalValue::InternalLinkage;
+ }
+
return getLLVMLinkageForDeclarator(D, Linkage, /*isConstantVariable=*/false);
}
OpenPOWER on IntegriCloud