[llvm-branch-commits] [clang] f9a2fba - [NFC][Concepts] Change the Source Range of Concepts ParamMatching
Tobias Hieta via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Thu Feb 2 00:07:13 PST 2023
Author: Erich Keane
Date: 2023-02-02T09:06:54+01:00
New Revision: f9a2fba812febc368bcff441604d9fe9d9988d6d
URL: https://github.com/llvm/llvm-project/commit/f9a2fba812febc368bcff441604d9fe9d9988d6d
DIFF: https://github.com/llvm/llvm-project/commit/f9a2fba812febc368bcff441604d9fe9d9988d6d.diff
LOG: [NFC][Concepts] Change the Source Range of Concepts ParamMatching
As came up in the discussion on
https://reviews.llvm.org/rG12cb1cb3720de8d164196010123ce1a8901d8122
We were asserting because the attempt to print a note found that our
source range for a immediately declared constraint (as a part of
Parameter Mapping Substitution) wasn't in order.
However, it doesn't really make sense to have the location of this be
the whole list of template arguments, as that would result in the range
being:
bool func(std::thing<char*> auto foo) {}
^^^^^^^^^^^^^^^
Even if done correctly. Instead, this patch makes the range be just
'foo' in this case (or a pointer right after 'auto' if unnamed).
(cherry picked from commit 42e371b174d4407ec5805010c2ecfef9c086b5c2)
Added:
Modified:
clang/lib/Sema/SemaConcept.cpp
Removed:
################################################################################
diff --git a/clang/lib/Sema/SemaConcept.cpp b/clang/lib/Sema/SemaConcept.cpp
index 86e63f88378c7..a92bbde113fcd 100644
--- a/clang/lib/Sema/SemaConcept.cpp
+++ b/clang/lib/Sema/SemaConcept.cpp
@@ -1142,8 +1142,7 @@ substituteParameterMappings(Sema &S, NormalizedConstraint &N,
Sema::InstantiatingTemplate Inst(
S, ArgsAsWritten->arguments().front().getSourceRange().getBegin(),
Sema::InstantiatingTemplate::ParameterMappingSubstitution{}, Concept,
- SourceRange(ArgsAsWritten->arguments()[0].getSourceRange().getBegin(),
- ArgsAsWritten->arguments().back().getSourceRange().getEnd()));
+ ArgsAsWritten->arguments().front().getSourceRange());
if (S.SubstTemplateArguments(*Atomic.ParameterMapping, MLTAL, SubstArgs))
return true;
More information about the llvm-branch-commits
mailing list