[clang] [Sema] Fast-path simple plain auto deduction in DeduceAutoType (PR #188196)

Younan Zhang via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 2 03:58:12 PDT 2026


================
@@ -5325,12 +5386,31 @@ Sema::DeduceAutoType(TypeLoc Type, Expr *Init, QualType &Result,
           TDK != TemplateDeductionResult::Success)
         return TDK;
     }
-
     // Could be null if somehow 'auto' appears in a non-deduced context.
     if (Deduced[0].getKind() != TemplateArgument::Type)
       return TemplateDeductionResult::Incomplete;
     DeducedType = Deduced[0].getAsType();
 
+#ifndef NDEBUG
+    if (FastPathUsed) {
+      // Ignore differences due only to QualType sugar.
+      if (FastPathDeducedType != DeducedType) {
+        llvm::errs() << "Deducing: ";
+        Type.dump();
+        Init->dump();
+        llvm::errs() << "Fast-path deduced type: ";
+        FastPathDeducedType.dump();
+
+        llvm::errs() << "Slow-path deduced type: ";
+        DeducedType.dump();
+      }
----------------
zyn0217 wrote:

We shouldn't print debugging infos in either debug or release mode.
Assertions are enough.

https://github.com/llvm/llvm-project/pull/188196


More information about the cfe-commits mailing list