[clang] c0f210d - Don't stash types that aren't copyable or moveable into a SmallVector
Benjamin Kramer via cfe-commits
cfe-commits at lists.llvm.org
Sat May 2 10:46:54 PDT 2020
Author: Benjamin Kramer
Date: 2020-05-02T19:13:06+02:00
New Revision: c0f210d636300abe891cf7e5f07d13f5f4c0102e
URL: https://github.com/llvm/llvm-project/commit/c0f210d636300abe891cf7e5f07d13f5f4c0102e
DIFF: https://github.com/llvm/llvm-project/commit/c0f210d636300abe891cf7e5f07d13f5f4c0102e.diff
LOG: Don't stash types that aren't copyable or moveable into a SmallVector
This seems to be working by accident.
Added:
Modified:
clang/lib/Sema/SemaExprCXX.cpp
llvm/tools/llvm-exegesis/lib/SnippetGenerator.h
Removed:
################################################################################
diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp
index 79f21515a8ee..7cda60ba7598 100644
--- a/clang/lib/Sema/SemaExprCXX.cpp
+++ b/clang/lib/Sema/SemaExprCXX.cpp
@@ -5121,20 +5121,19 @@ static bool evaluateTypeTrait(Sema &S, TypeTrait Kind, SourceLocation KWLoc,
if (RD && RD->isAbstract())
return false;
- SmallVector<OpaqueValueExpr, 2> OpaqueArgExprs;
+ llvm::BumpPtrAllocator OpaqueExprAllocator;
SmallVector<Expr *, 2> ArgExprs;
ArgExprs.reserve(Args.size() - 1);
for (unsigned I = 1, N = Args.size(); I != N; ++I) {
QualType ArgTy = Args[I]->getType();
if (ArgTy->isObjectType() || ArgTy->isFunctionType())
ArgTy = S.Context.getRValueReferenceType(ArgTy);
- OpaqueArgExprs.push_back(
- OpaqueValueExpr(Args[I]->getTypeLoc().getBeginLoc(),
- ArgTy.getNonLValueExprType(S.Context),
- Expr::getValueKindForType(ArgTy)));
+ ArgExprs.push_back(
+ new (OpaqueExprAllocator.Allocate<OpaqueValueExpr>())
+ OpaqueValueExpr(Args[I]->getTypeLoc().getBeginLoc(),
+ ArgTy.getNonLValueExprType(S.Context),
+ Expr::getValueKindForType(ArgTy)));
}
- for (Expr &E : OpaqueArgExprs)
- ArgExprs.push_back(&E);
// Perform the initialization in an unevaluated context within a SFINAE
// trap at translation unit scope.
diff --git a/llvm/tools/llvm-exegesis/lib/SnippetGenerator.h b/llvm/tools/llvm-exegesis/lib/SnippetGenerator.h
index 19a1ed0c401e..5f67b396ad95 100644
--- a/llvm/tools/llvm-exegesis/lib/SnippetGenerator.h
+++ b/llvm/tools/llvm-exegesis/lib/SnippetGenerator.h
@@ -145,13 +145,6 @@ class CombinationGenerator {
assert(!Range.empty() && "The range must not be empty.");
rewind();
}
-
- // Only allow using our custom constructor.
- WrappingIterator() = delete;
- WrappingIterator(const WrappingIterator &) = delete;
- WrappingIterator(WrappingIterator &&) = delete;
- WrappingIterator &operator=(const WrappingIterator &) = delete;
- WrappingIterator &operator=(WrappingIterator &&) = delete;
};
const ArrayRef<choices_storage_type> VariablesChoices;
More information about the cfe-commits
mailing list