[OpenMP][NFC] Minimize memory usage and copying of `OMPTraitInfo`s
See rational here: https://reviews.llvm.org/D71830#1922656
Reviewed By: rnk
Differential Revision: https://reviews.llvm.org/D76173
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index 77d5e59..390abda 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -1005,6 +1005,9 @@
for (APValue *Value : APValueCleanups)
Value->~APValue();
+
+ // Destroy the OMPTraitInfo objects that life here.
+ llvm::DeleteContainerPointers(OMPTraitInfoVector);
}
void ASTContext::setTraversalScope(const std::vector<Decl *> &TopLevelDecls) {
@@ -10838,3 +10841,8 @@
Target->getTargetOpts().Features);
}
}
+
+OMPTraitInfo &ASTContext::getNewOMPTraitInfo() {
+ OMPTraitInfoVector.push_back(new OMPTraitInfo());
+ return *OMPTraitInfoVector.back();
+}