Skip to content

Commit f9a2fba

Browse files
Erich Keanetru
authored andcommitted
[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 42e371b)
1 parent ca7d6a6 commit f9a2fba

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

clang/lib/Sema/SemaConcept.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1142,8 +1142,7 @@ substituteParameterMappings(Sema &S, NormalizedConstraint &N,
11421142
Sema::InstantiatingTemplate Inst(
11431143
S, ArgsAsWritten->arguments().front().getSourceRange().getBegin(),
11441144
Sema::InstantiatingTemplate::ParameterMappingSubstitution{}, Concept,
1145-
SourceRange(ArgsAsWritten->arguments()[0].getSourceRange().getBegin(),
1146-
ArgsAsWritten->arguments().back().getSourceRange().getEnd()));
1145+
ArgsAsWritten->arguments().front().getSourceRange());
11471146
if (S.SubstTemplateArguments(*Atomic.ParameterMapping, MLTAL, SubstArgs))
11481147
return true;
11491148

0 commit comments

Comments
 (0)