================
@@ -7416,10 +7416,11 @@ NamedDecl *Sema::ActOnVariableDeclarator(
     tryToFixVariablyModifiedVarType(TInfo, R, D.getIdentifierLoc(),
                                     /*DiagID=*/0);
 
-  if (const AutoType *AutoT = R->getAs<AutoType>())
-    CheckConstrainedAuto(
-        AutoT,
-        TInfo->getTypeLoc().getContainedAutoTypeLoc().getConceptNameLoc());
+  if (const AutoType *AutoT = R->getAs<AutoType>()) {
+    AutoTypeLoc Loc = TInfo->getTypeLoc().getContainedAutoTypeLoc();
----------------
mizvekov wrote:

But here we are not just asking for the location of constrained auto.

A TypeLoc is not just a SourceLocation, it's a QualType *with* source locations.

The reason you are starting with a TypeLoc is that you are also interested in 
the source location.

This is a bit confusing because in a lot of places we pass both a QualType and 
a TypeLoc, which is mostly redundant. That might induce folks into thinking 
that a TypeLoc is just source locations on the side, which is not true.

But presently, they are not always redundant though. There are some cases we 
store both separately, and apply some transformations, like type deduction, 
only to the QualType, and leave the TypeLoc alone.
I think this is not ideal though, and seems to be mostly due to tech debt.

As an aside, if all you need to do is mark the concepts as used, you might as 
well do that earlier when the AutoType is formed, for example around the calls 
to `ASTContext::getAutoType` in `SemaType.cpp` / `ConvertDeclSpecToType`.


https://github.com/llvm/llvm-project/pull/98622
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to