SmallVector<StoredDiagnostic, 8> Diagnostics;
/// Allocated API-exposed wrappters for Diagnostics.
- SmallVector<CXStoredDiagnostic *, 8> DiagnosticsWrappers;
+ SmallVector<std::unique_ptr<CXStoredDiagnostic>, 8> DiagnosticsWrappers;
IntrusiveRefCntPtr<DiagnosticOptions> DiagOpts;
}
AllocatedCXCodeCompleteResults::~AllocatedCXCodeCompleteResults() {
- llvm::DeleteContainerPointers(DiagnosticsWrappers);
delete [] Results;
for (unsigned I = 0, N = TemporaryBuffers.size(); I != N; ++I)
if (!Results || Index >= Results->Diagnostics.size())
return nullptr;
- CXStoredDiagnostic *Diag = Results->DiagnosticsWrappers[Index];
+ CXStoredDiagnostic *Diag = Results->DiagnosticsWrappers[Index].get();
if (!Diag)
- Results->DiagnosticsWrappers[Index] = Diag =
- new CXStoredDiagnostic(Results->Diagnostics[Index], Results->LangOpts);
+ Diag = (Results->DiagnosticsWrappers[Index] =
+ std::make_unique<CXStoredDiagnostic>(
+ Results->Diagnostics[Index], Results->LangOpts))
+ .get();
return Diag;
}