Просмотр исходного кода

Re-introduce the unique_ptr removed in r249328 and just make
~CodeGenABITypes out-of-line, which should have the same effect.

Thanks to David Blaikie for pointing this out!

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

Adrian Prantl 10 лет назад
Родитель
Сommit
b55480d638
2 измененных файлов с 4 добавлено и 5 удалено
  1. 1 1
      include/clang/CodeGen/CodeGenABITypes.h
  2. 3 4
      lib/CodeGen/CodeGenABITypes.cpp

+ 1 - 1
include/clang/CodeGen/CodeGenABITypes.h

@@ -80,7 +80,7 @@ private:
   std::unique_ptr<PreprocessorOptions> PPO;
 
   /// The CodeGenModule we use get to the CodeGenTypes object.
-  CodeGen::CodeGenModule *CGM;
+  std::unique_ptr<CodeGen::CodeGenModule> CGM;
 };
 
 }  // end namespace CodeGen

+ 3 - 4
lib/CodeGen/CodeGenABITypes.cpp

@@ -33,10 +33,9 @@ CodeGenABITypes::CodeGenABITypes(ASTContext &C, llvm::Module &M,
       CGM(new CodeGen::CodeGenModule(C, *HSO, *PPO, *CGO, M, C.getDiagnostics(),
                                      CoverageInfo)) {}
 
-CodeGenABITypes::~CodeGenABITypes()
-{
-  delete CGM;
-}
+// Explicitly out-of-line because ~CodeGenModule() is private but
+// CodeGenABITypes.h is part of clang's API.
+CodeGenABITypes::~CodeGenABITypes() = default;
 
 const CGFunctionInfo &
 CodeGenABITypes::arrangeObjCMessageSendSignature(const ObjCMethodDecl *MD,