diff --git a/clang/include/clang/AST/ASTContext.h b/clang/include/clang/AST/ASTContext.h index 82b8a51b9551d4..cd7021a5884beb 100644 --- a/clang/include/clang/AST/ASTContext.h +++ b/clang/include/clang/AST/ASTContext.h @@ -3002,7 +3002,7 @@ OPT_LIST(V) private: /// All OMPTraitInfo objects live in this collection, one per /// `pragma omp [begin] declare variant` directive. - SmallVector OMPTraitInfoVector; + SmallVector, 4> OMPTraitInfoVector; }; /// Utility function for constructing a nullary selector. diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index 9b07a883234bde..612f6eec2d0f98 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -1006,9 +1006,6 @@ ASTContext::~ASTContext() { for (APValue *Value : APValueCleanups) Value->~APValue(); - - // Destroy the OMPTraitInfo objects that life here. - llvm::DeleteContainerPointers(OMPTraitInfoVector); } void ASTContext::setTraversalScope(const std::vector &TopLevelDecls) { @@ -11011,6 +11008,6 @@ void ASTContext::getFunctionFeatureMap(llvm::StringMap &FeatureMap, } OMPTraitInfo &ASTContext::getNewOMPTraitInfo() { - OMPTraitInfoVector.push_back(new OMPTraitInfo()); + OMPTraitInfoVector.emplace_back(new OMPTraitInfo()); return *OMPTraitInfoVector.back(); }