r224533 - ModuleBuilder: assert that all deferred inline method defs get handled

Hans Wennborg hans at hanshq.net
Thu Dec 18 11:19:01 PST 2014


Author: hans
Date: Thu Dec 18 13:19:00 2014
New Revision: 224533

URL: http://llvm.org/viewvc/llvm-project?rev=224533&view=rev
Log:
ModuleBuilder: assert that all deferred inline method defs get handled

While we're here, also move the declaration of DeferredInlineMethodDefinitions
closer to the other member vars and make it a SmallVector. NFC.

Modified:
    cfe/trunk/lib/CodeGen/ModuleBuilder.cpp

Modified: cfe/trunk/lib/CodeGen/ModuleBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/ModuleBuilder.cpp?rev=224533&r1=224532&r2=224533&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/ModuleBuilder.cpp (original)
+++ cfe/trunk/lib/CodeGen/ModuleBuilder.cpp Thu Dec 18 13:19:00 2014
@@ -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;
   };
 }
 





More information about the cfe-commits mailing list