diff options
author | Hans Wennborg <hans@hanshq.net> | 2015-01-10 01:19:48 +0000 |
---|---|---|
committer | Hans Wennborg <hans@hanshq.net> | 2015-01-10 01:19:48 +0000 |
commit | 43a0f99b103dc9c2546e650b99f5501e49e74dd2 (patch) | |
tree | 684a9d97c788f0d4ac39151128de445cd17530c4 /clang/lib/CodeGen/CodeGenModule.h | |
parent | 7c8a7251162d7e5db51e3ff7350a186fc749cee6 (diff) | |
download | bcm5719-llvm-43a0f99b103dc9c2546e650b99f5501e49e74dd2.tar.gz bcm5719-llvm-43a0f99b103dc9c2546e650b99f5501e49e74dd2.zip |
Don't emit implicit template instantiations eagerly (PR21718)
Their linkage can change if they are later explicitly instantiated. We would
previously emit such functions eagerly (as opposed to lazily on first use) if
they have a 'dllexport' or 'used' attribute, and fail an assert when hitting the
explicit instantiation.
This is achieved by replacing the old CodeGenModule::MayDeferGeneration() method
with two new ones: MustBeEmitted() and MayBeEmittedEagerly().
Differential Revision: http://reviews.llvm.org/D6674
llvm-svn: 225570
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.h')
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.h | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.h b/clang/lib/CodeGen/CodeGenModule.h index 619356a70a4..54f3a82feb2 100644 --- a/clang/lib/CodeGen/CodeGenModule.h +++ b/clang/lib/CodeGen/CodeGenModule.h @@ -1200,9 +1200,15 @@ private: /// Emits the initializer for a uuidof string. llvm::Constant *EmitUuidofInitializer(StringRef uuidstr); - /// Determine if the given decl can be emitted lazily; this is only relevant - /// for definitions. The given decl must be either a function or var decl. - bool MayDeferGeneration(const ValueDecl *D); + /// Determine whether the definition must be emitted; if this returns \c + /// false, the definition can be emitted lazily if it's used. + bool MustBeEmitted(const ValueDecl *D); + + /// Determine whether the definition can be emitted eagerly, or should be + /// delayed until the end of the translation unit. This is relevant for + /// definitions whose linkage can change, e.g. implicit function instantions + /// which may later be explicitly instantiated. + bool MayBeEmittedEagerly(const ValueDecl *D); /// Check whether we can use a "simpler", more core exceptions personality /// function. |