Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion clang/include/clang/AST/ASTContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -814,7 +814,7 @@ class ASTContext : public RefCountedBase<ASTContext> {

llvm::StringRef backupStr(llvm::StringRef S) const {
char *Buf = new (*this) char[S.size()];
std::copy(S.begin(), S.end(), Buf);
llvm::copy(S, Buf);
return llvm::StringRef(Buf, S.size());
}

Expand Down
14 changes: 7 additions & 7 deletions clang/include/clang/AST/OpenMPClause.h
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ template <class T> class OMPDirectiveListClause : public OMPClause {
assert(
DK.size() == NumKinds &&
"Number of directive kinds is not the same as the preallocated buffer");
std::copy(DK.begin(), DK.end(), getDirectiveKinds().begin());
llvm::copy(DK, getDirectiveKinds().begin());
}

SourceLocation getLParenLoc() { return LParenLoc; }
Expand Down Expand Up @@ -5917,7 +5917,7 @@ class OMPMappableExprListClause : public OMPVarListClause<T>,
void setUniqueDecls(ArrayRef<ValueDecl *> UDs) {
assert(UDs.size() == NumUniqueDeclarations &&
"Unexpected amount of unique declarations.");
std::copy(UDs.begin(), UDs.end(), getUniqueDeclsRef().begin());
llvm::copy(UDs, getUniqueDeclsRef().begin());
}

/// Get the number of lists per declaration that are in the trailing
Expand All @@ -5939,7 +5939,7 @@ class OMPMappableExprListClause : public OMPVarListClause<T>,
void setDeclNumLists(ArrayRef<unsigned> DNLs) {
assert(DNLs.size() == NumUniqueDeclarations &&
"Unexpected amount of list numbers.");
std::copy(DNLs.begin(), DNLs.end(), getDeclNumListsRef().begin());
llvm::copy(DNLs, getDeclNumListsRef().begin());
}

/// Get the cumulative component lists sizes that are in the trailing
Expand All @@ -5965,7 +5965,7 @@ class OMPMappableExprListClause : public OMPVarListClause<T>,
void setComponentListSizes(ArrayRef<unsigned> CLSs) {
assert(CLSs.size() == NumComponentLists &&
"Unexpected amount of component lists.");
std::copy(CLSs.begin(), CLSs.end(), getComponentListSizesRef().begin());
llvm::copy(CLSs, getComponentListSizesRef().begin());
}

/// Get the components that are in the trailing objects of the class.
Expand All @@ -5989,7 +5989,7 @@ class OMPMappableExprListClause : public OMPVarListClause<T>,
"Unexpected amount of component lists.");
assert(CLSs.size() == NumComponentLists &&
"Unexpected amount of list sizes.");
std::copy(Components.begin(), Components.end(), getComponentsRef().begin());
llvm::copy(Components, getComponentsRef().begin());
}

/// Fill the clause information from the list of declarations and
Expand Down Expand Up @@ -6063,7 +6063,7 @@ class OMPMappableExprListClause : public OMPVarListClause<T>,
++CLSI;

// Append components after the current components iterator.
CI = std::copy(C.begin(), C.end(), CI);
CI = llvm::copy(C, CI);
}
}
}
Expand Down Expand Up @@ -6107,7 +6107,7 @@ class OMPMappableExprListClause : public OMPVarListClause<T>,
"Unexpected number of user-defined mappers.");
assert(SupportsMapper &&
"Must be a clause that is possible to have user-defined mappers");
std::copy(DMDs.begin(), DMDs.end(), getUDMapperRefs().begin());
llvm::copy(DMDs, getUDMapperRefs().begin());
}

public:
Expand Down
2 changes: 1 addition & 1 deletion clang/include/clang/AST/Stmt.h
Original file line number Diff line number Diff line change
Expand Up @@ -2214,7 +2214,7 @@ class AttributedStmt final
: ValueStmt(AttributedStmtClass), SubStmt(SubStmt) {
AttributedStmtBits.NumAttrs = Attrs.size();
AttributedStmtBits.AttrLoc = Loc;
std::copy(Attrs.begin(), Attrs.end(), getAttrArrayPtr());
llvm::copy(Attrs, getAttrArrayPtr());
}

