]> granicus.if.org Git - clang/commitdiff
ModuleBuilder: assert that all deferred inline method defs get handled
authorHans Wennborg <hans@hanshq.net>
Thu, 18 Dec 2014 19:19:00 +0000 (19:19 +0000)
committerHans Wennborg <hans@hanshq.net>
Thu, 18 Dec 2014 19:19:00 +0000 (19:19 +0000)
While we're here, also move the declaration of DeferredInlineMethodDefinitions
closer to the other member vars and make it a SmallVector. NFC.

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

lib/CodeGen/ModuleBuilder.cpp

index ee6f6f94c715816062568672bb316baac7dca520..bf89a2f0325987b88321a0ca2d62abe15ea336cb 100644 (file)
@@ -52,6 +52,9 @@ namespace {
     std::unique_ptr<llvm::Module> M;
     std::unique_ptr<CodeGen::CodeGenModule> Builder;
 
+  private:
+    SmallVector<CXXMethodDecl *, 8> DeferredInlineMethodDefinitions;
+
   public:
     CodeGeneratorImpl(DiagnosticsEngine &diags, const std::string& ModuleName,
                       const CodeGenOptions &CGO, llvm::LLVMContext& C,
@@ -60,7 +63,10 @@ namespace {
         CoverageInfo(CoverageInfo),
         M(new llvm::Module(ModuleName, C)) {}
 
-    virtual ~CodeGeneratorImpl() {}
+    virtual ~CodeGeneratorImpl() {
+      assert(DeferredInlineMethodDefinitions.empty() &&
+             "Leftover inline method definitions!");
+    }
 
     llvm::Module* GetModule() override {
       return M.get();
@@ -223,9 +229,6 @@ namespace {
     void HandleDependentLibrary(llvm::StringRef Lib) override {
       Builder->AddDependentLib(Lib);
     }
-
-  private:
-    std::vector<CXXMethodDecl *> DeferredInlineMethodDefinitions;
   };
 }