diff options
author | James Y Knight <jyknight@google.com> | 2019-02-07 01:14:17 +0000 |
---|---|---|
committer | James Y Knight <jyknight@google.com> | 2019-02-07 01:14:17 +0000 |
commit | f7321540d518b2a428ac78ba34900cd437626246 (patch) | |
tree | ca5adc7a3d30cde17b961f037fed973413a2a3d6 /clang/lib/CodeGen/CodeGenModule.h | |
parent | 18f0bd78e2ced601496f7b4f573ee743c9030281 (diff) | |
download | bcm5719-llvm-f7321540d518b2a428ac78ba34900cd437626246.tar.gz bcm5719-llvm-f7321540d518b2a428ac78ba34900cd437626246.zip |
[opaque pointer types] Pass through function types for TLS
initialization and global destructor calls.
Differential Revision: https://reviews.llvm.org/D57801
llvm-svn: 353355
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.h')
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.h | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.h b/clang/lib/CodeGen/CodeGenModule.h index 78858e2ee98..4139a0e0313 100644 --- a/clang/lib/CodeGen/CodeGenModule.h +++ b/clang/lib/CodeGen/CodeGenModule.h @@ -451,7 +451,9 @@ private: SmallVector<GlobalInitData, 8> PrioritizedCXXGlobalInits; /// Global destructor functions and arguments that need to run on termination. - std::vector<std::pair<llvm::WeakTrackingVH, llvm::Constant *>> CXXGlobalDtors; + std::vector< + std::tuple<llvm::FunctionType *, llvm::WeakTrackingVH, llvm::Constant *>> + CXXGlobalDtors; /// The complete set of modules that has been imported. llvm::SetVector<clang::Module *> ImportedModules; @@ -958,7 +960,18 @@ public: const CGFunctionInfo *FnInfo = nullptr, llvm::FunctionType *FnType = nullptr, bool DontDefer = false, - ForDefinition_t IsForDefinition = NotForDefinition); + ForDefinition_t IsForDefinition = NotForDefinition) { + return cast<llvm::Constant>(getAddrAndTypeOfCXXStructor(MD, Type, FnInfo, + FnType, DontDefer, + IsForDefinition) + .getCallee()); + } + + llvm::FunctionCallee getAddrAndTypeOfCXXStructor( + const CXXMethodDecl *MD, StructorType Type, + const CGFunctionInfo *FnInfo = nullptr, + llvm::FunctionType *FnType = nullptr, bool DontDefer = false, + ForDefinition_t IsForDefinition = NotForDefinition); /// Given a builtin id for a function like "__builtin_fabsf", return a /// Function* for "fabsf". @@ -998,8 +1011,9 @@ public: void addCompilerUsedGlobal(llvm::GlobalValue *GV); /// Add a destructor and object to add to the C++ global destructor function. - void AddCXXDtorEntry(llvm::Constant *DtorFn, llvm::Constant *Object) { - CXXGlobalDtors.emplace_back(DtorFn, Object); + void AddCXXDtorEntry(llvm::FunctionCallee DtorFn, llvm::Constant *Object) { + CXXGlobalDtors.emplace_back(DtorFn.getFunctionType(), DtorFn.getCallee(), + Object); } /// Create or return a runtime function declaration with the specified type |