explicit AttributedStmt(EmptyShell Empty, unsigned NumAttrs)
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/AST/ASTImporter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4123,7 +4123,7 @@ ExpectedDecl ASTNodeImporter::VisitFunctionDecl(FunctionDecl *D) {
return std::move(Err);
auto **Memory =
new (Importer.getToContext()) CXXCtorInitializer *[NumInitializers];
std::copy(CtorInitializers.begin(), CtorInitializers.end(), Memory);
llvm::copy(CtorInitializers, Memory);
auto *ToCtor = cast<CXXConstructorDecl>(ToFunction);
ToCtor->setCtorInitializers(Memory);
ToCtor->setNumCtorInitializers(NumInitializers);
Expand Down
23 changes: 11 additions & 12 deletions clang/lib/AST/Decl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2110,7 +2110,7 @@ void QualifierInfo::setTemplateParameterListsInfo(
if (!TPLists.empty()) {
TemplParamLists = new (Context) TemplateParameterList *[TPLists.size()];
NumTemplParamLists = TPLists.size();
std::copy(TPLists.begin(), TPLists.end(), TemplParamLists);
llvm::copy(TPLists, TemplParamLists);
}
}

Expand Down Expand Up @@ -3753,7 +3753,7 @@ void FunctionDecl::setParams(ASTContext &C,
// Zero params -> null pointer.
if (!NewParamInfo.empty()) {
ParamInfo = new (C) ParmVarDecl*[NewParamInfo.size()];
std::copy(NewParamInfo.begin(), NewParamInfo.end(), ParamInfo);
llvm::copy(NewParamInfo, ParamInfo);
}
}

Expand Down Expand Up @@ -5322,7 +5322,7 @@ void BlockDecl::setParams(ArrayRef<ParmVarDecl *> NewParamInfo) {
if (!NewParamInfo.empty()) {
NumParams = NewParamInfo.size();
ParamInfo = new (getASTContext()) ParmVarDecl*[NewParamInfo.size()];
std::copy(NewParamInfo.begin(), NewParamInfo.end(), ParamInfo);
llvm::copy(NewParamInfo, ParamInfo);
}
}

Expand Down Expand Up @@ -5379,7 +5379,7 @@ PragmaCommentDecl *PragmaCommentDecl::Create(const ASTContext &C,
PragmaCommentDecl *PCD =
new (C, DC, additionalSizeToAlloc<char>(Arg.size() + 1))
PragmaCommentDecl(DC, CommentLoc, CommentKind);
memcpy(PCD->getTrailingObjects(), Arg.data(), Arg.size());
llvm::copy(Arg, PCD->getTrailingObjects());
PCD->getTrailingObjects()[Arg.size()] = '\0';
return PCD;
}
Expand All @@ -5401,9 +5401,9 @@ PragmaDetectMismatchDecl::Create(const ASTContext &C, TranslationUnitDecl *DC,
PragmaDetectMismatchDecl *PDMD =
new (C, DC, additionalSizeToAlloc<char>(ValueStart + Value.size() + 1))
PragmaDetectMismatchDecl(DC, Loc, ValueStart);
memcpy(PDMD->getTrailingObjects(), Name.data(), Name.size());
llvm::copy(Name, PDMD->getTrailingObjects());
PDMD->getTrailingObjects()[Name.size()] = '\0';
memcpy(PDMD->getTrailingObjects() + ValueStart, Value.data(), Value.size());
llvm::copy(Value, PDMD->getTrailingObjects() + ValueStart);
PDMD->getTrailingObjects()[ValueStart + Value.size()] = '\0';
return PDMD;
}
Expand Down Expand Up @@ -5443,9 +5443,9 @@ LabelDecl *LabelDecl::CreateDeserialized(ASTContext &C, GlobalDeclID ID) {

void LabelDecl::setMSAsmLabel(StringRef Name) {
char *Buffer = new (getASTContext(), 1) char[Name.size() + 1];
memcpy(Buffer, Name.data(), Name.size());
Buffer[Name.size()] = '\0';
MSAsmName = Buffer;
llvm::copy(Name, Buffer);
Buffer[Name.size()] = '\0';
MSAsmName = Buffer;
}

void ValueDecl::anchor() {}
Expand Down Expand Up @@ -5828,7 +5828,7 @@ void HLSLBufferDecl::setDefaultBufferDecls(ArrayRef<Decl *> Decls) {

// allocate array for default decls with ASTContext allocator
Decl **DeclsArray = new (getASTContext()) Decl *[Decls.size()];
std::copy(Decls.begin(), Decls.end(), DeclsArray);
llvm::copy(Decls, DeclsArray);
DefaultBufferDecls = ArrayRef<Decl *>(DeclsArray, Decls.size());
}

Expand Down Expand Up @@ -5869,8 +5869,7 @@ HLSLRootSignatureDecl *HLSLRootSignatureDecl::Create(
RootElements.size()))
HLSLRootSignatureDecl(DC, Loc, ID, RootElements.size());
auto *StoredElems = RSDecl->getElems();
std::uninitialized_copy(RootElements.begin(), RootElements.end(),
StoredElems);
llvm::uninitialized_copy(RootElements, StoredElems);
return RSDecl;
}

