[clang] [PATCH 1/6] [clang] Improve nested name specifier AST representation (PR #147835)

Matheus Izvekov via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 21 19:57:27 PDT 2025


================
@@ -181,14 +181,14 @@ template <bool IsConst> class DynamicRecursiveASTVisitorBase {
   ///
   /// \returns false if the visitation was terminated early, true
   /// otherwise (including when the argument is a Null type).
-  virtual bool TraverseType(QualType T);
+  virtual bool TraverseType(QualType T, bool TraverseQualifier = true);
----------------
mizvekov wrote:

I find the parameter easier to debug, it's easier to trace how the value gets propagated.

With a data member / RAII object, it takes longer to figure out where, in a given stack trace, the value was changed.

There is also precedent for this solution here. For example see `clang-tools-extra/clang-tidy/modernize/UseTrailingReturnTypeCheck.cpp` TraverseTypeLoc implementation, where an analogous parameter was implemented (called 'Elaborated' instead).

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


More information about the cfe-commits mailing list