[clang] f799901 - [Clang][Sema] Add MultiLevelTemplateArgumentList::dump

Alexander Shaposhnikov via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 7 12:37:25 PDT 2023


Author: Alexander Shaposhnikov
Date: 2023-04-07T19:36:59Z
New Revision: f799901c06c015cc30cf123a8f0c01f8b107669e

URL: https://github.com/llvm/llvm-project/commit/f799901c06c015cc30cf123a8f0c01f8b107669e
DIFF: https://github.com/llvm/llvm-project/commit/f799901c06c015cc30cf123a8f0c01f8b107669e.diff

LOG: [Clang][Sema] Add MultiLevelTemplateArgumentList::dump

Add MultiLevelTemplateArgumentList::dump
(similarly to TemplateArgument::dump).

Differential revision: https://reviews.llvm.org/D147744

Added: 
    

Modified: 
    clang/include/clang/Sema/Template.h

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/Sema/Template.h b/clang/include/clang/Sema/Template.h
index 908389438389f..48e8b78311e12 100644
--- a/clang/include/clang/Sema/Template.h
+++ b/clang/include/clang/Sema/Template.h
@@ -261,6 +261,23 @@ enum class TemplateSubstitutionKind : char {
     }
     ArgListsIterator end() { return TemplateArgumentLists.end(); }
     ConstArgListsIterator end() const { return TemplateArgumentLists.end(); }
+
+    LLVM_DUMP_METHOD void dump() const {
+      LangOptions LO;
+      LO.CPlusPlus = true;
+      LO.Bool = true;
+      PrintingPolicy PP(LO);
+      llvm::errs() << "NumRetainedOuterLevels: " << NumRetainedOuterLevels
+                   << "\n";
+      for (unsigned Depth = NumRetainedOuterLevels; Depth < getNumLevels();
+           ++Depth) {
+        llvm::errs() << Depth << ": ";
+        printTemplateArgumentList(
+            llvm::errs(),
+            TemplateArgumentLists[getNumLevels() - Depth - 1].Args, PP);
+        llvm::errs() << "\n";
+      }
+    }
   };
 
   /// The context in which partial ordering of function templates occurs.


        


More information about the cfe-commits mailing list