Expand Down
2 changes: 1 addition & 1 deletion clang/lib/AST/DeclObjC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1512,7 +1512,7 @@ ObjCTypeParamList::ObjCTypeParamList(SourceLocation lAngleLoc,
ArrayRef<ObjCTypeParamDecl *> typeParams,
SourceLocation rAngleLoc)
: Brackets(lAngleLoc, rAngleLoc), NumParams(typeParams.size()) {
std::copy(typeParams.begin(), typeParams.end(), begin());
llvm::copy(typeParams, begin());
}

ObjCTypeParamList *ObjCTypeParamList::create(
Expand Down
17 changes: 6 additions & 11 deletions clang/lib/AST/ExprCXX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,9 +261,8 @@ CXXNewExpr::CXXNewExpr(bool IsGlobalNew, FunctionDecl *OperatorNew,
getTrailingObjects<Stmt *>()[arraySizeOffset()] = *ArraySize;
if (Initializer)
getTrailingObjects<Stmt *>()[initExprOffset()] = Initializer;
for (unsigned I = 0; I != PlacementArgs.size(); ++I)
getTrailingObjects<Stmt *>()[placementNewArgsOffset() + I] =
PlacementArgs[I];
llvm::copy(PlacementArgs,
getTrailingObjects<Stmt *>() + placementNewArgsOffset());
if (IsParenTypeId)
getTrailingObjects<SourceRange>()[0] = TypeIdParens;

Expand Down Expand Up @@ -1208,10 +1207,8 @@ CXXConstructExpr::CXXConstructExpr(
CXXConstructExprBits.Loc = Loc;

Stmt **TrailingArgs = getTrailingArgs();
for (unsigned I = 0, N = Args.size(); I != N; ++I) {
assert(Args[I] && "NULL argument in CXXConstructExpr!");
TrailingArgs[I] = Args[I];
}
llvm::copy(Args, TrailingArgs);
assert(llvm::all_of(Args, [](const Stmt *Arg) { return Arg != nullptr; }));

// CXXTemporaryObjectExpr does this itself after setting its TypeSourceInfo.
if (SC == CXXConstructExprClass)
Expand Down Expand Up @@ -1472,8 +1469,7 @@ CXXUnresolvedConstructExpr::CXXUnresolvedConstructExpr(
RParenLoc(RParenLoc) {
CXXUnresolvedConstructExprBits.NumArgs = Args.size();
auto **StoredArgs = getTrailingObjects();
for (unsigned I = 0; I != Args.size(); ++I)
StoredArgs[I] = Args[I];
llvm::copy(Args, StoredArgs);
setDependence(computeDependence(this));
}

Expand Down Expand Up @@ -1885,8 +1881,7 @@ TypeTraitExpr::TypeTraitExpr(QualType T, SourceLocation Loc, TypeTrait Kind,
assert(Args.size() == TypeTraitExprBits.NumArgs &&
"TypeTraitExprBits.NumArgs overflow!");
auto **ToArgs = getTrailingObjects<TypeSourceInfo *>();
for (unsigned I = 0, N = Args.size(); I != N; ++I)
ToArgs[I] = Args[I];
llvm::copy(Args, ToArgs);

setDependence(computeDependence(this));

Expand Down
6 changes: 2 additions & 4 deletions clang/lib/AST/ExprConcepts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,8 @@ RequiresExpr::RequiresExpr(ASTContext &C, SourceLocation RequiresKWLoc,
if (RequirementContainsError(R))
setDependence(getDependence() | ExprDependence::Error);
}
std::copy(LocalParameters.begin(), LocalParameters.end(),
getTrailingObjects<ParmVarDecl *>());
std::copy(Requirements.begin(), Requirements.end(),
getTrailingObjects<concepts::Requirement *>());
llvm::copy(LocalParameters, getTrailingObjects<ParmVarDecl *>());
llvm::copy(Requirements, getTrailingObjects<concepts::Requirement *>());
RequiresExprBits.IsSatisfied |= Dependent;
// FIXME: move the computing dependency logic to ComputeDependence.h
if (ContainsUnexpandedParameterPack)
Expand Down
6 changes: 2 additions & 4 deletions clang/lib/AST/ExprObjC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,8 @@ void ObjCMessageExpr::initArgsAndSelLocs(ArrayRef<Expr *> Args,
MyArgs[I] = Args[I];

SelLocsKind = SelLocsK;
if (!isImplicit()) {
if (SelLocsK == SelLoc_NonStandard)
std::copy(SelLocs.begin(), SelLocs.end(), getStoredSelLocs());
}
if (!isImplicit() && SelLocsK == SelLoc_NonStandard)
llvm::copy(SelLocs, getStoredSelLocs());
}

ObjCMessageExpr *
Expand Down
Loading
Loading