[Lldb-commits] [clang] [lldb] [clang] Add -ast-dump-filter-path to filter AST dump by file path (PR #194266)

Aaron Ballman via lldb-commits lldb-commits at lists.llvm.org
Wed May 6 06:07:32 PDT 2026


================
@@ -83,7 +88,28 @@ namespace {
       return "";
     }
     bool filterMatches(Decl *D) {
-      return getName(D).find(FilterString) != std::string::npos;
+      if (!FilterString.empty() &&
+          getName(D).find(FilterString) == std::string::npos)
+        return false;
+
+      if (!FilterPath.empty()) {
+        const SourceManager &SM = D->getASTContext().getSourceManager();
+
+        SourceLocation Loc = SM.getSpellingLoc(D->getLocation());
+        if (Loc.isInvalid())
+          return false;
+
+        auto Pattern = llvm::GlobPattern::create(FilterPath);
----------------
AaronBallman wrote:

Please spell out the type (it's not obvious what it is from the initializer).

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


More information about the lldb-commits mailing list