Skip to content

Commit 5d98d88

Browse files
authored
[Sema] Avoid unnecessary copy on MultiLevelTemplateArgumentList. NFC (llvm#84459)
We don't modify the MLTAL parameter in `SetupConstraintScope`, and it is better if we don't copy the 120-byte object each time we call the function.
1 parent bd6eb54 commit 5d98d88

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

clang/include/clang/Sema/Sema.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11607,12 +11607,14 @@ class Sema final {
1160711607
LocalInstantiationScope &Scope,
1160811608
const MultiLevelTemplateArgumentList &TemplateArgs);
1160911609

11610-
/// used by SetupConstraintCheckingTemplateArgumentsAndScope to recursively(in
11610+
/// Used by SetupConstraintCheckingTemplateArgumentsAndScope to recursively(in
1161111611
/// the case of lambdas) set up the LocalInstantiationScope of the current
1161211612
/// function.
11613-
bool SetupConstraintScope(
11614-
FunctionDecl *FD, std::optional<ArrayRef<TemplateArgument>> TemplateArgs,
11615-
MultiLevelTemplateArgumentList MLTAL, LocalInstantiationScope &Scope);
11613+
bool
11614+
SetupConstraintScope(FunctionDecl *FD,
11615+
std::optional<ArrayRef<TemplateArgument>> TemplateArgs,
11616+
const MultiLevelTemplateArgumentList &MLTAL,
11617+
LocalInstantiationScope &Scope);
1161611618

1161711619
/// Used during constraint checking, sets up the constraint template argument
1161811620
/// lists, and calls SetupConstraintScope to set up the

clang/lib/Sema/SemaConcept.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,8 @@ bool Sema::addInstantiatedCapturesToScope(
586586

587587
bool Sema::SetupConstraintScope(
588588
FunctionDecl *FD, std::optional<ArrayRef<TemplateArgument>> TemplateArgs,
589-
MultiLevelTemplateArgumentList MLTAL, LocalInstantiationScope &Scope) {
589+
const MultiLevelTemplateArgumentList &MLTAL,
590+
LocalInstantiationScope &Scope) {
590591
if (FD->isTemplateInstantiation() && FD->getPrimaryTemplate()) {
591592
FunctionTemplateDecl *PrimaryTemplate = FD->getPrimaryTemplate();
592593
InstantiatingTemplate Inst(

0 commit comments

Comments
 (0)