]> granicus.if.org Git - clang/commitdiff
Add a public accessor for GlobalCtors in CodeGenModule
authorKeno Fischer <kfischer@college.harvard.edu>
Tue, 30 Dec 2014 08:12:39 +0000 (08:12 +0000)
committerKeno Fischer <kfischer@college.harvard.edu>
Tue, 30 Dec 2014 08:12:39 +0000 (08:12 +0000)
Summary:
In a JIT context it is useful to be able to access the GlobalCtors
and especially clear them once they have been emitted and called.
This adds a public method to be able to access the list.

Subscribers: yaron.keren, cfe-commits

Differential Revision: http://reviews.llvm.org/D6790

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@224982 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CodeGenModule.h

index 0dff5fe94c8ba3e819fd58b2df5089023d89abd1..619356a70a4cfa4a0a7729b0581f1467249510e1 100644 (file)
@@ -261,6 +261,7 @@ class CodeGenModule : public CodeGenTypeCache {
   CodeGenModule(const CodeGenModule &) LLVM_DELETED_FUNCTION;
   void operator=(const CodeGenModule &) LLVM_DELETED_FUNCTION;
 
+public:
   struct Structor {
     Structor() : Priority(0), Initializer(nullptr), AssociatedData(nullptr) {}
     Structor(int Priority, llvm::Constant *Initializer,
@@ -274,6 +275,7 @@ class CodeGenModule : public CodeGenTypeCache {
 
   typedef std::vector<Structor> CtorList;
 
+private:
   ASTContext &Context;
   const LangOptions &LangOpts;
   const CodeGenOptions &CodeGenOpts;
@@ -624,6 +626,9 @@ public:
     return VTables.getMicrosoftVTableContext();
   }
 
+  CtorList &getGlobalCtors() { return GlobalCtors; }
+  CtorList &getGlobalDtors() { return GlobalDtors; }
+
   llvm::MDNode *getTBAAInfo(QualType QTy);
   llvm::MDNode *getTBAAInfoForVTablePtr();
   llvm::MDNode *getTBAAStructInfo(QualType QTy);