@@ -493,8 +493,25 @@ def format_run(self, changed_files: List[str], args: FormatArgs) -> Optional[str
493493 if not self .should_run (changed_files ):
494494 return None
495495
496+ # Debug logging
497+ if args .verbose :
498+ print (f"=== Debug: DumpASTMatchersHelper ===" )
499+ print (f"Current working directory: { os .getcwd ()} " )
500+ print (f"Script directory: { self .script_dir } " )
501+ print (f"Script name: { self .script_name } " )
502+ print (f"Script full path: { os .path .join (self .script_dir , self .script_name )} " )
503+ print (f"Script exists: { os .path .exists (os .path .join (self .script_dir , self .script_name ))} " )
504+ print (f"Output HTML path: { self .output_html } " )
505+ print (f"Output HTML exists: { os .path .exists (self .output_html )} " )
506+
496507 # Verify the input file exists
497508 matchers_header = "clang/include/clang/ASTMatchers/ASTMatchers.h"
509+ if args .verbose :
510+ print (f"Input header path: { matchers_header } " )
511+ print (f"Input header exists: { os .path .exists (matchers_header )} " )
512+ if os .path .exists (matchers_header ):
513+ print (f"Input header absolute path: { os .path .abspath (matchers_header )} " )
514+
498515 if not os .path .exists (matchers_header ):
499516 return f"Input file not found: { matchers_header } "
500517
@@ -510,6 +527,13 @@ def format_run(self, changed_files: List[str], args: FormatArgs) -> Optional[str
510527 cwd = self .script_dir ,
511528 )
512529
530+ if args .verbose :
531+ print (f"Script exit code: { proc .returncode } " )
532+ if proc .stdout :
533+ print (f"Script STDOUT (first 500 chars): { proc .stdout [:500 ]} " )
534+ if proc .stderr :
535+ print (f"Script STDERR (first 500 chars): { proc .stderr [:500 ]} " )
536+
513537 if proc .returncode != 0 :
514538 error_msg = f"Execution of 'dump_ast_matchers.py' failed with exit code { proc .returncode } "
515539 if proc .stderr :
@@ -522,15 +546,26 @@ def format_run(self, changed_files: List[str], args: FormatArgs) -> Optional[str
522546
523547 # Check if 'LibASTMatchersReference.html' file was modified
524548 cmd = ["git" , "diff" , "--exit-code" , self .output_html ]
549+ if args .verbose :
550+ print (f"Checking if output HTML was modified: { ' ' .join (cmd )} " )
551+
525552 proc = subprocess .run (
526553 cmd , stdout = subprocess .PIPE , stderr = subprocess .PIPE , encoding = "utf-8"
527554 )
528555
556+ if args .verbose :
557+ print (f"Git diff exit code: { proc .returncode } " )
558+ if proc .returncode != 0 :
559+ print (f"Output HTML was modified (diff length: { len (proc .stdout )} chars)" )
560+ else :
561+ print (f"Output HTML was NOT modified - check passed!" )
562+
529563 # 'LibASTMatchersReference.html' was modified - count as failure
530564 if proc .returncode != 0 :
531565 if args .verbose :
532- print (f"error: { self .name } exited with code { proc .returncode } " )
533- print (proc .stdout )
566+ print (f"error: { self .name } detected that { self .output_html } was modified" )
567+ print (f"This means the developer needs to run the script locally" )
568+ print (f"Diff preview (first 500 chars):\n { proc .stdout [:500 ]} " )
534569 return proc .stdout
535570 else :
536571 return None
0 commit comments