[clang] 5d98d88 - [Sema] Avoid unnecessary copy on MultiLevelTemplateArgumentList. NFC (#84459)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 8 04:26:35 PST 2024
Author: Younan Zhang
Date: 2024-03-08T20:26:31+08:00
New Revision: 5d98d8822c69bc9d32c25190beaf1eaccf9ddd37
URL: https://github.com/llvm/llvm-project/commit/5d98d8822c69bc9d32c25190beaf1eaccf9ddd37
DIFF: https://github.com/llvm/llvm-project/commit/5d98d8822c69bc9d32c25190beaf1eaccf9ddd37.diff
LOG: [Sema] Avoid unnecessary copy on MultiLevelTemplateArgumentList. NFC (#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.
Added:
Modified:
clang/include/clang/Sema/Sema.h
clang/lib/Sema/SemaConcept.cpp
Removed:
################################################################################
diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h
index 592c7871a4a55d..2cac7e6ca08fad 100644
--- a/clang/include/clang/Sema/Sema.h
+++ b/clang/include/clang/Sema/Sema.h
@@ -11607,12 +11607,14 @@ class Sema final {
LocalInstantiationScope &Scope,
const MultiLevelTemplateArgumentList &TemplateArgs);
- /// used by SetupConstraintCheckingTemplateArgumentsAndScope to recursively(in
+ /// Used by SetupConstraintCheckingTemplateArgumentsAndScope to recursively(in
/// the case of lambdas) set up the LocalInstantiationScope of the current
/// function.
- bool SetupConstraintScope(
- FunctionDecl *FD, std::optional<ArrayRef<TemplateArgument>> TemplateArgs,
- MultiLevelTemplateArgumentList MLTAL, LocalInstantiationScope &Scope);
+ bool
+ SetupConstraintScope(FunctionDecl *FD,
+ std::optional<ArrayRef<TemplateArgument>> TemplateArgs,
+ const MultiLevelTemplateArgumentList &MLTAL,
+ LocalInstantiationScope &Scope);
/// Used during constraint checking, sets up the constraint template argument
/// lists, and calls SetupConstraintScope to set up the
diff --git a/clang/lib/Sema/SemaConcept.cpp b/clang/lib/Sema/SemaConcept.cpp
index 2878e4d31ee8fe..a8e387e35fb4c9 100644
--- a/clang/lib/Sema/SemaConcept.cpp
+++ b/clang/lib/Sema/SemaConcept.cpp
@@ -586,7 +586,8 @@ bool Sema::addInstantiatedCapturesToScope(
bool Sema::SetupConstraintScope(
FunctionDecl *FD, std::optional<ArrayRef<TemplateArgument>> TemplateArgs,
- MultiLevelTemplateArgumentList MLTAL, LocalInstantiationScope &Scope) {
+ const MultiLevelTemplateArgumentList &MLTAL,
+ LocalInstantiationScope &Scope) {
if (FD->isTemplateInstantiation() && FD->getPrimaryTemplate()) {
FunctionTemplateDecl *PrimaryTemplate = FD->getPrimaryTemplate();
InstantiatingTemplate Inst(
More information about the cfe-commits
mailing list